diff options
| Commit | 6b8cae12cb5d60b37931332d9d8008649ae14566 (patch) | |
|---|---|---|
| Author | 2026-09-12 11:31:19 +0300 | |
| Committer | 2026-09-12 13:54:29 +0300 | |
| Files | 9ff20cdba71fff44e7b23b43e46a75276df6d7f1 /src | |
| syndamia.com-6b8cae12cb5d60b37931332d9d8008649ae14566.tar syndamia.com-6b8cae12cb5d60b37931332d9d8008649ae14566.tar.gz syndamia.com-6b8cae12cb5d60b37931332d9d8008649ae14566.zip | ||
| Parent | 918bac7614e560678d51bfba2a25582a3284bdd9 (diff) | |
feat!: Update dunbar markup
Currently the newest version of the markup is not on the main branch,
mostly because of polish and the documentation.
As an effect from the changes to the language, the sitemap is the only
thing which needs to be created externally.
161 files changed, 7195 insertions, 6007 deletions
@@ -1,3 +1,4 @@ +'def title 404 page not found! # 404 Not Found The page you were trying to access doesn't exist! diff --git a/src/about.du b/src/about.du index 7a8f289..d2d9ea7 100644 --- a/src/about.du +++ b/src/about.du @@ -1,66 +1,58 @@ -# About Me +'def title About Me +'def desc Contacts, resume, (Anti)bio, and software projects + +# {title} :defs -; [=Contact me casually=] +; {b Contact me casually} : <a href="mailto:syndamia@protonmail.com"> syndamia@protonmail.com </a> - <a class="borderless" href="/files/publickey-syndamia@protonmail.com-2c9b555f61c33e30acbe477dcb2956a33e10cc8c.asc"> <img class="borderless" src="/img/pgpkey.gif" alt="PGP key"> </a> - -\n - +<br/> <a href="mailto:kamen.s@syndamia.com"> kamen.s@syndamia.com </a> - <a class="borderless" href="/files/publickey-kamen.s@syndamia.com-0xDFC9D42E.asc"> <img class="borderless" src="/img/pgpkey.gif" alt="PGP key"> -</a> [*(for this one, make sure to check your spam folder!)*] +</a> {i (for this one, make sure to check your spam folder!)} -; [=Contact me about work and projects I'm maintaining=] +; {b Contact me about work and projects I'm maintaining} : <a href="mailto:kamen.d.mladenov@protonmail.com"> kamen.d.mladenov@protonmail.com </a> - <a class="borderless" href="/files/publickey-kamen.d.mladenov@protonmail.com-62ca52e87475c874b9e6ebf3c4c9f716b6ce4c9d.asc"> <img class="borderless" src="/img/pgpkey.gif" alt="PGP key"> </a> - -\n - +<br/> <a href="mailto:kamen@syndamia.com"> kamen@syndamia.com </a> - <a class="borderless" href="/files/publickey-kamen@syndamia.com-0x354C5F95.asc"> <img class="borderless" src="/img/pgpkey.gif" alt="PGP key"> </a> -[*for this one, make sure to check your spam folder!*] +{i for this one, make sure to check your spam folder!} +<br/> +{url linkedin.com/in/kamen-mladenov;https://www.linkedin.com/in/kamen-mladenov/} +; {b Resume} +: {url Български;/files/resume-bg.pdf} | {url English;/files/resume-en.pdf} \n -[url https://www.linkedin.com/in/kamen-mladenov/ linkedin.com/in/kamen-mladenov] - -; [=Resume=] -: [url /files/resume-bg.pdf Български] | [url /files/resume-en.pdf English] - - -\n -### Antibio [url https://www.brendangregg.com/antibio.html (opposite of bio, and much more fun)] +### Antibio {url (opposite of bio, and much more fun);https://www.brendangregg.com/antibio.html} <img id="about-image" class="borderless" src="/img/face.jpeg" alt=""> -I'm a [url https://www.fmi.uni-sofia.bg/en university] student and general computer nerd. -My current interests include: operating systems, functional programming, webdev (without [=any=] libraries, pure JavaScript), old tech, some amount of server administration and a teeny weeny bit of computer history. +I'm a {url university;https://www.fmi.uni-sofia.bg/en} student and general computer nerd. +My current interests include: operating systems, functional programming, webdev (without {b any} libraries, pure JavaScript), old tech, some amount of server administration and a teeny weeny bit of computer history. -I have a good amount of [url https://gitlab.com/users/Syndamia/projects projects under my belt], although very few are actually useful. -I've put down the more notable ones [url /software here], but [url https://github.com/Syndamia/filite-list filite-list] and [url https://github.com/Syndamia/min-youtube-element-blocker min-youtube-element-blocker] seem to have gotten the most attention (if any). +I have a good amount of {url projects under my belt;https://gitlab.com/users/Syndamia/projects}, although very few are actually useful. +I've put down the more notable ones {url here;/software}, but {url filite-list;https://github.com/Syndamia/filite-list} and {url min-youtube-element-blocker;https://github.com/Syndamia/min-youtube-element-blocker} seem to have gotten the most attention (if any). As for what exactly you can expect in the future, anything goes really. I've done a lot of low(er)-level programming, a bit less functional programming, professional-ish web development (back-end + front-end), a whole lot of scripting and more server/system administration that I would ever want. @@ -75,49 +67,49 @@ This is a curated list of the more relevant software projects I've made or heavi \n -#### [*2023*] +#### {i 2023} :defs -; [url https://gitlab.com/Syndamia/texty-office gitlab / texty-office] + [url https://gitlab.com/Syndamia/texty-office.vim gitlab / texty-office.vim] -: An imperfect converter from DOCX, PPTX and XLSX to normal text with it's associated [url https://www.vim.org/ Vim] plugin. \n - [`GNU GPLv3`] & [`MIT`] | [`C++`] [`vimscript`] | [`Office file`] [`converter`] [`plugin`] [`Vim`] [`CLI tool`] +; {url gitlab / texty-office;https://gitlab.com/Syndamia/texty-office} + {url gitlab / texty-office.vim;https://gitlab.com/Syndamia/texty-office.vim} +: An imperfect converter from DOCX, PPTX and XLSX to normal text with it's associated {url Vim;https://www.vim.org/} plugin. \n + {` GNU GPLv3} & {` MIT} | {` C++} {` vimscript} | {` Office file} {` converter} {` plugin} {` Vim} {` CLI tool} -; [url https://gitlab.com/Syndamia/small-web-utilities gitlab / small-web-utilities]   [*maintained*] -: A collection of small but fast utilities, like a checklist, that work locally on your browser. Also hosted [url https://utils.syndamia.com here]. \n - [`GNU GPLv3`] | [`HTML`] [`Javascript`] | [`checklist`] [`utilities`] +; {url gitlab / small-web-utilities;https://gitlab.com/Syndamia/small-web-utilities}   {i maintained} +: A collection of small but fast utilities, like a checklist, that work locally on your browser. Also hosted {url here;https://utils.syndamia.com}. \n + {` GNU GPLv3} | {` HTML} {` Javascript} | {` checklist} {` utilities} -; [url https://gitlab.com/Syndamia/ss-law gitlab / ss-law] + [url https://github.com/Syndamia/ss-law github / ss-law]   [*maintained*] +; {url gitlab / ss-law;https://gitlab.com/Syndamia/ss-law} + {url github / ss-law;https://github.com/Syndamia/ss-law}   {i maintained} : A small, lightweight and simple static site generation system, extracted as a template from my own \n - [`Markdown`] [`bash`] [`awk`] | [`ssg`] [`lowdown`] [`static site generator`] [`pipelines`] + {` Markdown} {` bash} {` awk} | {` ssg} {` lowdown} {` static site generator} {` pipelines} -; [url https://gitlab.com/Syndamia/homelander gitlab / homelander]   [*maintained*] +; {url gitlab / homelander;https://gitlab.com/Syndamia/homelander}   {i maintained} : A very small and good looking, handmade prompt for zsh \n - [`GPLv3`] | [`bash`] | [`zsh`] [`shell`] [`prompt`] [`script`] [`Linux`] + {` GPLv3} | {` bash} | {` zsh} {` shell} {` prompt} {` script} {` Linux} -; [url https://gitlab.com/Syndamia/goodwolf gitlab / goodwolf]   [*abandoned*] -: Fork of the [url https://hacktivis.me/projects/badwolf badwolf] browser, which aims to add features \n - [`BSD-3-Clause`] | [`C`] | [`web browser`] [`GTK`] [`WebKitGTK`] [`Linux`] +; {url gitlab / goodwolf;https://gitlab.com/Syndamia/goodwolf}   {i abandoned} +: Fork of the {url badwolf;https://hacktivis.me/projects/badwolf} browser, which aims to add features \n + {` BSD-3-Clause} | {` C} | {` web browser} {` GTK} {` WebKitGTK} {` Linux} -#### [*2021*] +#### {i 2021} :defs -; [url https://gitlab.com/Syndamia/reposync gitlab / RepoSync]   [*completed*] +; {url gitlab / RepoSync;https://gitlab.com/Syndamia/reposync}   {i completed} : Script and some config files for synchronizing a git repository with a server \n - [`MIT`] | [`python`] | [`server`] [`git`] [`systemd`] + {` MIT} | {` python} | {` server} {` git} {` systemd} -; [url https://github.com/Syndamia/filite-list github / filite-list]   [*completed*] -: Script for managing [url https://github.com/raftario/filite filite] links \n - [`GPLv3`] | [`bash`] | [`filite`] [`server`] [`script`] [`Linux`] +; {url github / filite-list;https://github.com/Syndamia/filite-list}   {i completed} +: Script for managing {url filite;https://github.com/raftario/filite} links \n + {` GPLv3} | {` bash} | {` filite} {` server} {` script} {` Linux} -#### [*2020*] +#### {i 2020} :defs -; [url https://github.com/Team-Kaleidoscope/DevHive github / DevHive] and [url https://github.com/Team-Kaleidoscope/DevHive-Angular github / DevHive-Angular]   [*completed*] +; {url github / DevHive;https://github.com/Team-Kaleidoscope/DevHive} and {url github / DevHive-Angular;https://github.com/Team-Kaleidoscope/DevHive-Angular}   {i completed} : DevHive is a social network oriented towards programmers. It's FOSS, built from the ground up, and made from a team of three for a course. \n - [`GPLv3`] | [`C#`] [`TypeScript`] | [`Angular`] [`ASP.NET Core`] [`social media`] [`mvc`] [`Docker`] [`CSS`] + {` GPLv3} | {` C#} {` TypeScript} | {` Angular} {` ASP.NET Core} {` social media} {` mvc} {` Docker} {` CSS} -; [url https://github.com/Syndamia/min-youtube-element-blocker github / min-youtube-element-blocker]   [*maintained*] +; {url github / min-youtube-element-blocker;https://github.com/Syndamia/min-youtube-element-blocker}   {i maintained} : Userscript for hiding certain UI elements in YouTube \n - [`MIT`] | [`JavaScript`] | [`youtube`] [`userscript`] [`css`] + {` MIT} | {` JavaScript} | {` youtube} {` userscript} {` css} diff --git a/src/about/index.du b/src/about/index.du index 7a8f289..d2d9ea7 100644 --- a/src/about/index.du +++ b/src/about/index.du @@ -1,66 +1,58 @@ -# About Me +'def title About Me +'def desc Contacts, resume, (Anti)bio, and software projects + +# {title} :defs -; [=Contact me casually=] +; {b Contact me casually} : <a href="mailto:syndamia@protonmail.com"> syndamia@protonmail.com </a> - <a class="borderless" href="/files/publickey-syndamia@protonmail.com-2c9b555f61c33e30acbe477dcb2956a33e10cc8c.asc"> <img class="borderless" src="/img/pgpkey.gif" alt="PGP key"> </a> - -\n - +<br/> <a href="mailto:kamen.s@syndamia.com"> kamen.s@syndamia.com </a> - <a class="borderless" href="/files/publickey-kamen.s@syndamia.com-0xDFC9D42E.asc"> <img class="borderless" src="/img/pgpkey.gif" alt="PGP key"> -</a> [*(for this one, make sure to check your spam folder!)*] +</a> {i (for this one, make sure to check your spam folder!)} -; [=Contact me about work and projects I'm maintaining=] +; {b Contact me about work and projects I'm maintaining} : <a href="mailto:kamen.d.mladenov@protonmail.com"> kamen.d.mladenov@protonmail.com </a> - <a class="borderless" href="/files/publickey-kamen.d.mladenov@protonmail.com-62ca52e87475c874b9e6ebf3c4c9f716b6ce4c9d.asc"> <img class="borderless" src="/img/pgpkey.gif" alt="PGP key"> </a> - -\n - +<br/> <a href="mailto:kamen@syndamia.com"> kamen@syndamia.com </a> - <a class="borderless" href="/files/publickey-kamen@syndamia.com-0x354C5F95.asc"> <img class="borderless" src="/img/pgpkey.gif" alt="PGP key"> </a> -[*for this one, make sure to check your spam folder!*] +{i for this one, make sure to check your spam folder!} +<br/> +{url linkedin.com/in/kamen-mladenov;https://www.linkedin.com/in/kamen-mladenov/} +; {b Resume} +: {url Български;/files/resume-bg.pdf} | {url English;/files/resume-en.pdf} \n -[url https://www.linkedin.com/in/kamen-mladenov/ linkedin.com/in/kamen-mladenov] - -; [=Resume=] -: [url /files/resume-bg.pdf Български] | [url /files/resume-en.pdf English] - - -\n -### Antibio [url https://www.brendangregg.com/antibio.html (opposite of bio, and much more fun)] +### Antibio {url (opposite of bio, and much more fun);https://www.brendangregg.com/antibio.html} <img id="about-image" class="borderless" src="/img/face.jpeg" alt=""> -I'm a [url https://www.fmi.uni-sofia.bg/en university] student and general computer nerd. -My current interests include: operating systems, functional programming, webdev (without [=any=] libraries, pure JavaScript), old tech, some amount of server administration and a teeny weeny bit of computer history. +I'm a {url university;https://www.fmi.uni-sofia.bg/en} student and general computer nerd. +My current interests include: operating systems, functional programming, webdev (without {b any} libraries, pure JavaScript), old tech, some amount of server administration and a teeny weeny bit of computer history. -I have a good amount of [url https://gitlab.com/users/Syndamia/projects projects under my belt], although very few are actually useful. -I've put down the more notable ones [url /software here], but [url https://github.com/Syndamia/filite-list filite-list] and [url https://github.com/Syndamia/min-youtube-element-blocker min-youtube-element-blocker] seem to have gotten the most attention (if any). +I have a good amount of {url projects under my belt;https://gitlab.com/users/Syndamia/projects}, although very few are actually useful. +I've put down the more notable ones {url here;/software}, but {url filite-list;https://github.com/Syndamia/filite-list} and {url min-youtube-element-blocker;https://github.com/Syndamia/min-youtube-element-blocker} seem to have gotten the most attention (if any). As for what exactly you can expect in the future, anything goes really. I've done a lot of low(er)-level programming, a bit less functional programming, professional-ish web development (back-end + front-end), a whole lot of scripting and more server/system administration that I would ever want. @@ -75,49 +67,49 @@ This is a curated list of the more relevant software projects I've made or heavi \n -#### [*2023*] +#### {i 2023} :defs -; [url https://gitlab.com/Syndamia/texty-office gitlab / texty-office] + [url https://gitlab.com/Syndamia/texty-office.vim gitlab / texty-office.vim] -: An imperfect converter from DOCX, PPTX and XLSX to normal text with it's associated [url https://www.vim.org/ Vim] plugin. \n - [`GNU GPLv3`] & [`MIT`] | [`C++`] [`vimscript`] | [`Office file`] [`converter`] [`plugin`] [`Vim`] [`CLI tool`] +; {url gitlab / texty-office;https://gitlab.com/Syndamia/texty-office} + {url gitlab / texty-office.vim;https://gitlab.com/Syndamia/texty-office.vim} +: An imperfect converter from DOCX, PPTX and XLSX to normal text with it's associated {url Vim;https://www.vim.org/} plugin. \n + {` GNU GPLv3} & {` MIT} | {` C++} {` vimscript} | {` Office file} {` converter} {` plugin} {` Vim} {` CLI tool} -; [url https://gitlab.com/Syndamia/small-web-utilities gitlab / small-web-utilities]   [*maintained*] -: A collection of small but fast utilities, like a checklist, that work locally on your browser. Also hosted [url https://utils.syndamia.com here]. \n - [`GNU GPLv3`] | [`HTML`] [`Javascript`] | [`checklist`] [`utilities`] +; {url gitlab / small-web-utilities;https://gitlab.com/Syndamia/small-web-utilities}   {i maintained} +: A collection of small but fast utilities, like a checklist, that work locally on your browser. Also hosted {url here;https://utils.syndamia.com}. \n + {` GNU GPLv3} | {` HTML} {` Javascript} | {` checklist} {` utilities} -; [url https://gitlab.com/Syndamia/ss-law gitlab / ss-law] + [url https://github.com/Syndamia/ss-law github / ss-law]   [*maintained*] +; {url gitlab / ss-law;https://gitlab.com/Syndamia/ss-law} + {url github / ss-law;https://github.com/Syndamia/ss-law}   {i maintained} : A small, lightweight and simple static site generation system, extracted as a template from my own \n - [`Markdown`] [`bash`] [`awk`] | [`ssg`] [`lowdown`] [`static site generator`] [`pipelines`] + {` Markdown} {` bash} {` awk} | {` ssg} {` lowdown} {` static site generator} {` pipelines} -; [url https://gitlab.com/Syndamia/homelander gitlab / homelander]   [*maintained*] +; {url gitlab / homelander;https://gitlab.com/Syndamia/homelander}   {i maintained} : A very small and good looking, handmade prompt for zsh \n - [`GPLv3`] | [`bash`] | [`zsh`] [`shell`] [`prompt`] [`script`] [`Linux`] + {` GPLv3} | {` bash} | {` zsh} {` shell} {` prompt} {` script} {` Linux} -; [url https://gitlab.com/Syndamia/goodwolf gitlab / goodwolf]   [*abandoned*] -: Fork of the [url https://hacktivis.me/projects/badwolf badwolf] browser, which aims to add features \n - [`BSD-3-Clause`] | [`C`] | [`web browser`] [`GTK`] [`WebKitGTK`] [`Linux`] +; {url gitlab / goodwolf;https://gitlab.com/Syndamia/goodwolf}   {i abandoned} +: Fork of the {url badwolf;https://hacktivis.me/projects/badwolf} browser, which aims to add features \n + {` BSD-3-Clause} | {` C} | {` web browser} {` GTK} {` WebKitGTK} {` Linux} -#### [*2021*] +#### {i 2021} :defs -; [url https://gitlab.com/Syndamia/reposync gitlab / RepoSync]   [*completed*] +; {url gitlab / RepoSync;https://gitlab.com/Syndamia/reposync}   {i completed} : Script and some config files for synchronizing a git repository with a server \n - [`MIT`] | [`python`] | [`server`] [`git`] [`systemd`] + {` MIT} | {` python} | {` server} {` git} {` systemd} -; [url https://github.com/Syndamia/filite-list github / filite-list]   [*completed*] -: Script for managing [url https://github.com/raftario/filite filite] links \n - [`GPLv3`] | [`bash`] | [`filite`] [`server`] [`script`] [`Linux`] +; {url github / filite-list;https://github.com/Syndamia/filite-list}   {i completed} +: Script for managing {url filite;https://github.com/raftario/filite} links \n + {` GPLv3} | {` bash} | {` filite} {` server} {` script} {` Linux} -#### [*2020*] +#### {i 2020} :defs -; [url https://github.com/Team-Kaleidoscope/DevHive github / DevHive] and [url https://github.com/Team-Kaleidoscope/DevHive-Angular github / DevHive-Angular]   [*completed*] +; {url github / DevHive;https://github.com/Team-Kaleidoscope/DevHive} and {url github / DevHive-Angular;https://github.com/Team-Kaleidoscope/DevHive-Angular}   {i completed} : DevHive is a social network oriented towards programmers. It's FOSS, built from the ground up, and made from a team of three for a course. \n - [`GPLv3`] | [`C#`] [`TypeScript`] | [`Angular`] [`ASP.NET Core`] [`social media`] [`mvc`] [`Docker`] [`CSS`] + {` GPLv3} | {` C#} {` TypeScript} | {` Angular} {` ASP.NET Core} {` social media} {` mvc} {` Docker} {` CSS} -; [url https://github.com/Syndamia/min-youtube-element-blocker github / min-youtube-element-blocker]   [*maintained*] +; {url github / min-youtube-element-blocker;https://github.com/Syndamia/min-youtube-element-blocker}   {i maintained} : Userscript for hiding certain UI elements in YouTube \n - [`MIT`] | [`JavaScript`] | [`youtube`] [`userscript`] [`css`] + {` MIT} | {` JavaScript} | {` youtube} {` userscript} {` css} diff --git a/src/accessibility.du b/src/accessibility.du index 7ed44d3..0cfaa77 100644 --- a/src/accessibility.du +++ b/src/accessibility.du @@ -1,4 +1,7 @@ -# Accessibility +'def title Accessibility +'def desc I do want to make sure the content on this website is consumable by people with disabilities, however I also want to fancy features. I'm currently maintaining a balance between the two. + +# {title} I do personally want to make sure the content on this website is consumable by people with disabilities and/or with poor internet connection and browser speed. However, at the same time, I want to add any feature that I feel would improve the website experience, for everyone else. @@ -6,7 +9,7 @@ This is how I reach a middle ground between both sides: ### Bare bone website version -At [url https://tiny.syndamia.com tiny.syndamia.com] I offer my website with almost all styling and JavaScript functionality removed. +At {url tiny.syndamia.com;https://tiny.syndamia.com} I offer my website with almost all styling and JavaScript functionality removed. You'll receive only the webpage text and asset contents, and nothing more. From my testing, pages usually load two times faster on tiny.syndamia.com. @@ -16,16 +19,16 @@ I do also hope that without the styling and JavaScript, people with impairments 'footnote normal-pages Meaning a page that has only text, images and video. If the page contains a JavaScript demo, it obviously cannot function entirely without JS. -By design, all "normal" pages[$normal-pages] can be viewed without any JavaScript, any styling and any custom font. +By design, all "normal" pages{normal-pages} can be viewed without any JavaScript, any styling and any custom font. All of those are meant to make the browsing experience prettier and easier for those that can benefit from it and allow you to change and block certain features without the content being obstructed. -Even my [url /talks talks], where each one is a collection of delicately crafted CSS and JS slides, can be viewed as any normal text article on my site. +Even my {url talks;/talks}, where each one is a collection of delicately crafted CSS and JS slides, can be viewed as any normal text article on my site. ### Reasonable icons First, icons on this website are managed with an icon font. -I've watched [url https://www.youtube.com/watch?v=9xXBYcWgCHA Seren Davies' talk], but I've found working with SVGs noticeably increases workload on my end. +I've watched {url Seren Davies' talk;https://www.youtube.com/watch?v=9xXBYcWgCHA}, but I've found working with SVGs noticeably increases workload on my end. -[=However=], I've still implemented those icons with accessibility in mind: +{b However}, I've still implemented those icons with accessibility in mind: :unordered - Navigation is done with text entries in the sidebar, not icons. diff --git a/src/acknowledgements.du b/src/acknowledgements.du index 06d0aad..fb4cc5b 100644 --- a/src/acknowledgements.du +++ b/src/acknowledgements.du @@ -1,36 +1,39 @@ -# Acknowledgements +'def title Acknowledgements +'def desc A list of (mostly) icon projects and blog inspirations + +# {title} :defs -; [url https://github.com/tabler/tabler-icons tabler-icons], licensed under [url https://github.com/tabler/tabler-icons/blob/master/LICENSE MIT] +; {url tabler-icons;https://github.com/tabler/tabler-icons}, licensed under {url MIT;https://github.com/tabler/tabler-icons/blob/master/LICENSE} : All UI icons -; [url https://github.com/sindresorhus/github-markdown-css github-markdown-css], licensed under [url https://github.com/sindresorhus/github-markdown-css/blob/main/license MIT] +; {url github-markdown-css;https://github.com/sindresorhus/github-markdown-css}, licensed under {url MIT;https://github.com/sindresorhus/github-markdown-css/blob/main/license} : Some of the styling, especially for tables and code/pre tags -; [url https://github.com/lipis/flag-icons flag-icons], licensed under [url https://github.com/lipis/flag-icons/blob/main/LICENSE MIT] +; {url flag-icons;https://github.com/lipis/flag-icons}, licensed under {url MIT;https://github.com/lipis/flag-icons/blob/main/LICENSE} : Icons of flags -; [url https://github.com/linuxmint/mint-y-icons mint-y-icons], licensed under [url https://creativecommons.org/licenses/by-sa/4.0 CC BY-SA 4.0] +; {url mint-y-icons;https://github.com/linuxmint/mint-y-icons}, licensed under {url CC BY-SA 4.0;https://creativecommons.org/licenses/by-sa/4.0} : Certain icons in articles/pages ## Special thanks to :defs -; [url https://danluu.com/programming-blogs/ danuluu's programming blogs list] +; {url danuluu's programming blogs list;https://danluu.com/programming-blogs/} : For the excellent list of awesome blogs, from which I drew a good amount of inspiration. -; [url https://shipilev.net/ Aleksey Shipilëv's], [url https://tonsky.me/ Nikita's], [url https://jvns.ca/ Julia Evan's] and [url https://hacktivis.me Haelwenn Monnier's] blogs +; {url Aleksey Shipilëv's;https://shipilev.net/}, {url Nikita's;https://tonsky.me/}, {url Julia Evan's;https://jvns.ca/} and {url Haelwenn Monnier's;https://hacktivis.me} blogs : From which I drew the most inspiration -; [url http://www.ringlet.net/roam/ Peter Pentchev's personal page] +; {url Peter Pentchev's personal page;http://www.ringlet.net/roam/} : For igniting my love for website badges and the somewhat rare "Created with Vim" badge -; [url https://www.anybrowser.org/cdaveb/ Cari D. Burstein] -: For his [url https://www.anybrowser.org/campaign/index.html Viewable with Any Browser] comapign and the awesome [url https://www.anybrowser.org/campaign/abgraphics.html provided badges] +; {url Cari D. Burstein;https://www.anybrowser.org/cdaveb/} +: For his {url Viewable with Any Browser;https://www.anybrowser.org/campaign/index.html} comapign and the awesome {url provided badges;https://www.anybrowser.org/campaign/abgraphics.html} -; [url https://sh2.us/ RusticCyberpunk/cypnk] <img class="borderless" src="https://sh2.us/buttons/btn-cypnk-at-sh2.png" alt=""> -: For his [url https://sh2.us/buttons/ archive] of [url https://gtmcknight.com/ Taylor McKnight's] collection of buttons +; {url RusticCyberpunk/cypnk;https://sh2.us/} <img class="borderless" src="https://sh2.us/buttons/btn-cypnk-at-sh2.png" alt=""> +: For his {url archive;https://sh2.us/buttons/} of {url Taylor McKnight's;https://gtmcknight.com/} collection of buttons -; [url https://kalsey.com/ Adam Kalsey] -: For his awesome [url https://kalsey.com/tools/buttonmaker/ button maker] +; {url Adam Kalsey;https://kalsey.com/} +: For his awesome {url button maker;https://kalsey.com/tools/buttonmaker/} diff --git a/src/blog.du b/src/blog.du index cf0bf46..d282d38 100644 --- a/src/blog.du +++ b/src/blog.du @@ -1,113 +1,116 @@ -# Blog +'def title Blog +'def desc Articles detailing personal experiences or exploration of certain topics + +# {title} Articles detailing personal experiences or exploration of certain topics. \n -#### [*2024*] +#### {i 2024} :defs -; [$bg] 18 Nov   [url /blog/switchut-izgorq Суичът изгоря!] -: [`Shallow dive`] | [`Story`] | [`Networking`] [`Switch`] [`NetworkPartner`] +; {bg} 18 Nov   {url Суичът изгоря!;/blog/switchut-izgorq} +: {` Shallow dive} | {` Story} | {` Networking} {` Switch} {` NetworkPartner} -; [$gb] 06 Oct   [url /blog/the-physics-behind-a-black-hole-shader The physics behind a black hole shader] -: [`Deep dive`] | [`Physics`] | [`General theory of relativity`] [`Celestial mechanics`] [`Gravity`] [`Black Hole`] [`Algorithm`] +; {gb} 06 Oct   {url The physics behind a black hole shader;/blog/the-physics-behind-a-black-hole-shader} +: {` Deep dive} | {` Physics} | {` General theory of relativity} {` Celestial mechanics} {` Gravity} {` Black Hole} {` Algorithm} -; [$gb] 20 Feb   [url /blog/microsoft-and-foss-extinguish Microsoft and FOSS: a fire to be extinguished] -: [`Shallow dive`] | [`Opinion`] | [`Microsoft`] [`GitHub`] [`Linux`] [`FOSS`] +; {gb} 20 Feb   {url Microsoft and FOSS: a fire to be extinguished;/blog/microsoft-and-foss-extinguish} +: {` Shallow dive} | {` Opinion} | {` Microsoft} {` GitHub} {` Linux} {` FOSS} -#### [*2023*] +#### {i 2023} :defs -; [$gb] 16 Dec   [url /blog/fix-qc-timeout Fix "qc timeout" kernel log error] -: [`Linux`] | [`kernel`] | [`libata`] [`qc`] [`logs`] [`DMA`] +; {gb} 16 Dec   {url Fix "qc timeout" kernel log error;/blog/fix-qc-timeout} +: {` Linux} | {` kernel} | {` libata} {` qc} {` logs} {` DMA} -; [$gb] 30 Aug   [url /blog/thinkpad-x270-my-favorite-machine ThinkPad X270 - my favorite machine] -: [`Medium dive`] | [`Review`] | [`Lenovo`] [`ThinkPad`] [`Yoga`] +; {gb} 30 Aug   {url ThinkPad X270 - my favorite machine;/blog/thinkpad-x270-my-favorite-machine} +: {` Medium dive} | {` Review} | {` Lenovo} {` ThinkPad} {` Yoga} -; [$gb] 19 Jul   [url /blog/icon-fonts-arent-evil-you-just-have-to-care Icon fonts aren't evil, you just have to care] -: [`Shallow dive`] | [`Web development`] | [`Icon font`] [`SVG`] [`Accessibility`] [`FontForge`] +; {gb} 19 Jul   {url Icon fonts aren't evil, you just have to care;/blog/icon-fonts-arent-evil-you-just-have-to-care} +: {` Shallow dive} | {` Web development} | {` Icon font} {` SVG} {` Accessibility} {` FontForge} -; [$bg] 14 Jul   [url /blog/fmi-i-vissheto-obrazovanie-v-programistkata-industriq ФМИ и висшето образование в програмистката индустрия] -: [`Deep dive`] | [`University`] | [`FMI`] [`Education`] +; {bg} 14 Jul   {url ФМИ и висшето образование в програмистката индустрия;/blog/fmi-i-vissheto-obrazovanie-v-programistkata-industriq} +: {` Deep dive} | {` University} | {` FMI} {` Education} -; [$gb] 28 Jun   [url /blog/fix-network-brother-printers Fix networked Brother printers not working in Linux] -: [`Linux`] | [`CUPS`] | [`Printers`] [`Brother`] [`Network`] [`avahi`] +; {gb} 28 Jun   {url Fix networked Brother printers not working in Linux;/blog/fix-network-brother-printers} +: {` Linux} | {` CUPS} | {` Printers} {` Brother} {` Network} {` avahi} -; [$gb] 14 Jun   [url /blog/gns3-initsh-no-such-file Fix "exec /gns3/init.sh: no such file or directory"] -: [`Linux`] | [`GNS3`] | [`Docker`] [`busybox`] +; {gb} 14 Jun   {url Fix "exec /gns3/init.sh: no such file or directory";/blog/gns3-initsh-no-such-file} +: {` Linux} | {` GNS3} | {` Docker} {` busybox} -; [$gb] 07 Jun   [url /blog/friendship-ended-with-funtoo-now-gentoo-is-my-best-friend Friendship ended with Funtoo, now Gentoo is my best friend] -: [`Shallow dive`] | [`Linux`] | [`Funtoo`] [`Gentoo`] [`portage`] [`packages`] [`emerge`] [`ebuild`] +; {gb} 07 Jun   {url Friendship ended with Funtoo, now Gentoo is my best friend;/blog/friendship-ended-with-funtoo-now-gentoo-is-my-best-friend} +: {` Shallow dive} | {` Linux} | {` Funtoo} {` Gentoo} {` portage} {` packages} {` emerge} {` ebuild} -; [$gb] 01 May   [url /blog/bash-is-weird BASH is weird] -: [`Shallow dive`] | [`bash`] | [`Linux`] [`scripting`] +; {gb} 01 May   {url BASH is weird;/blog/bash-is-weird} +: {` Shallow dive} | {` bash} | {` Linux} {` scripting} -; [$gb] 26 Apr   [url /blog/install-drivers-for-epson-scanners Install drivers for Epson scanners] -: [`Linux`] | [`SANE`] | [`Scanners`] [`Epson`] [`epkowa`] [`iscan`] +; {gb} 26 Apr   {url Install drivers for Epson scanners;/blog/install-drivers-for-epson-scanners} +: {` Linux} | {` SANE} | {` Scanners} {` Epson} {` epkowa} {` iscan} -; [$gb] 25 Apr   [url /blog/managing-apps-with-adb-without-root Managing Android apps with ADB (and without root)] -: [`Android`] | [`ADB`] | [`Apps`] [`Linux`] [`Windows`] +; {gb} 25 Apr   {url Managing Android apps with ADB (and without root);/blog/managing-apps-with-adb-without-root} +: {` Android} | {` ADB} | {` Apps} {` Linux} {` Windows} -; [$gb] 18 Apr   [url /blog/sane-explanation-of-compilers/part-1 Sane explanation of compilers: Part 1] -: [`Deep dive`] | [`Compilers`] | [`C`] [`yacc`] [`bison`] [`math`] [`Trees`] [`Regex`] [`Grammar`] [`Languages`] +; {gb} 18 Apr   {url Sane explanation of compilers: Part 1;/blog/sane-explanation-of-compilers/part-1} +: {` Deep dive} | {` Compilers} | {` C} {` yacc} {` bison} {` math} {` Trees} {` Regex} {` Grammar} {` Languages} -; [$gb] 13 Jan   [url /blog/plan9-in-linux-mouse-menus Plan 9 in Linux: Mouse menus] -: [`Medium dive`] | [`Linux`] | [`Plan 9`] [`mouse`] [`bash`] [`script`] [`X11`] [`openbox`] [`jgmenu`] [`plumber`] +; {gb} 13 Jan   {url Plan 9 in Linux: Mouse menus;/blog/plan9-in-linux-mouse-menus} +: {` Medium dive} | {` Linux} | {` Plan 9} {` mouse} {` bash} {` script} {` X11} {` openbox} {` jgmenu} {` plumber} -; [$gb] 01 Jan   [url /blog/virt-manager-freeze-on-browse virt-manager freezing up when clicking Browse in any window] -: [`Linux`] | [`virt-manager`] | [`QEMU/KVM`] [`libvirt`] [`Linux`] [`GTK`] +; {gb} 01 Jan   {url virt-manager freezing up when clicking Browse in any window;/blog/virt-manager-freeze-on-browse} +: {` Linux} | {` virt-manager} | {` QEMU/KVM} {` libvirt} {` Linux} {` GTK} -#### [*2022*] +#### {i 2022} :defs -; [$gb] 23 Dec   [url /blog/2.6-years-of-web-design 2.6 years of web design] -: [`Shallow dive`] | [`Web design`] +; {gb} 23 Dec   {url 2.6 years of web design;/blog/2.6-years-of-web-design} +: {` Shallow dive} | {` Web design} -; [$gb] 13 Dec   [url /blog/when-a-language-forces-simpler-thinking When a language forces simpler thinking] -: [`Shallow dive`] | [`Common Lisp`] | [`Advent of Code`] +; {gb} 13 Dec   {url When a language forces simpler thinking;/blog/when-a-language-forces-simpler-thinking} +: {` Shallow dive} | {` Common Lisp} | {` Advent of Code} -; [$gb] 04 Dec   [url /blog/taming-the-fun-too Taming The Fun-too] -: [`Story`] | [`Funtoo`] | [`Linux`] [`Gentoo`] [`packages`] +; {gb} 04 Dec   {url Taming The Fun-too;/blog/taming-the-fun-too} +: {` Story} | {` Funtoo} | {` Linux} {` Gentoo} {` packages} -; [$gb] 01 Nov   [url /blog/turn-off-notifications-windows How to turn off notifications on Windows] -: [`Windows 10`] | [`Settings`] | [`Notifications`] +; {gb} 01 Nov   {url How to turn off notifications on Windows;/blog/turn-off-notifications-windows} +: {` Windows 10} | {` Settings} | {` Notifications} -; [$gb] 01 Nov   [url /blog/disable-sticky-keys-popup How to disable Sticky Keys prompt] -: [`Windows`] | [`Settings`] | [`Sticky Keys`] +; {gb} 01 Nov   {url How to disable Sticky Keys prompt;/blog/disable-sticky-keys-popup} +: {` Windows} | {` Settings} | {` Sticky Keys} -; [$gb] 26 Oct   [url /blog/remove-weather-widget How to remove Windows Weather Widget] -: [`Windows 10`] | [`Settings`] | [`Taskbar`] [`Weather Widget`] +; {gb} 26 Oct   {url How to remove Windows Weather Widget;/blog/remove-weather-widget} +: {` Windows 10} | {` Settings} | {` Taskbar} {` Weather Widget} -; [$gb] 04 Oct   [url /blog/windows-run-dialog Windows Run dialog] -: [`Windows`] | [`Commands`] | [`Run`] [`Settings`] +; {gb} 04 Oct   {url Windows Run dialog;/blog/windows-run-dialog} +: {` Windows} | {` Commands} | {` Run} {` Settings} -; [$gb] 03 Oct   [url /blog/export-skype How to export Skype data] -: [`Skype`] | [`Export`] | [`Archive`] [`skype-parser`] +; {gb} 03 Oct   {url How to export Skype data;/blog/export-skype} +: {` Skype} | {` Export} | {` Archive} {` skype-parser} -; [$gb] 16 Sep   [url /blog/how-to-encrypt-email How to encrypt email] -: [`All`] | [`Email`] | [`PGP`] [`S/MIME`] [`Email Client`] [`Gmail`] [`Outlook`] [`Protonmail`] +; {gb} 16 Sep   {url How to encrypt email;/blog/how-to-encrypt-email} +: {` All} | {` Email} | {` PGP} {` S/MIME} {` Email Client} {` Gmail} {` Outlook} {` Protonmail} -; [$gb] 10 Sep   [url /blog/encrypted-email Encrypted email] -: [`Medium dive`] | [`Email`] | [`Encryption`] [`Security`] [`PGP`] [`S/MIME`] [`Protonmail`] [`Tutanota`] +; {gb} 10 Sep   {url Encrypted email;/blog/encrypted-email} +: {` Medium dive} | {` Email} | {` Encryption} {` Security} {` PGP} {` S/MIME} {` Protonmail} {` Tutanota} -; [$gb] 30 Jul   [url /blog/fix-no-frame-buffer-plan9 Fix "No frame buffer" error in <span class="no-wrap">Plan 9</span>] -: [`Plan 9`] | [`Configuration`] | [`QEMU/KVM`] [`Linux`] [`monitor`] +; {gb} 30 Jul   {url Fix "No frame buffer" error in <span class="no-wrap">Plan 9</span>;/blog/fix-no-frame-buffer-plan9} +: {` Plan 9} | {` Configuration} | {` QEMU/KVM} {` Linux} {` monitor} -; [$gb] 30 Jul   [url /blog/install-plan9-with-virt-manager Install <span class="no-wrap">Plan 9</span> with virt-manager] -: [`Plan 9`] | [`Installation`] | [`Setup`] [`QEMU/KVM`] [`virt-manager`] [`Linux`] +; {gb} 30 Jul   {url Install <span class="no-wrap">Plan 9</span> with virt-manager;/blog/install-plan9-with-virt-manager} +: {` Plan 9} | {` Installation} | {` Setup} {` QEMU/KVM} {` virt-manager} {` Linux} -#### [*2020*] +#### {i 2020} :defs -; [$gb] 24 Jul   [url /blog/how-to-use-jira How to use Jira] -: [`Project Management`] | [`Jira`] | [`Agile`] [`Issue tracking`] [`Bug tracking`] [`Kanban`] [`Atlassian`] +; {gb} 24 Jul   {url How to use Jira;/blog/how-to-use-jira} +: {` Project Management} | {` Jira} | {` Agile} {` Issue tracking} {` Bug tracking} {` Kanban} {` Atlassian} -; [$gb] 21 May   [url /blog/connect-to-mysql-in-dotnet-ef Connect to Mysql in .NET and Entity Framework] -: [`ASP.Net`] | [`MySQL`] | [`Entity Framework`] [`Pomelo`] +; {gb} 21 May   {url Connect to Mysql in .NET and Entity Framework;/blog/connect-to-mysql-in-dotnet-ef} +: {` ASP.Net} | {` MySQL} | {` Entity Framework} {` Pomelo} -; [$gb] 20 May   [url /blog/mundus-first-shot-at-gamedev Mundus: My first shot at game development] -: [`Deep dive`] | [`Gamedev`] | [`2D`] [`Sandbox`] [`Crafting`] [`Building`] [`Fighting`] [`GtkSharp 2.0`] [`C#`] +; {gb} 20 May   {url Mundus: My first shot at game development;/blog/mundus-first-shot-at-gamedev} +: {` Deep dive} | {` Gamedev} | {` 2D} {` Sandbox} {` Crafting} {` Building} {` Fighting} {` GtkSharp 2.0} {` C#} diff --git a/src/blog/2.6-years-of-web-design/index.du b/src/blog/2.6-years-of-web-design/index.du index 2678065..5b99ea7 100644 --- a/src/blog/2.6-years-of-web-design/index.du +++ b/src/blog/2.6-years-of-web-design/index.du @@ -1,23 +1,23 @@ -# 2.6 years of web design +'def title 2.6 years of web design +'def desc Outlining my experience with Web design while making this website -'define expected-reading 13 min -'define created 23 December 2022 -'define edited 23 December 2022 -[$pagenav] +# {title} + +{pagenav 13 min;23 December 2022;23 December 2022} :contents .numbered -1. [url #v1.0 v1.0] -2. [url #v2.0 v2.0] -3. [url #v2.1 v2.1] -4. [url #v2.2 v2.2] -5. [url #v3.0 v3.0] -6. [url #v3.1 v3.1] -7. [url #now now] -8. [url #appendix Appendix] +1. {uhref v1.0} +2. {uhref v2.0} +3. {uhref v2.1} +4. {uhref v2.2} +5. {uhref v3.0} +6. {uhref v3.1} +7. {uhref now} +8. {uhref Appendix} -On 17 May 2020 I [url https://gitlab.com/Syndamia/syndamiadotcom/-/commit/f2d3991cf3381d4d794b3faa2890439bb70af729 pushed the very first version of this website], which went live 3 days later. +On 17 May 2020 I {url pushed the very first version of this website;https://gitlab.com/Syndamia/syndamiadotcom/-/commit/f2d3991cf3381d4d794b3faa2890439bb70af729}, which went live 3 days later. The whole idea of making my own website came on a whim: I had recently turned 18 and spent some of my money on getting a small VPS (which was primarily used for cloud storage). There was no plan and I had never done anything like it, so a shitty website was to be expected. @@ -25,66 +25,66 @@ There was no plan and I had never done anything like it, so a shitty website was Looking back at it now, that first design's color palette was comprised of three dull grey colors, which didn't contrast very much on the white font: -[image ./img/v1.0-index.png] +{img ./img/v1.0-index.png} For code blocks, the background was a dark-blue color with a blue-ish font color, absolutely horrible for readability: -[image ./img/v1.0-code\ block.png] +{img block.png;./img/v1.0-code block.png} -Although I wasn't the one to invent that color scheme, it was [*inspired*] from [url https://github.com/linuxmint/xed xed]'s Oblivion theme. +Although I wasn't the one to invent that color scheme, it was {i inspired} from {url xed;https://github.com/linuxmint/xed}'s Oblivion theme. It wasn't all completely bonkers, there were some not-so-ugly design decisions. Navigation was done with tabs, which look decently nice on a desktop. On blog posts, and especially on those with multiple pages, you would have the title on the left, and a close button on the right, "mimicking" a browser window. -[image ./img/v1.0-tutorial-page.png] +{img ./img/v1.0-tutorial-page.png} As you can imagine, this was a scalability nightmare. If the title was too long or there were too many pages, stuff would overlap in an unreadable manner: -[image ./img/v1.0-index-smallscreen.png] +{img ./img/v1.0-index-smallscreen.png} -You know, if this website was published on [url https://neocities.org/ neocities], my desktop-oriented unscaleable layout might've been seen as cool and novel... +You know, if this website was published on {url neocities;https://neocities.org/}, my desktop-oriented unscaleable layout might've been seen as cool and novel... Thankfully (or maybe unfortunately), I didn't go down that road. Finally, tables, like those used in the "Projects" listing, were the absolute dumbest: -[image ./img/v1.0-projects.png] +{img ./img/v1.0-projects.png} As you can see, the design was overwhelmingly ugly, with many boneheaded decisions behind it. -Did I mention every post had to be written entirely by hand in HTML, except for the headers and footers, which were [url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/v1.0/website/js [=generated client-side with JavaScript=]]? +Did I mention every post had to be written entirely by hand in HTML, except for the headers and footers, which were {url {b generated client-side with JavaScript};https://gitlab.com/Syndamia/syndamiadotcom/-/tree/v1.0/website/js}? -Nonetheless, it served as a good starting point and stepping stone, for my web development [*adventures*]. +Nonetheless, it served as a good starting point and stepping stone, for my web development {i adventures}. ### v2.0 -Less than two months later, on 21 July, [url https://gitlab.com/Syndamia/syndamiadotcom/-/commit/64fbbd514733e42dd047bf65c511563a84ebd629 I did a complete redesign]. -To more easily separate the two, I decided to use [url https://gitlab.com/Syndamia/syndamiadotcom/-/releases releases], where a major version would signify a major styling change, and minor versions would be reserved for other important changes, like how the whole website is generated. +Less than two months later, on 21 July, {url I did a complete redesign;https://gitlab.com/Syndamia/syndamiadotcom/-/commit/64fbbd514733e42dd047bf65c511563a84ebd629}. +To more easily separate the two, I decided to use {url releases;https://gitlab.com/Syndamia/syndamiadotcom/-/releases}, where a major version would signify a major styling change, and minor versions would be reserved for other important changes, like how the whole website is generated. Speaking of generated, I actually went away with the old "system" of manual labour, and turned to technology for aid. -It's all thanks to [url https://www.youtube.com/@WolfgangsChannel Wolfgang's Channel]'s tutorial on making a [url https://www.youtube.com/watch?v=N_ttw2Dihn8 "Fast & Minimal Blog"]. -There, he showed how to setup and use [url https://www.romanzolotarev.com/ssg.html ssg] with [url https://kristaps.bsd.lv/lowdown/ lowdown], a combination that still powers this website. +It's all thanks to {url Wolfgang's Channel;https://www.youtube.com/@WolfgangsChannel}'s tutorial on making a {url "Fast & Minimal Blog";https://www.youtube.com/watch?v=N_ttw2Dihn8}. +There, he showed how to setup and use {url ssg;https://www.romanzolotarev.com/ssg.html} with {url lowdown;https://kristaps.bsd.lv/lowdown/}, a combination that still powers this website. Turning to the actual website itself, now it looked quite pleasant, in the day at least: -[image ./img/v2.0-index.png] +{img ./img/v2.0-index.png} Rather than using multiple colors for different elements, I went for a monochrome "printed on a piece of paper" look. One might call that regression, but I'd like to think of it as minimalism. Looking at those same code blocks and tables: -[image ./img/v2.0-code\ block.png] -[image ./img/v2.0-resume.png] +{img block.png;./img/v2.0-code block.png} +{img ./img/v2.0-resume.png} Ay, that's pretty clean! But it should remind you of something. Before, the only time I would work with Markdown files was in GitHub READMEs. So, with that association in place, replicating GitHub's style was a natural choice. -Though that last part wasn't done by me, but by [url https://github.com/sindresorhus/github-markdown-css sindresorhus]. +Though that last part wasn't done by me, but by {url sindresorhus;https://github.com/sindresorhus/github-markdown-css}. As for the overall design, there isn't too much to say. Yes, the original tab idea kinda lived on, as those buttons at the top, and yes, it still wasn't scaleable, but now it didn't even try to be. -[image ./img/v2.0-index-smartphone.png] +{img ./img/v2.0-index-smartphone.png} Overall, this made it more "commercialized", soulless (assuming v1.0 had one) and plain old boring. It seems I hit the other end of the spectrum, from ugly but interesting to pleasing but dull. @@ -93,7 +93,7 @@ It seems I hit the other end of the spectrum, from ugly but interesting to pleas Over the following half a year, I wrote a couple more articles, but most importantly the styling was finally made scaleable: -[image ./img/v2.1-index-smartphone.png] +{img ./img/v2.1-index-smartphone.png} Ignoring my big fat head taking up 70% of the screen, the index page properly fit on a mobile screen! The navigation tabs weren't very symmetrically organized, but at least nothing was overlapping and overflowing over the screen. @@ -101,9 +101,9 @@ The navigation tabs weren't very symmetrically organized, but at least nothing w ### v2.2 Still, by that time I started to get criminally bored by that black and white appearance. -As an avid fan of not hurting my eyes and [url https://github.com/morhetz/gruvbox gruvbox], a color overhaul needed to be done. +As an avid fan of not hurting my eyes and {url gruvbox;https://github.com/morhetz/gruvbox}, a color overhaul needed to be done. -But I'm getting ahead of myself, we need to sidetrack to a project I was working on at the time of [url https://gitlab.com/Syndamia/syndamiadotcom/-/releases/v2.1 2.1's release]: [url https://github.com/Team-Kaleidoscope DevHive]. +But I'm getting ahead of myself, we need to sidetrack to a project I was working on at the time of {url 2.1's release;https://gitlab.com/Syndamia/syndamiadotcom/-/releases/v2.1}: {url DevHive;https://github.com/Team-Kaleidoscope}. Sparing you the details, it was a social media app, with detached front-end and back-end. Me and two other guys worked on it for about 5 months, from December 2020 to April 2021, as a course project. @@ -111,23 +111,23 @@ Up until this point, the course I'm talking about almost didn't touch front-end As you might imagine, I was the only one with any idea of web design, meaning I was the "lead designer". This time, however, I wanted to do it a bit more properly, so I made mockups of the final design. -The first was done in [url https://pencil.evolus.vn/ Pencil], a somewhat limited application for designing layouts: +The first was done in {url Pencil;https://pencil.evolus.vn/}, a somewhat limited application for designing layouts: -[image ./img/devhive-index-concept1.png] +{img ./img/devhive-index-concept1.png} Pretty quickly I turned to actual HTML and CSS, because I needed a more realistic feel of how the actual elements would be laid out. Another idea that came up to mind was using a palette: a certain selection of colors for everything. After talking with the others, I found a decent selection of blue and orange sunset-y colours and got to work. The end result was this beauty: -[image ./img/devhive-index-concept2.png] +{img ./img/devhive-index-concept2.png} Although it looked pretty nice, we decided against it, since the focus was on the back-end, the front-end needed to be simpler. There are also some problems with the color scheme, but more on that later. Then I did what I had already done before: simplified the devil out of it. -[image ./img/devhive-index-concept3.png] +{img ./img/devhive-index-concept3.png} Now this looks way too cartoon-ish, you could make it with a steady hand and a ruler on a sheet of paper. However it made the others happy, so we went along with it. @@ -135,7 +135,7 @@ However it made the others happy, so we went along with it. The overall flatness and emptiness, and general boringness bugged me for a while. Some time later, after messing around for a couple hours, I came up with this: -[image ./img/devhive-index-concept4.png] +{img ./img/devhive-index-concept4.png} A much more modern-looking and feeling concept, completely different from it's comic roots. Unfortunately, we didn't go with it, later we found out it had some issues with certain elements, and the previous idea was already implemented. @@ -156,14 +156,14 @@ I needed something in between the second and third concepts, something which was Coincidentally, at the same time, I was working on a dark colored implementation of my website, using the gruvbox color. Putting two and two together, I came up with this thing; -[image ./img/devhive-index-concept5.png] +{img ./img/devhive-index-concept5.png} Now this looked really nice, somewhat professional even, was very simple and didn't hurt your eyes. Suffice to say, everyone loved it, and we redid everything to look like it. As for my own website, this is what it looked like by the time I made release 2.2: -[image ./img/v2.2-index.png] +{img ./img/v2.2-index.png} There is no point in showing code blocks or other elements, since it was just a change of colors. But boy oh boy how long it took to make such a simple change. @@ -171,31 +171,31 @@ That's where everything stayed for a while. ### v3.0 -Of course, there were changes, I wrote more posts, tweaked some of the styling, hell, I even started adding ([=non required=]) JavaScript functionality. +Of course, there were changes, I wrote more posts, tweaked some of the styling, hell, I even started adding ({b non required}) JavaScript functionality. Still, I was yearning for something better. Scalability was continuing to be an issue, outside of the annoying misalignment, navigation buttons in the header or footer would disappear into the void if it's contents were too long: -[image ./img/v2.2-index-footer-smallwidth.png] +{img ./img/v2.2-index-footer-smallwidth.png} This example is unrealistic, but there were times where I wanted to put something longer in the footer button, and this issue arose. Also the whole button idea wasn't very expandable, what if I wanted to have not 6 but more than 20 buttons in the header up top? -[image ./img/v2.2-index-full-header.png] +{img ./img/v2.2-index-full-header.png} And don't get me started on how comically bad this is on mobile: -[image ./img/v2.2-index-full-header-smartphone.png] +{img ./img/v2.2-index-full-header-smartphone.png} Something needed to change yet again, and something did. -A year and a third later, on [url https://gitlab.com/Syndamia/syndamiadotcom/-/commit/bde3ebdea6310c891b7e38185906d1a1e03977e4 3 July 2022], I went away with the tabbed-like button layout, and opted for a dead simple sidebar: +A year and a third later, on {url 3 July 2022;https://gitlab.com/Syndamia/syndamiadotcom/-/commit/bde3ebdea6310c891b7e38185906d1a1e03977e4}, I went away with the tabbed-like button layout, and opted for a dead simple sidebar: -[image ./img/v3.0-index-initial.png] +{img ./img/v3.0-index-initial.png} About that useless right border and the weird choice for only left and bottom borders on the sidebar: I wanted some separation for the sidebar and I wanted more "fun" in the overall design. -Most of the inspiration for those came from [url https://jvns.ca/ Julia Evan's blog], where there is a big orange ribbon running on the sides and across the page. +Most of the inspiration for those came from {url Julia Evan's blog;https://jvns.ca/}, where there is a big orange ribbon running on the sides and across the page. Over time I did more tweaking on the colors and layout of everything, so by the time I created release 3.0, it looked like this: -[image ./img/v3.0-index.png] +{img ./img/v3.0-index.png} A good question you might be asking yourself is "How is this supposed to be scaleable?" The answer is that it kinda of wasn't, at the time. @@ -210,41 +210,41 @@ The whole point of DevHive's final redesign was to use colors for better separat But that completely when over my head when I initially did that 3.0 redesign. Fortunately, it later came back. -It might've been four and a half months later, but I finally [url https://gitlab.com/Syndamia/syndamiadotcom/-/commit/55afc85bf7da9c0ed5e8859027080aebfa55ec50 added color separation between the background and article and navbar]. +It might've been four and a half months later, but I finally {url added color separation between the background and article and navbar;https://gitlab.com/Syndamia/syndamiadotcom/-/commit/55afc85bf7da9c0ed5e8859027080aebfa55ec50}. -[image ./img/v3.1-index.png] +{img ./img/v3.1-index.png} And about that unfixed scalability? Well, I fixed it, now on a mobile devices, the navbar stays up top, but is shrunk and can be expanded with a button: -[image ./img/v3.1-index-smartphone.png] +{img ./img/v3.1-index-smartphone.png} Another notable styling change was in tables. -I pretty much stole the design from [url https://www.lemmi.no/ LEMMiNO]'s website: +I pretty much stole the design from {url LEMMiNO;https://www.lemmi.no/}'s website: -[image ./img/v3.1-table.png] +{img ./img/v3.1-table.png} Finally, probably the most important change of it all, before I used some bash scripts to automate certain actions in the result HTML files, like generating the description automatically. -Now, this was all done with [url https://www.gnu.org/software/gawk/manual/gawk.html awk], a programming language specifically designed for making text changes to files. -awk's flexibility permitted me to create stuff like [url /talks/demo.html the slide presentation system] without too much trouble. +Now, this was all done with {url awk;https://www.gnu.org/software/gawk/manual/gawk.html}, a programming language specifically designed for making text changes to files. +awk's flexibility permitted me to create stuff like {url the slide presentation system;/talks/demo.html} without too much trouble. ### now As of the writing of this post, not too much has changed since the last release. -There have been new posts, like this one and [url /blog/taming-the-fun-too Taming the Fun-too] but the overall design is here to stay, at least until I learn more about creating web styles and/or get bored of the current one. +There have been new posts, like this one and {url Taming the Fun-too;/blog/taming-the-fun-too} but the overall design is here to stay, at least until I learn more about creating web styles and/or get bored of the current one. Happy holidays everyone! ### Appendix This post has been in the works since 01 August 2020. -At the time it was just called [url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/501942b638c34582de2f73dc31423c9322eb81fd/src/blog/syndamiadotcom "syndamiadotcom"] and was listed under the now defunct "Projects" section. -It was actually still available on the website, under [`/blog/syndamiadotcom/`], but I didn't list it in the blogs page. +At the time it was just called {url "syndamiadotcom";https://gitlab.com/Syndamia/syndamiadotcom/-/tree/501942b638c34582de2f73dc31423c9322eb81fd/src/blog/syndamiadotcom} and was listed under the now defunct "Projects" section. +It was actually still available on the website, under {` /blog/syndamiadotcom/}, but I didn't list it in the blogs page. That first iteration looked at the layout in a much stiffer and uninteresting way. I was talking about what exact color codes I used for crying out loud. But it was left as-is because I struggled on how to approach it. -I'm still not entirely happy with this version either, [url #v2.2 v2.2] was probably the most interesting and valuable part of the whole thing and the rest was fairly meh. +I'm still not entirely happy with this version either, {url v2.2;#v2.2} was probably the most interesting and valuable part of the whole thing and the rest was fairly meh. Oh well, maybe I'll rewrite it again one day. However, for the time being, I believe it's better for me to expect a bit less and just put stuff out there. @@ -252,4 +252,4 @@ As you saw, learning the little I know about web design was a slow trial and err The same will happen with making blog posts and other articles. I'm not a writer and I'm not interested enough to learn things properly. -[*P.S.*] Expect this post to be updated in the future, when I make new releases! +{i P.S.} Expect this post to be updated in the future, when I make new releases! diff --git a/src/blog/bash-is-weird/index.du b/src/blog/bash-is-weird/index.du index 3fbc2cd..8fe78cf 100644 --- a/src/blog/bash-is-weird/index.du +++ b/src/blog/bash-is-weird/index.du @@ -1,30 +1,31 @@ -# BASH is weird +'def title BASH is weird +'def desc Interesting quirks of BASH -'define expected-reading 4 min -'define created 01 May 2023 -'define edited 02 May 2023 -[$pagenav] +# {title} -'footnote parameter-expansion Of course this is just one of the many ways to reference and work with variables. -For very basic stuff, BASH is decently simple and intuitive, for example variables are set with the format [`name=value`] and they're referenced with [`\$name`] [$parameter-expansion]. -However, that changes once you start diving deeper (as I had to do for my [url /talks/linuxgraphy-by-strabo Linuxgraphy by Strabo] presentation). +{pagenav 4 min;01 May 2023;02 May 2023} + +For very basic stuff, BASH is decently simple and intuitive, for example variables are set with the format {` name=value} and they're referenced with {` $name} {fn Of course this is just one of the many ways to reference and work with variables.}. +However, that changes once you start diving deeper (as I had to do for my {url Linuxgraphy by Strabo;/talks/linuxgraphy-by-strabo} presentation). An example which illustrates my point would be: ```bash +'emplace myvar=($(echo A B C)) myvar=1234 -echo $((myvar += 46)) ${myvar[\${myvar:0:1}]} +echo $((myvar += 46)) ${myvar[${myvar:0:1}]} +'endemplace It has 3 things which really bothered me: :ordered -1. The output of [`\$(echo A B C)`] is replaced "literally", and then the whole expression is evaluated. - Meaning, [`myvar=($(echo A B C))`] turns into [`myvar=(A B C)`], which creates an array with those three letters. +1. The output of {` $(echo A B C)} is replaced "literally", and then the whole expression is evaluated. + Meaning, {` myvar=($(echo A B C))} turns into {` myvar=(A B C)}, which creates an array with those three letters. .p - I thought the "returned" value of [`\$(echo A B C)`] would be the whole string "A B C", so the array would have one element, that string. - However, [`\$()`] isn't really a function, which takes arguments, "creates" commands and returns their output. - It's [url https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html Command [=Substitution=]], the text gets executed and it's output [=replaces=] the [`\$(...)`] itself (slightly reminiscent of [url https://lispcookbook.github.io/cl-cookbook/macros.html LISP macros]). + I thought the "returned" value of {` $(echo A B C)} would be the whole string "A B C", so the array would have one element, that string. + However, {` $()} isn't really a function, which takes arguments, "creates" commands and returns their output. + It's {url Command {b Substitution};https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html}, the text gets executed and it's output {b replaces} the {` $(...)} itself (slightly reminiscent of {url LISP macros;https://lispcookbook.github.io/cl-cookbook/macros.html}). .p Side note: obviously, the original expected behaviour can happen if we use some quotes: @@ -32,34 +33,36 @@ It has 3 things which really bothered me: ```bash myvar=("$(echo A B C)") -2. On the second line, [`myvar`] [*becomes*] an integer and then we do an arithmetic operation on it, nothing wrong here. - [`\${parameter:offset:length}`] returns the substring from [`parameter`] from [`offset`] with size [`length`], but we're giving it a "number", so it should either throw some sort of error or return something default, like 0. +2. On the second line, {` myvar} {i becomes} an integer and then we do an arithmetic operation on it, nothing wrong here. + {` $\{parameter:offset:length\}} returns the substring from {` parameter} from {` offset} with size {` length}, but we're giving it a "number", so it should either throw some sort of error or return something default, like 0. However it correctly returns the number 1 (and no, that isn't a default, the number is correctly parsed as a string). .p This shows that numbers are actually strings too, and numerical operations are just weird string operations. - Contrary to any dynamically-typed language, it's not like the type of a variable is inferred from it's value, [url https://tldp.org/LDP/abs/html/untyped.html there isn't a type at all]! - Which makes everything even more weird, considering you [*can*] [url https://www.gnu.org/software/bash/manual/bash.html#index-declare create variables with a specific type]. + Contrary to any dynamically-typed language, it's not like the type of a variable is inferred from it's value, {url there isn't a type at all;https://tldp.org/LDP/abs/html/untyped.html}! + Which makes everything even more weird, considering you {i can} {url create variables with a specific type;https://www.gnu.org/software/bash/manual/bash.html#index-declare}. -3. Finally, the arguably biggest weirdness of it all, is [`\${myvar[1]}`]. - It doesn't matter how it is represented, at first [`myvar`] was the list of values A, B, C and now it's a number, this should return nothing. - Per contra, the value [`B`] is returned instead! +3. Finally, the arguably biggest weirdness of it all, is {` $\{myvar[1]\}}. + It doesn't matter how it is represented, at first {` myvar} was the list of values A, B, C and now it's a number, this should return nothing. + Per contra, the value {` B} is returned instead! .p - Via trial and error, we find that our number will be returned when the index is 0, and with index 2 we get [`C`]. + Via trial and error, we find that our number will be returned when the index is 0, and with index 2 we get {` C}. So all variables are arrays, and by default for integer and string operations, the first value is used? .p - This is strange, but it cannot be the full picture, because [url https://linux.die.net/Bash-Beginners-Guide/sect_10_01.html names have attributes], alongside it's type, a variable (name) can be read-only, but also have the "trace" flag, which only works with functions. + This is strange, but it cannot be the full picture, because {url names have attributes;https://linux.die.net/Bash-Beginners-Guide/sect_10_01.html}, alongside it's type, a variable (name) can be read-only, but also have the "trace" flag, which only works with functions. So, variables and functions are the same "object"? Unfortunately, I couldn't find any definitive information on the topic, so this train of thought will have to be left unresolved. -And this is just one example, more bizarreness can be found with [url https://www.vidarholen.net/contents/blog/?p=25 square brackets] and [url https://mywiki.wooledge.org/BashPitfalls most ok looking code]. -[url https://chrisdone.com/posts/shell-conduit/ Some people] even go as far to say: +And this is just one example, more bizarreness can be found with {url square brackets;https://www.vidarholen.net/contents/blog/?p=25} and {url most ok looking code;https://mywiki.wooledge.org/BashPitfalls}. +{url Some people;https://chrisdone.com/posts/shell-conduit/} even go as far to say: .quote Its syntax is insane, incredibly error prone, its defaults are awful, and it’s not a real big person programming language. -But I believe that is a step too far, [url http://www.binaryphile.com/bash/2018/07/26/approach-bash-like-a-developer-part-1-intro.html there are benefits, especially when approaching it seriously]. +But I believe that is a step too far, {url there are benefits, especially when approaching it seriously;http://www.binaryphile.com/bash/2018/07/26/approach-bash-like-a-developer-part-1-intro.html}. Every language has mind-numbing oddities, some get the out of the way from the start (like BASH), and others much later. + +{footnotes} diff --git a/src/blog/connect-to-mysql-in-dotnet-ef/index.du b/src/blog/connect-to-mysql-in-dotnet-ef/index.du index e745f16..d1c48ab 100644 --- a/src/blog/connect-to-mysql-in-dotnet-ef/index.du +++ b/src/blog/connect-to-mysql-in-dotnet-ef/index.du @@ -1,66 +1,68 @@ -# Connect to MySql in .NET and Entity Framework +'def title Connect to MySql in .NET and Entity Framework +'def desc Connecting a .NET application to a MySql database (with Entity Framework) can be tricky. Here is what works for me. -'define expected-reading 3 min -'define created 21 May 2020 -'define edited 19 June 2021 -[$pagenav] +# {title} + +{pagenav 3 min;21 May 2020;19 June 2021} :contents .numbered -1. [url #nuget-packages NuGet packages] -2. [url #connection-string Connection string] -3. [url #connecting Connecting] +1. {uhref NuGet packages} +2. {uhref Connection string} +3. {uhref Connecting} .numbered - 1. [url #asp.net-startup ASP.NET Startup] - 2. [url #dbcontext-child-class DBContext child class] + 1. {uhref ASP.NET Startup} + 2. {uhref DBContext child class} -I have found that connecting a [`.NET`] application to a [`MySql`] database (with Entity Framework) can be tricky. Here is what works for me. +I have found that connecting a {` .NET} application to a {` MySql} database (with Entity Framework) can be tricky. Here is what works for me. -Also, [url https://www.nuget.org/packages/MySql.Data.EntityFrameworkCore/ MySql.Data.EntityFrameworkCore] has been [=depricated=] since [*October 2020*]. If you need setup instructions with it, read [url https://gitlab.com/Syndamia/syndamiadotcom/-/blob/0510e29526c6d7681587fff4c98a339e8c69e9b5/src/blog/connect-to-mysql-in-csharp-ef/article.md this]. +Also, {url MySql.Data.EntityFrameworkCore;https://www.nuget.org/packages/MySql.Data.EntityFrameworkCore/} has been {b depricated} since {i October 2020}. If you need setup instructions with it, read {url this;https://gitlab.com/Syndamia/syndamiadotcom/-/blob/0510e29526c6d7681587fff4c98a339e8c69e9b5/src/blog/connect-to-mysql-in-csharp-ef/article.md}. ## NuGet packages -You'll need to install [url https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql/ Pomelo.EntityFrameworkCore.MySql]. It provides the stuff necessary for connecting and using a [`MySql`] database. +You'll need to install {url Pomelo.EntityFrameworkCore.MySql;https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql/}. It provides the stuff necessary for connecting and using a {` MySql} database. ## Connection string -There are [url https://www.connectionstrings.com/mysql/ a lot] of ways to setup the connection string but I've found that this one works the best: +There are {url a lot;https://www.connectionstrings.com/mysql/} of ways to setup the connection string but I've found that this one works the best: ``` "server=localhost; port=YOUR-PORT; user id=YOUR-USER-ID; password=YOUR-PASSWORD; database=NAME-OF-DATABASE; SslMode=none" -If you are using [`MySQL Workbench`] and you don't know your port and id, you can look at the server information from the [`MySQL Connections`] page. +If you are using {` MySQL Workbench} and you don't know your port and id, you can look at the server information from the {` MySQL Connections} page. -[image ./img/connections.png MyServer root 127.0.0.1:3306] In this example, the user id is _root_ and the port is _3306_. +{img MyServer root 127.0.0.1:3306;./img/connections.png} In this example, the user id is _root_ and the port is _3306_. ## Connecting -To connect, you'll need to call the [`UseMySql`] method, either in [url #asp.net-startup ASP.NET Startup] or in a [url #dbcontext-child-class DBContext child class]. +To connect, you'll need to call the {` UseMySql} method, either in {url ASP.NET Startup;#asp.net-startup} or in a {url DBContext child class;#dbcontext-child-class}. -The method requires at least two arguments: connection string and [`MySql`] server version. The latter you can find, by going to the [`Help/About Workbench`] window inside [`MySQL Workbench`]. +The method requires at least two arguments: connection string and {` MySql} server version. The latter you can find, by going to the {` Help/About Workbench} window inside {` MySQL Workbench}. -[image ./img/about-workbench.png] -[image ./img/workbench-version.png] +{img ./img/about-workbench.png} +{img ./img/workbench-version.png} -For the server version argument, create a new object of type [`MySqlServerVersion`] and give it's constructor a new object of type [`Version`], to which you give the version numbers. The result should look something like this: +For the server version argument, create a new object of type {` MySqlServerVersion} and give it's constructor a new object of type {` Version}, to which you give the version numbers. The result should look something like this: -```c# +```csharp +'emplace .UseMySql(CONNECTION_STRING, new MySqlServerVersion(new System.Version(8, 0, 21))) +'endemplace -Where [`CONNECTION_STRING`] is a (constant) variable that contains your connection string, and 8, 0, 21 are the version numbers. +Where {` CONNECTION_STRING} is a (constant) variable that contains your connection string, and 8, 0, 21 are the version numbers. ### ASP.NET Startup -For [`ASP.NET`] applications, the connection must be put inside the [`ConfigureServices`] method of the [`Startup.cs`] file. If you already have a [`.UseSQL`] method call in there, just replace it with your [`.UseMySql`] method and arguments. +For {` ASP.NET} applications, the connection must be put inside the {` ConfigureServices} method of the {` Startup.cs} file. If you already have a {` .UseSQL} method call in there, just replace it with your {` .UseMySql} method and arguments. The result should look something along the lines of: -```c# +```csharp // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - ... + \... services.AddDbContext<AppDbContext>(opt => { opt.UseMySql(...); @@ -69,9 +71,9 @@ public void ConfigureServices(IServiceCollection services) ### DBContext child class -Another way to connect is via a [`DBContext`] child class (so, inside your own DB context). Just, override the [`OnConfiguring`] method and call the [`.UseMySql`] method from the [`optionsBuilder`] parameter. +Another way to connect is via a {` DBContext} child class (so, inside your own DB context). Just, override the {` OnConfiguring} method and call the {` .UseMySql} method from the {` optionsBuilder} parameter. -```c# +```csharp protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseMySql(...); diff --git a/src/blog/disable-sticky-keys-popup/index.du b/src/blog/disable-sticky-keys-popup/index.du index a51a7a1..ccacd9e 100644 --- a/src/blog/disable-sticky-keys-popup/index.du +++ b/src/blog/disable-sticky-keys-popup/index.du @@ -1,31 +1,31 @@ -# How to disable Sticky Keys prompt +'def title How to disable Sticky Keys prompt +'def desc Quick and easy instructions on disabling the Windows prompt 'Do you want to turn on Sticky Keys?' -'define expected-reading 1 min -'define created 01 November 2021 -'define edited 01 November 2021 -[$pagenav] +# {title} -We've all been there: you're playing a game and after pressing [`Shift`] multiple times, you get a popup about "Sticky Keys", similar to this one: +{pagenav 1 min;01 November 2021;01 November 2021} -[image ./img/windows-sticky-keys-prompt.png] +We've all been there: you're playing a game and after pressing {` Shift} multiple times, you get a popup about "Sticky Keys", similar to this one: + +{img ./img/windows-sticky-keys-prompt.png} This is how to stop the popup from showing up ever again: :ordered -1. Press [=Windows key + R=], type in [`control access.cpl`], and then press [=OK=] +1. Press {b Windows key + R}, type in {` control access.cpl}, and then press {b OK} - [image ./img/windows-run-control-access.png] + {img ./img/windows-run-control-access.png} -2. Inside the opened up window, press [=Make the keyboard easier to use=] +2. Inside the opened up window, press {b Make the keyboard easier to use} - [image ./img/windows-make-keyboard-highlighted.png] + {img ./img/windows-make-keyboard-highlighted.png} -3. After that, press [=Set up Sticky Keys=] +3. After that, press {b Set up Sticky Keys} - [image ./img/windows-sticky-keys-highlighted.png] + {img ./img/windows-sticky-keys-highlighted.png} -4. Uncheck the [=Turn on Sticky Keys when SHIFT is pressed five times=] +4. Uncheck the {b Turn on Sticky Keys when SHIFT is pressed five times} - [image ./img/windows-sticky-keys-disable.png] + {img ./img/windows-sticky-keys-disable.png} -5. Finally, press [=OK=] and close the window +5. Finally, press {b OK} and close the window diff --git a/src/blog/encrypted-email/index.du b/src/blog/encrypted-email/index.du index 4ed85d7..5c32917 100644 --- a/src/blog/encrypted-email/index.du +++ b/src/blog/encrypted-email/index.du @@ -1,69 +1,69 @@ -# Encrypted email +'def title Encrypted email +'def desc Outlining and explanation of encrypted email systems -'define expected-reading 10 min -'define created 10 September 2022 -'define edited 16 September 2022 -[$pagenav] +# {title} + +{pagenav 10 min;10 September 2022;16 September 2022} :contents :numbered -1. [url #encryption-and-signature Encryption and signature] -2. [url #openpgp OpenPGP] +1. {uhref Encryption and signature} +2. {uhref OpenPGP} .numbered - 1. [url #pgpinline PGP/Inline] - 2. [url #pgpmime PGP/MIME] + 1. {uhref PGP/Inline} + 2. {uhref PGP/MIME} -3. [url #smime S/MIME] -4. [url #reop reop] -5. [url #post-email-systems Post-email systems] -6. [url #centralized-non-email-systems Centralized non-email systems] +3. {uhref S/MIME} +4. {uhref reop} +5. {uhref Post-email systems} +6. {uhref Centralized non-email systems} .numbered - 1. [url #protonmail Protonmail] - 2. [url #tutanota Tutanota] + 1. {uhref Protonmail} + 2. {uhref Tutanota} -7. [url #conclusion Conclusion] +7. {uhref Conclusion} -When you try and look around for articles, regarding encrypted emails, all you'll find is people complaining about it's difficulties and shortcomings. But, no one actually explains what to do if you, nevertheless, want to encrypt your emails! At best most articles will just [url https://www.virtru.com/blog/arent-people-using-email-encryption shove some product up your face]. +When you try and look around for articles, regarding encrypted emails, all you'll find is people complaining about it's difficulties and shortcomings. But, no one actually explains what to do if you, nevertheless, want to encrypt your emails! At best most articles will just {url shove some product up your face;https://www.virtru.com/blog/arent-people-using-email-encryption}. -That's why, after a fairly lengthy research process, I've decided to do just that. These are the more common ways to encrypt your email with their strengths and weaknesses. I also wrote a (somewhat rough) [url /blog/how-to-encrypt-email tutorial on how to setup] [url #openpgp OpenPGP] or [url #smime S/MIME] in practice. +That's why, after a fairly lengthy research process, I've decided to do just that. These are the more common ways to encrypt your email with their strengths and weaknesses. I also wrote a (somewhat rough) {url tutorial on how to setup;/blog/how-to-encrypt-email} {url OpenPGP;#openpgp} or {url S/MIME;#smime} in practice. -[*Note:*] What I'm referring to is end-to-end encryption, where you send an encrypted email, and the recipient decrypts it. Encryption between you and a mail server is practically a given and is setup by the mail server administrator. +{i Note:} What I'm referring to is end-to-end encryption, where you send an encrypted email, and the recipient decrypts it. Encryption between you and a mail server is practically a given and is setup by the mail server administrator. ## Encryption and signature -Unless stated otherwise, all of the listed encryption (and signature) schemes work by utilizing [url https://en.wikipedia.org/wiki/Public-key_cryptography public-key cryptography]. +Unless stated otherwise, all of the listed encryption (and signature) schemes work by utilizing {url public-key cryptography;https://en.wikipedia.org/wiki/Public-key_cryptography}. -In brief, if you are sending an encrypted email, the [=recipient=] needs to have generated a public and private key pair. Then you need to have acquired [=their public key=]. Finally, if you want to send them an encrypted email: +In brief, if you are sending an encrypted email, the {b recipient} needs to have generated a public and private key pair. Then you need to have acquired {b their public key}. Finally, if you want to send them an encrypted email: .numbered -1. You encrypt [=your=] email with [=their public key=] -2. The recipient decrypts [=your=] message with [=their private key=] +1. You encrypt {b your} email with {b their public key} +2. The recipient decrypts {b your} message with {b their private key} -And if someone wants to send [=you=] an encrypted email, [=you=] need to generate a public and private key pair, share [=your public key=] with them, and when you receive the message, decrypt it with [=your private key=]. +And if someone wants to send {b you} an encrypted email, {b you} need to generate a public and private key pair, share {b your public key} with them, and when you receive the message, decrypt it with {b your private key}. -Every email you send can be [url https://en.wikipedia.org/wiki/Digital_signature digitally signed] (not to be confused with [url https://en.wikipedia.org/wiki/Digital_signature electronic signatures]), meaning the message is (cryptographically) "signed", and with this signature, the recipient can check if the message was changed during transit. Digital signatures also use public-key cryptography, but the other way around: +Every email you send can be {url digitally signed;https://en.wikipedia.org/wiki/Digital_signature} (not to be confused with {url electronic signatures;https://en.wikipedia.org/wiki/Digital_signature}), meaning the message is (cryptographically) "signed", and with this signature, the recipient can check if the message was changed during transit. Digital signatures also use public-key cryptography, but the other way around: .numbered -1. You sign [=your=] email with [=your private key=] -2. Then the recipient verifies [=your=] message with [=your public key=]. +1. You sign {b your} email with {b your private key} +2. Then the recipient verifies {b your} message with {b your public key}. -This might sound a bit complicated, but all you need to worry about is you and the recipient generating these public-private key pairs, exchanging public keys, and your email client should handle the rest. And if you use a tool like [url https://www.pep.security/en/ pEp], the creation and exchange of keys can be easily automated. +This might sound a bit complicated, but all you need to worry about is you and the recipient generating these public-private key pairs, exchanging public keys, and your email client should handle the rest. And if you use a tool like {url pEp;https://www.pep.security/en/}, the creation and exchange of keys can be easily automated. ## OpenPGP -By far, the most popular way to encrypt your emails is with [url https://en.wikipedia.org/wiki/Pretty_Good_Privacy OpenPGP]. PGP is the original program which implemented the encryption scheme, while OpenPGP is the standard/encryption scheme, which was created from PGP (so when I say OpenPGP, I mean a program that implements OpenPGP). +By far, the most popular way to encrypt your emails is with {url OpenPGP;https://en.wikipedia.org/wiki/Pretty_Good_Privacy}. PGP is the original program which implemented the encryption scheme, while OpenPGP is the standard/encryption scheme, which was created from PGP (so when I say OpenPGP, I mean a program that implements OpenPGP). -By design, it relies on a [url https://en.wikipedia.org/wiki/Web_of_trust web of trust], the idea being, different people sign each others public keys (sometimes at [url https://en.wikipedia.org/wiki/Key_signing_party key signing parties]), and you know that a specific key corresponds to a specific person, only when a large amount of people have signed it. +By design, it relies on a {url web of trust;https://en.wikipedia.org/wiki/Web_of_trust}, the idea being, different people sign each others public keys (sometimes at {url key signing parties;https://en.wikipedia.org/wiki/Key_signing_party}), and you know that a specific key corresponds to a specific person, only when a large amount of people have signed it. -OpenPGP divides the security community quite a lot, some [url https://restoreprivacy.com/let-pgp-die/ abolish it] while other still [url https://arstechnica.com/information-technology/2016/12/signal-does-not-replace-pgp/ defend it], but at the end of the day, it's very widespread and if someone encrypts their email, chances are it's with OpenPGP (unless they're in a business, where [url #smime S/MIME] rules). +OpenPGP divides the security community quite a lot, some {url abolish it;https://restoreprivacy.com/let-pgp-die/} while other still {url defend it;https://arstechnica.com/information-technology/2016/12/signal-does-not-replace-pgp/}, but at the end of the day, it's very widespread and if someone encrypts their email, chances are it's with OpenPGP (unless they're in a business, where {url S/MIME;#smime} rules). There are two main ways to encrypt an email with OpenPGP: ### PGP/Inline -The first is called "PGP/Inline", with which you encrypt only the message itself. That's it. And there are [url https://josefsson.org/inline-openpgp-considered-harmful.html other limitations] too, to name a few: +The first is called "PGP/Inline", with which you encrypt only the message itself. That's it. And there are {url other limitations;https://josefsson.org/inline-openpgp-considered-harmful.html} too, to name a few: .numbered 1. You can't encrypt attachments, period. @@ -73,67 +73,67 @@ Though, it's not all bad. If you can survive only sending text to other people, .numbered 1. It's much easier to work with, you can directly copy the encrypted PGP message and decrypt it however you like -2. The other option, PGP/MIME, is much harder to implement properly and there have been cases where [url https://web.archive.org/web/20180625054201/https://www.whonix.org/blog/pgp-inline-vs-mime it's implementation is flawed] +2. The other option, PGP/MIME, is much harder to implement properly and there have been cases where {url it's implementation is flawed;https://web.archive.org/web/20180625054201/https://www.whonix.org/blog/pgp-inline-vs-mime} ### PGP/MIME -"PGP/MIME" is the second option. As it's name suggests, you can encrypt [url https://en.wikipedia.org/wiki/MIME MIME] data with PGP, which by definition means it supports any content type. This includes: +"PGP/MIME" is the second option. As it's name suggests, you can encrypt {url MIME;https://en.wikipedia.org/wiki/MIME} data with PGP, which by definition means it supports any content type. This includes: .numbered 1. Support for Unicode characters and HTML messages 2. Attachments of any type 3. Delivery status report -Basically, any [url https://en.wikipedia.org/wiki/MIME#Multipart_subtypes multipart subtype]. Also, I should mention, the message structure and all metadata is hidden by design. +Basically, any {url multipart subtype;https://en.wikipedia.org/wiki/MIME#Multipart_subtypes}. Also, I should mention, the message structure and all metadata is hidden by design. -PGP/MIME is capable of a lot more, and is [url https://www.mailpile.is/blog/2014-11-21_To_PGP_MIME_Or_Not.html generally preferred] over PGP/Inline. Nonetheless, it has it's shortcomings: +PGP/MIME is capable of a lot more, and is {url generally preferred;https://www.mailpile.is/blog/2014-11-21_To_PGP_MIME_Or_Not.html} over PGP/Inline. Nonetheless, it has it's shortcomings: .numbered -1. As already mentioned, it is hard to implement and [url https://web.archive.org/web/20180625054201/https://www.whonix.org/blog/pgp-inline-vs-mime flawed implementations] have been made +1. As already mentioned, it is hard to implement and {url flawed implementations;https://web.archive.org/web/20180625054201/https://www.whonix.org/blog/pgp-inline-vs-mime} have been made 2. Everything is encrypted together, so you'll need to download the whole email, including all attachments, to decrypt it 3. If your client doesn't support it, manual decryption takes a bit more work ## S/MIME -[url https://en.wikipedia.org/wiki/S/MIME S/MIME], roughly said, combines and extends the [url https://en.wikipedia.org/wiki/Cryptographic_Message_Syntax Cryptograhic Message Syntax] encryption scheme and [url https://en.wikipedia.org/wiki/MIME MIME] standard to create a singular, email-oriented standard. +{url S/MIME;https://en.wikipedia.org/wiki/S/MIME}, roughly said, combines and extends the {url Cryptograhic Message Syntax;https://en.wikipedia.org/wiki/Cryptographic_Message_Syntax} encryption scheme and {url MIME;https://en.wikipedia.org/wiki/MIME} standard to create a singular, email-oriented standard. -Unlike OpenPGP it doesn't use a web of trust, but a [url https://en.wikipedia.org/wiki/Public_key_infrastructure Public key infrastructure]. This means that, rather than people exchanging certificates between themselves, a [url https://en.wikipedia.org/wiki/Certificate_authority Certificate Authroity] connects public keys with entities (people or organizations for example). +Unlike OpenPGP it doesn't use a web of trust, but a {url Public key infrastructure;https://en.wikipedia.org/wiki/Public_key_infrastructure}. This means that, rather than people exchanging certificates between themselves, a {url Certificate Authroity;https://en.wikipedia.org/wiki/Certificate_authority} connects public keys with entities (people or organizations for example). -So, already, it has a huge advantage, you don't need to exchange keys, since the email client will handle it. S/MIME is most often used by corporations/organizations, so support in commercial mail clients like [url https://support.google.com/a/answer/6374496?hl=en#zippy= Google Workspace Enterprise Edition] and [url https://support.microsoft.com/en-us/office/encrypt-messages-by-using-s-mime-in-outlook-on-the-web-878c79fc-7088-4b39-966f-14512658f480 Outlook Enterprise/Business] ([url https://docs.microsoft.com/en-us/exchange/security-and-compliance/smime-exo/configure-smime-exo?view=o365-worldwide Exchange Online has to be configured] by an administrator and can be used only with [url https://docs.microsoft.com/en-us/deployoffice/endofsupport/microsoft-365-services-connectivity paid clients]) is available. +So, already, it has a huge advantage, you don't need to exchange keys, since the email client will handle it. S/MIME is most often used by corporations/organizations, so support in commercial mail clients like {url Google Workspace Enterprise Edition;https://support.google.com/a/answer/6374496?hl=en#zippy=} and {url Outlook Enterprise/Business;https://support.microsoft.com/en-us/office/encrypt-messages-by-using-s-mime-in-outlook-on-the-web-878c79fc-7088-4b39-966f-14512658f480} ({url Exchange Online has to be configured;https://docs.microsoft.com/en-us/exchange/security-and-compliance/smime-exo/configure-smime-exo?view=o365-worldwide} by an administrator and can be used only with {url paid clients;https://docs.microsoft.com/en-us/deployoffice/endofsupport/microsoft-365-services-connectivity}) is available. -On the other hand, you can browse [url https://support.google.com/a/answer/7448393?hl=en&ref_topic=9061730 Google's] and [url https://docs.microsoft.com/en-us/security/trusted-root/participants-list Microsoft's] trusted (root) CAs all you want, but you'll find that there is only one place where you could register a certificate for free: [url https://www.actalis.com/s-mime-certificates.aspx Actalis]. A good tutorial on the procedure can be found [url https://www.dannyguo.com/blog/how-to-get-a-free-s-mime-certificate/ here], but beware, [*they*] generate the private key. +On the other hand, you can browse {url Google's;https://support.google.com/a/answer/7448393?hl=en&ref_topic=9061730} and {url Microsoft's;https://docs.microsoft.com/en-us/security/trusted-root/participants-list} trusted (root) CAs all you want, but you'll find that there is only one place where you could register a certificate for free: {url Actalis;https://www.actalis.com/s-mime-certificates.aspx}. A good tutorial on the procedure can be found {url here;https://www.dannyguo.com/blog/how-to-get-a-free-s-mime-certificate/}, but beware, {i they} generate the private key. -Otherwise, it's email encryption capabilities are the same as those outlined in [url #pgpmime PGP/MIME]. +Otherwise, it's email encryption capabilities are the same as those outlined in {url PGP/MIME;#pgpmime}. ## reop -[url https://flak.tedunangst.com/post/reop reop] is a very new, simple and "completed" system. The thing is, it's only a single command line utility that uses some encryption schemes (picked by the [url http://nacl.cr.yp.to/index.html nacl] library) for it's own unique system. Currently, there doesn't seem to be any email clients that support it. +{url reop;https://flak.tedunangst.com/post/reop} is a very new, simple and "completed" system. The thing is, it's only a single command line utility that uses some encryption schemes (picked by the {url nacl;http://nacl.cr.yp.to/index.html} library) for it's own unique system. Currently, there doesn't seem to be any email clients that support it. It is also fairly limited: .quote no support for key revocation, or long chains of certificates, or partial trust, or key servers -However, as explained in it's [url https://flak.tedunangst.com/post/reop article], that might not be that big of a deal. Finally, there are very very few people that use it. From experience, I have only seen [url https://hacktivis.me/about Haelwenn Monnier] use it. +However, as explained in it's {url article;https://flak.tedunangst.com/post/reop}, that might not be that big of a deal. Finally, there are very very few people that use it. From experience, I have only seen {url Haelwenn Monnier;https://hacktivis.me/about} use it. The only reason for using reop is if you want a very small system with a very simple source code behind it. Nevertheless, it's still a viable alternative. ## Post-email systems -There is a somewhat old [url https://github.com/OpenTechFund/secure-email document], created by the [url https://www.opentech.fund/ OpenTechFunc], which outlines very thoroughly all "next generation secure email or email-like communication" technologies. +There is a somewhat old {url document;https://github.com/OpenTechFund/secure-email}, created by the {url OpenTechFunc;https://www.opentech.fund/}, which outlines very thoroughly all "next generation secure email or email-like communication" technologies. -In it, they define the term "[url https://github.com/OpenTechFund/secure-email#post-email-alternatives post-mail]" as: +In it, they define the term "{url post-mail;https://github.com/OpenTechFund/secure-email#post-email-alternatives}" as: .quote projects to create alternatives to email that are more secure yet still email-like -And outline zero trust and fingerprinting as the main advantages of these systems. Also most of these systems are [url https://en.wikipedia.org/wiki/Peer-to-peer peer-to-peer]. +And outline zero trust and fingerprinting as the main advantages of these systems. Also most of these systems are {url peer-to-peer;https://en.wikipedia.org/wiki/Peer-to-peer}. -Given that these projects aren't really email, I won't dive much deeper into it. But I will mention, almost all listed projects seem to have been abandoned. Those still under active development are [url http://goldbug.sourceforge.net/ goldbug] and [url https://retroshare.cc/ retroshare]. Until 2021, zeronet [*was*] updated, but the [url https://github.com/shortcutme author] seems to have [url https://github.com/HelloZeroNet/ZeroNet/issues/2808#issuecomment-1132820787 disappeared]. +Given that these projects aren't really email, I won't dive much deeper into it. But I will mention, almost all listed projects seem to have been abandoned. Those still under active development are {url goldbug;http://goldbug.sourceforge.net/} and {url retroshare;https://retroshare.cc/}. Until 2021, zeronet {i was} updated, but the {url author;https://github.com/shortcutme} seems to have {url disappeared;https://github.com/HelloZeroNet/ZeroNet/issues/2808#issuecomment-1132820787}. ## Centralized non-email systems -"Centralized non-email systems" is another term, which as far as I can tell, is also coined by [url https://github.com/OpenTechFund/secure-email this document] from [url https://www.opentech.fund/ OpenTechFunc]. They define it as "centralized email-like messaging platform" and further divide it into: +"Centralized non-email systems" is another term, which as far as I can tell, is also coined by {url this document;https://github.com/OpenTechFund/secure-email} from {url OpenTechFunc;https://www.opentech.fund/}. They define it as "centralized email-like messaging platform" and further divide it into: :quote :numbered @@ -147,28 +147,28 @@ Given that these projects aren't really email, I won't dive much deeper into it. -Out of the listed options, Enlocked doesn't work anymore and was [url https://adammonsen.com/post/853/ a bad system] to begin with, ShazzleMail is pretty much [url https://www.reddit.com/r/privacytoolsIO/comments/nv6gzu/comment/hf338kq/?utm_source=share&utm_medium=web2x&context=3 dead] and Walnut also isn't up. +Out of the listed options, Enlocked doesn't work anymore and was {url a bad system;https://adammonsen.com/post/853/} to begin with, ShazzleMail is pretty much {url dead;https://www.reddit.com/r/privacytoolsIO/comments/nv6gzu/comment/hf338kq/?utm_source=share&utm_medium=web2x&context=3} and Walnut also isn't up. That leaves us with the two last-standing providers: ### Protonmail -Protonmail, or [url https://proton.me/ proton.me] as they are called now, which uses good old [url #openpgp OpenPGP]. That means they have end-to-end encryption and zero-access encryption by default for all protonmail accounts. They also [url https://proton.me/support/how-to-use-pgp support encrypted conversations with non-protonmail users]. +Protonmail, or {url proton.me;https://proton.me/} as they are called now, which uses good old {url OpenPGP;#openpgp}. That means they have end-to-end encryption and zero-access encryption by default for all protonmail accounts. They also {url support encrypted conversations with non-protonmail users;https://proton.me/support/how-to-use-pgp}. -Funnily enough, Protonmail doesn't really fit in any of the listed categories, since encrypted emails outside the system will work as any [url #openpgp OpenPGP] encrypted one. +Funnily enough, Protonmail doesn't really fit in any of the listed categories, since encrypted emails outside the system will work as any {url OpenPGP;#openpgp} encrypted one. -Protonmail's services have a free tier, which should be enough for lighter usage, but restricts [=heavily=] storage, label and folder count, amount of sent messages per day, etc. At the time of writing, their second tier pretty much lifts all restrictions for 5 euro per month (without annual contracts). Check out their pricing [url https://proton.me/pricing here]. +Protonmail's services have a free tier, which should be enough for lighter usage, but restricts {b heavily} storage, label and folder count, amount of sent messages per day, etc. At the time of writing, their second tier pretty much lifts all restrictions for 5 euro per month (without annual contracts). Check out their pricing {url here;https://proton.me/pricing}. ### Tutanota -[url https://tutanota.com/ Tutanota] uses it's own special system for security. In brief, all of your emails are (zero-access) stored and end-to-end encrypted with (mostly) [url https://en.wikipedia.org/wiki/Advanced_Encryption_Standard AES 128], and while they generate and hold your public and private keys, your password is needed to decrypt your private key (do check out their [url https://tutanota.com/security/ security page] for more details). +{url Tutanota;https://tutanota.com/} uses it's own special system for security. In brief, all of your emails are (zero-access) stored and end-to-end encrypted with (mostly) {url AES 128;https://en.wikipedia.org/wiki/Advanced_Encryption_Standard}, and while they generate and hold your public and private keys, your password is needed to decrypt your private key (do check out their {url security page;https://tutanota.com/security/} for more details). -However, it's crucial to note that they are a type [*2. Semi-closed system*]. If you send an encrypted email to a non-tutanota recipient, the recipient will get a URL from which they will be able to reply, through Tutanota's web client. +However, it's crucial to note that they are a type {i 2. Semi-closed system}. If you send an encrypted email to a non-tutanota recipient, the recipient will get a URL from which they will be able to reply, through Tutanota's web client. -Finally, pricing. In general, they have a lot less features than [url #protonmail Protonmail], but their free tier is a lot more capable than [url #protonmail Protonmail]'s. Their pricing is extremely flexible, being able to buy specific features by themselves, like storage or mail aliases. Check it out [url https://tutanota.com/pricing/ here]. +Finally, pricing. In general, they have a lot less features than {url Protonmail;#protonmail}, but their free tier is a lot more capable than {url Protonmail;#protonmail}'s. Their pricing is extremely flexible, being able to buy specific features by themselves, like storage or mail aliases. Check it out {url here;https://tutanota.com/pricing/}. ## Conclusion -In brief, almost all email encryption systems use [url #encryption-and-signature public-key cryptography]. The most popular of these systems for personal use is [url #openpgp OpenPGP], but in the business space, [url #smime S/MIME] is quite a bit more prominent. [url #reop reop] is a viable, but limited, very new and lightweight systems for encrypting your email messages. +In brief, almost all email encryption systems use {url public-key cryptography;#encryption-and-signature}. The most popular of these systems for personal use is {url OpenPGP;#openpgp}, but in the business space, {url S/MIME;#smime} is quite a bit more prominent. {url reop;#reop} is a viable, but limited, very new and lightweight systems for encrypting your email messages. -[url #protonmail Protonmail] is an email provider, which has [url #openpgp OpenPGP] built-in, enabling and supporting encryption by default, but their free tier leaves what to be desired. [url #tutanota Tutanota] is another provider, with their own entirely different system, where encrypted emails to non-tutanota users force the recipients to use their web client. +{url Protonmail;#protonmail} is an email provider, which has {url OpenPGP;#openpgp} built-in, enabling and supporting encryption by default, but their free tier leaves what to be desired. {url Tutanota;#tutanota} is another provider, with their own entirely different system, where encrypted emails to non-tutanota users force the recipients to use their web client. diff --git a/src/blog/export-skype/index.du b/src/blog/export-skype/index.du index 9f88ce7..be76ad6 100644 --- a/src/blog/export-skype/index.du +++ b/src/blog/export-skype/index.du @@ -1,15 +1,15 @@ -# How to export Skype data +'def title How to export Skype data +'def desc You navigate to Skype's data-export page, download your data, then you open it with Skype's official tool or with an improved fork of it. -'define expected-reading 3 min -'define created 03 October 2021 -'define edited 03 October 2021 -[$pagenav] +# {title} + +{pagenav 3 min;03 October 2021;03 October 2021} :contents .numbered -1. [url #downloading-files Downloading files] -2. [url #viewing-your-export-official-tool Viewing your export - Official Tool] -3. [url #viewing-your-export-artemveremienko-fork Viewing your export - ArtemVeremienko Fork] +1. {uhref Downloading files} +2. {uhref Viewing your export - Official Tool} +3. {uhref Viewing your export - ArtemVeremienko Fork} Skype has always allowed to export your chat history (and files), but it's not as straight forward as it should. @@ -18,53 +18,53 @@ Continue reading for the required steps on doing it. ## Downloading files :ordered -1. Open [url https://secure.skype.com/en/data-export secure.skype.com/en/data-export] +1. Open {url secure.skype.com/en/data-export;https://secure.skype.com/en/data-export} .unordered - You could be asked to sign in. - After signing in you'll need to [*open the link again*], since you would be redirected to the wrong place. + After signing in you'll need to {i open the link again}, since you would be redirected to the wrong place. 2. After opening the link you should be greeted by something like this. - Check the two checkboxes next to [=Conversations=] and [=Files=] [*(pointed to by the red arrows)*]. + Check the two checkboxes next to {b Conversations} and {b Files} {i (pointed to by the red arrows)}. - [image ./img/initial-screen.png] + {img ./img/initial-screen.png} -3. Press [=Submit request=]. - After being greeted by this screen, press [=Continue=]. +3. Press {b Submit request}. + After being greeted by this screen, press {b Continue}. - [image ./img/export-prepared.png] + {img ./img/export-prepared.png} .bulleted - - You should now see an [=Available exports=] section near the top of the page. - The status will be [=Pending=]. - .p [image ./img/available-exports.png] + - You should now see an {b Available exports} section near the top of the page. + The status will be {b Pending}. + .p {img ./img/available-exports.png} -5. Reload the page after a bit of time. When your export is ready, you'll find a [=Download=] button next to it, click it. +5. Reload the page after a bit of time. When your export is ready, you'll find a {b Download} button next to it, click it. - [image ./img/download-button.png] + {img ./img/download-button.png} -Your export will be downloaded as a [`.tar`] archive file. -You'll need an archiver utility to extract the files, something like [url https://www.rarlab.com/download.htm WinRAR] or [url https://www.7-zip.org/ 7-Zip] [*(I personally recommend 7-Zip, it is completely free (no need to worry about your [url https://youtu.be/fTgZRVVr3_Y infinite trial]) and works faster)*]. +Your export will be downloaded as a {` .tar} archive file. +You'll need an archiver utility to extract the files, something like {url WinRAR;https://www.rarlab.com/download.htm} or {url 7-Zip;https://www.7-zip.org/} {i (I personally recommend 7-Zip, it is completely free (no need to worry about your {url infinite trial;https://youtu.be/fTgZRVVr3_Y}) and works faster)}. ## Viewing your export - Official Tool :ordered 1. Extract your archive -2. Open the [url https://go.skype.com/skype-parser Skype Parser Download], which will prompt you to save [`skype-parser.zip`] +2. Open the {url Skype Parser Download;https://go.skype.com/skype-parser}, which will prompt you to save {` skype-parser.zip} -3. Extract [`skype-parser.zip`] +3. Extract {` skype-parser.zip} -4. Inside the [`skype-parser`] folder, open [`index.html`] (it might be named just [`index`]). You'll be greeted by this page in your browser: - [image ./img/default-skype-parser-index.png] +4. Inside the {` skype-parser} folder, open {` index.html} (it might be named just {` index}). You'll be greeted by this page in your browser: + {img ./img/default-skype-parser-index.png} -5. Click the [`Choose File`] option and select the [`messages.json`] (it might be named just [`messages`]) file from your export. - [image ./img/choose-file.png] +5. Click the {` Choose File} option and select the {` messages.json} (it might be named just {` messages}) file from your export. + {img ./img/choose-file.png} -6. Press the [`Load`] button right below, and you're done. +6. Press the {` Load} button right below, and you're done. On the left side you have your conversations, and when opening one, your messages will be displayed to the right (just like in Skype itself) - [image ./img/archived-conversations-skype-default.png] + {img ./img/archived-conversations-skype-default.png} There is only one issue with this method - the official tool is somewhat broken. @@ -74,15 +74,15 @@ The fix is using an alternative to the official tool. ## Viewing your export - ArtemVeremienko Fork -[url https://github.com/ArtemVeremienko ArtemVeremienko] is a GitHub user that took the official parser and fixed it. -Their source code can be found over at [url https://github.com/ArtemVeremienko/skype-parser github.com/ArtemVeremienko/skype-parser]. +{url ArtemVeremienko;https://github.com/ArtemVeremienko} is a GitHub user that took the official parser and fixed it. +Their source code can be found over at {url github.com/ArtemVeremienko/skype-parser;https://github.com/ArtemVeremienko/skype-parser}. :ordered -1. Go to the [url https://github.com/ArtemVeremienko/skype-parser/releases/latest latest release of his skype-parser] and download [`skype-parser.zip`] +1. Go to the {url latest release of his skype-parser;https://github.com/ArtemVeremienko/skype-parser/releases/latest} and download {` skype-parser.zip} - [image ./img/github-skype-parser-download.png] + {img ./img/github-skype-parser-download.png} 2. Extract all of the files. - They'll be in the same folder as the [`skype-parser.zip`] file, so find the [`index.html`] file and open it. + They'll be in the same folder as the {` skype-parser.zip} file, so find the {` index.html} file and open it. -3. Continue from step 5 onward of the [url #viewing-your-export-official-tool Viewing your export - Official Tool] section +3. Continue from step 5 onward of the {url Viewing your export - Official Tool;#viewing-your-export-official-tool} section diff --git a/src/blog/fix-network-brother-printers/index.du b/src/blog/fix-network-brother-printers/index.du index 045bb39..15a5126 100644 --- a/src/blog/fix-network-brother-printers/index.du +++ b/src/blog/fix-network-brother-printers/index.du @@ -1,28 +1,28 @@ -# Fix networked Brother printers not working in Linux +'def title Fix networked Brother printers not working in Linux +'def desc To fix a networked Brother printer under linux: check CUPS recongnises it on the network, check support, find drivers -'define expected-reading 4 min -'define created 28 June 2023 -'define edited 28 June 2023 -[$pagenav] +# {title} + +{pagenav 4 min;28 June 2023;28 June 2023} Before we start, make sure you have CUPS and avahi installed and running. ## Make sure CUPS recognises it -Go to [url https://localhost:631/printers/ localhost:631/printers] and make sure your printer is listed there. -If [=not=], go to [`Administration/Add Printer`] and select your printer. -If it's [=not=] listed even there, then you have some other network connectivity issue. +Go to {url localhost:631/printers;https://localhost:631/printers/} and make sure your printer is listed there. +If {b not}, go to {` Administration/Add Printer} and select your printer. +If it's {b not} listed even there, then you have some other network connectivity issue. -Otherwise [url #try-to-print-a-test-page try to print a test page]. +Otherwise {url try to print a test page;#try-to-print-a-test-page}. -### Check if it [=is=] recognised on the network. +### Check if it {b is} recognised on the network. Execute in the command line: ```bash avahi-browse --all -t -r -There will be a lot of output, but scroll down until you find something [*like*]: +There will be a lot of output, but scroll down until you find something {i like}: ``` = enp0s25 IPv4 Brother HL-L2350DW series _pdl-datastream._tcp local @@ -30,7 +30,7 @@ hostname = [BRW9C305B9EC83D.local] address = [192.168.0.110] The exact values aren't important, just make sure the part after IPv4 is the model of your printer. -[`address`] is the local printer address, ping it. +{` address} is the local printer address, ping it. In this example, the command would be: ```bash @@ -38,21 +38,21 @@ ping 192.168.0.110 .bulleted - If the ping is successful, you might also want to put that IP address in your browser. - With the example, you would open the link [`http://192.168.0.110`]. - Your printer [=may=] or [=may not=] support Web Based Management, which would allow you to edit it's setting from the browser. + With the example, you would open the link {` http://192.168.0.110}. + Your printer {b may} or {b may not} support Web Based Management, which would allow you to edit it's setting from the browser. If the page isn't available, don't worry about it. -If output is [=not=] something like [`64 bytes from ...`] (so, if it is [`Destination Host Unreachable`] or ping just hangs, without output), then it's an issue with your network or printer network configuration. +If output is {b not} something like {` 64 bytes from ...} (so, if it is {` Destination Host Unreachable} or ping just hangs, without output), then it's an issue with your network or printer network configuration. Make sure the printer is properly connected to the network.\n Otherwise, this shows that your computer has network access to the printer, and all problems are local. ### Check if your printer is supported by Linux. -Go to [url https://www.openprinting.org/printers www.openprinting.org/printers] and enter your model. +Go to {url www.openprinting.org/printers;https://www.openprinting.org/printers} and enter your model. If it isn't listed then it doesn't work for sure. -Alternatively, if it is and the rating [url https://wiki.linuxfoundation.org/openprinting/database/databaseintro#about_the_data isn't "Perfectly"], then read the whole page, in case networking is listed as nonfunctional. -If it [=is=] supported, then: +Alternatively, if it is and the rating {url isn't "Perfectly";https://wiki.linuxfoundation.org/openprinting/database/databaseintro#about_the_data}, then read the whole page, in case networking is listed as nonfunctional. +If it {b is} supported, then: ### Check if there are drivers available @@ -61,8 +61,8 @@ Run in the command line: ```bash lpinfo -v -If you only get entries like [`network WORD`], without anything which looks like a URL (URI), then you may not have a working driver. -Make sure you have installed any or tried all of the drivers listed in the printer's [url https://www.openprinting.org/printers www.openprinting.org] page. +If you only get entries like {` network WORD}, without anything which looks like a URL (URI), then you may not have a working driver. +Make sure you have installed any or tried all of the drivers listed in the printer's {url www.openprinting.org;https://www.openprinting.org/printers} page. ## Try to print a test page @@ -73,7 +73,7 @@ After a little while, the "State" should change from "pending" to "processing" ( ### Unable to locate printer "SOMETHING.local" If you also have the error "Unable to locate printer "SOMETHING.local"." (obviously SOMETHING is the exact value you get), then that means the printer is accessed via the domain name "SOMETHING.local". -[`.local`] domains require a special DNS server to be resolved, so inside [`/etc/nsswitch.conf`], on the line that starts with [`hosts`], add to it's end the value [`mdns_minimal`]. +{` .local} domains require a special DNS server to be resolved, so inside {` /etc/nsswitch.conf}, on the line that starts with {` hosts}, add to it's end the value {` mdns_minimal}. It should look something like: ``` @@ -82,4 +82,4 @@ hosts: files dns mdns_minimal After saving your changes, your printer should pretty quickly start printing the test page, no need to restart anything. .bulleted -- if your printer supports Web Based Management, then you should be able to go open the page [`http://SOMETHING.local`] in your browser and edit your printer settings from there. +- if your printer supports Web Based Management, then you should be able to go open the page {` http://SOMETHING.local} in your browser and edit your printer settings from there. diff --git a/src/blog/fix-no-frame-buffer-plan9/index.du b/src/blog/fix-no-frame-buffer-plan9/index.du index 8d63c0b..fe21454 100644 --- a/src/blog/fix-no-frame-buffer-plan9/index.du +++ b/src/blog/fix-no-frame-buffer-plan9/index.du @@ -1,20 +1,20 @@ -# Fix "No frame buffer" error in Plan 9 +'def title Fix 'No frame buffer' error in Plan 9 +'def desc Installing Plan 9 by Bell Labs on QEMU/KVM might give an initdisplay error. To fix it, you'll need to change the monitor type from xga to vesa. -'define expected-reading 3 min -'define created 30 July 2022 -'define edited 30 July 2022 -[$pagenav] +# {title} -Let's say you installed [url https://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs Plan 9 by Bell Labs] on a QEMU/KVM virtual machine by just following the prompts and entering defaults. In certain cases, you might find your install booting to a shell with the errors: +{pagenav 3 min;30 July 2022;30 July 2022} + +Let's say you installed {url Plan 9 by Bell Labs;https://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs} on a QEMU/KVM virtual machine by just following the prompts and entering defaults. In certain cases, you might find your install booting to a shell with the errors: ``` aux/vga: inportl(0xc100): permission denied rio: can't open display: initdisplay: /dev/draw/new: no frame buffer init: rc exit status: rio 31: display open -[image ./img/boot-prompt-no-frame-buffer-error.png] +{img ./img/boot-prompt-no-frame-buffer-error.png} -For some reason, on certain configurations, the [`xga`] ([`vga`]) monitor type does not work when booting into Plan 9, even though it works fine during install. The fix is to adjust monitor settings to [`vesa`]: +For some reason, on certain configurations, the {` xga} ({` vga}) monitor type does not work when booting into Plan 9, even though it works fine during install. The fix is to adjust monitor settings to {` vesa}: :ordered 1. In the shell prompt enter @@ -22,9 +22,10 @@ For some reason, on certain configurations, the [`xga`] ([`vga`]) monitor type d ``` aux/vga -m vesa -l + .p You should get a cursor and a cleared prompt. - [image ./img/manual-prompt.png] + {img ./img/manual-prompt.png} 2. In this "new" shell prompt, enter @@ -33,7 +34,7 @@ rio You should now get a grey background with the cursor in it. - [image ./img/manual-rio.png] + {img ./img/manual-rio.png} .bulleted - You are now in a graphical environment, so technically you can stop here. The other steps are for configuring it so you wont ever have that problem again. @@ -50,7 +51,7 @@ sam /n/9fat/plan9.ini this is the configuration file we will be changing. - [image ./img/rio-9fat-commands.png] + {img ./img/rio-9fat-commands.png} .bulleted - How to make a window: right click, hold, hover over "New" and release the right click. Now right click somewhere in the top left, hold, drag to somewhere in bottom right, release. @@ -62,12 +63,12 @@ sam /n/9fat/plan9.ini b /n/9fat/plan9.ini and click the green-backgrounded box. - Then replace [`xga`] with [`vesa`]: + Then replace {` xga} with {` vesa}: ``` , x/xga/ s/xga/vesa - and click the green-backgrounded box again. We're almost done here, enter [`w`], wait a bit, and finally enter [`q`]. + and click the green-backgrounded box again. We're almost done here, enter {` w}, wait a bit, and finally enter {` q}. :unordered - If you want to check whether the file was properly saved, feel free to run @@ -77,14 +78,14 @@ cat /n/9fat/plan9.ini and check that monitor is equal to vesa (you can scroll with the arrow keys, or with left and right mouse buttons, acting as up and down). - [image ./img/rio-plan9ini-cat.png] + {img ./img/rio-plan9ini-cat.png} - - The first command opens the [`plan9.ini`] file for editing, and the second command, finds every line that contains [`xga`] (there should probably be only one) and on each matching line replaces [`xga`] with [`vesa`]. Refer to the [url https://p9f.org/sys/doc/sam/sam.html docs] for more information. + - The first command opens the {` plan9.ini} file for editing, and the second command, finds every line that contains {` xga} (there should probably be only one) and on each matching line replaces {` xga} with {` vesa}. Refer to the {url docs;https://p9f.org/sys/doc/sam/sam.html} for more information. -5. That's it, all we have to do is halt our file system with [`fshalt`] (or type out the command in the [url https://9p.io/wiki/plan9/Installing_Plan_9_on_Qemu/ Qemu installation guide]) and Force Reset the virtual machine. +5. That's it, all we have to do is halt our file system with {` fshalt} (or type out the command in the {url Qemu installation guide;https://9p.io/wiki/plan9/Installing_Plan_9_on_Qemu/}) and Force Reset the virtual machine. The next time you boot into Plan 9 and into your user, the graphical environment should load fine. Enjoy Plan 9! -[image ./img/rio-default-login.png] +{img ./img/rio-default-login.png} diff --git a/src/blog/fix-qc-timeout/index.du b/src/blog/fix-qc-timeout/index.du index 11dfa32..42ee9c1 100644 --- a/src/blog/fix-qc-timeout/index.du +++ b/src/blog/fix-qc-timeout/index.du @@ -1,12 +1,12 @@ -# Fix "qc timeout" kernel log error +'def title Fix 'qc timeout' kernel log error +'def desc Depending on your harddrive, you may get a 15 second boot delay, cause by a qc timeout error. The solution is to tell the kernel that DMA logs are not supported. -'define expected-reading 4 min -'define created 16 December 2023 -'define edited 20 August 2025 -[$pagenav] +# {title} + +{pagenav 4 min;16 December 2023;20 August 2025} Depending on your harddrive, you may get a 15 second delay on boot. -Looking at the kernel logs (with [`dmesg`]), you may find the following errors: +Looking at the kernel logs (with {` dmesg}), you may find the following errors: ``` kernel: ata1.00: qc timeout after 15000 msecs (cmd 0x47) @@ -23,13 +23,13 @@ Meaning, add the following parameter: ``` libata.force=1.00:nodmalog -where [`1.00`] is the thing between "ata" and ":". +where {` 1.00} is the thing between "ata" and ":". So, if your logs were ``` kernel: ata3.01: qc timeout after 15000 msecs (cmd 0x47) -... +\... then the parameter would be: @@ -42,7 +42,7 @@ libata.force=3.01:nodmalog ### Update 20 August 2025 .p -About a month ago I stumbled upon this [url https://de.comp.hardware.laufwerke.festplatten.narkive.com/F8WstP5i/fix-frage-zu-sata-read-log-0x00-page-0x00-failed-emask-0x40 mailing list] (Google-powered translation to English [url https://de-comp-hardware-laufwerke-festplatten-narkive-com.translate.goog/F8WstP5i/fix-frage-zu-sata-read-log-0x00-page-0x00-failed-emask-0x40?_x_tr_sl=bg&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp here]). +About a month ago I stumbled upon this {url mailing list;https://de.comp.hardware.laufwerke.festplatten.narkive.com/F8WstP5i/fix-frage-zu-sata-read-log-0x00-page-0x00-failed-emask-0x40} (Google-powered translation to English {url here;https://de-comp-hardware-laufwerke-festplatten-narkive-com.translate.goog/F8WstP5i/fix-frage-zu-sata-read-log-0x00-page-0x00-failed-emask-0x40?_x_tr_sl=bg&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp}). .p A user had the same issue as outlined in this post and were discussing the situation. @@ -63,21 +63,21 @@ I'm leaving my original explanation, since some of it is still true. The following is how I understand the issue, but I did not find definitive proof thats exactly what happens.\n Take this section with a grain of salt. -A harddrive can support [url https://en.wikipedia.org/wiki/Direct_memory_access dma transfers], normally the CPU would handle data transfer from the harddrive to the system memory (RAM), meaning it asks for a bit of data, waits, when the data comes, puts it in memory, then asks for next bit and so on. +A harddrive can support {url dma transfers;https://en.wikipedia.org/wiki/Direct_memory_access}, normally the CPU would handle data transfer from the harddrive to the system memory (RAM), meaning it asks for a bit of data, waits, when the data comes, puts it in memory, then asks for next bit and so on. With DMA, the CPU could ask the drive for everythng it wants (not a tiny bit), and then the DMA controller (DMAC) on the drive will handle the actual data transfer from the drive to the memory (when the transfer is done, the drive will tell the CPU). The benefit is that the CPU can do other work while the transfer is going on, greatly improving efficiency, but the downside is that the harddrive has to support it (have a DMAC chip on it). Normally it would be useful for the DMAC to keep logs in a special place on the drive. -[~This is where the issue comes from: your harddrive supports DMA but does not support logs for it. +{s This is where the issue comes from: your harddrive supports DMA but does not support logs for it. However, the Linux kernel has no good way of knowing that, there is no "property" on the drive which tells us this. -The only way is to try and read from that log: if it succeeds, then there is support, if it fails, then there isn't.~] +The only way is to try and read from that log: if it succeeds, then there is support, if it fails, then there isn't.} -[~But what does it mean to fail? +{s But what does it mean to fail? The simplest definition would be for the drive to return an error singal, but in our case, the drive would just not return anything, ignoring our request. In that case, how would we know if the drive just doesn't know how to respond (meaning it doesn't support the logs) or if it's just very slow? -Well, we can't, so we put a time limit, if it doesn't respond in 15 seconds, then it probably doesn't support it.~] +Well, we can't, so we put a time limit, if it doesn't respond in 15 seconds, then it probably doesn't support it.} -That's what the error is saying: [`qc`] is short for [url https://docs.kernel.org/driver-api/libata.html#origins-of-commands "queued command"], it's used to represent a (S)ATA command (hence the [`cmd`] at the end, telling us which command it's referring to). +That's what the error is saying: {` qc} is short for {url "queued command";https://docs.kernel.org/driver-api/libata.html#origins-of-commands}, it's used to represent a (S)ATA command (hence the {` cmd} at the end, telling us which command it's referring to). So, the kernel is telling us "The hard drive (ATA) command to read (DMA) logs timed out after 15 seconds" (it first says a command timed out, then it says which one). By adding that kernel parameter, we're telling Linux that the drive doesn't support DMA logs, therefore the kernel doesn't need to do this "wait 15 seconds for response if support exists" routine. diff --git a/src/blog/fmi-i-vissheto-obrazovanie-v-programistkata-industriq/balove-2021.du b/src/blog/fmi-i-vissheto-obrazovanie-v-programistkata-industriq/balove-2021.du index 0796818..602622f 100644 --- a/src/blog/fmi-i-vissheto-obrazovanie-v-programistkata-industriq/balove-2021.du +++ b/src/blog/fmi-i-vissheto-obrazovanie-v-programistkata-industriq/balove-2021.du @@ -1,17 +1,17 @@ -# Балове 2021 +'def title Балове 2021 +'def desc Кандидатстудентски балове за Компютърни Науки, Софтуерно Инженерство и Информатика във ФМИ през 2021 -'define expected-reading 3 min -'define created 13 July 2023 -'define edited 14 July 2023 -[$pagenav] +# {title} -[*Тази страница е разширение на [url ./ "ФМИ и висшето образование в програмистката индустрия"].*] +{pagenav 3 min;13 July 2023;14 July 2023} + +{i Тази страница е разширение на {url "ФМИ и висшето образование в програмистката индустрия";./}.} Благодарение на електронната система за кандидатстване, имам минимални балове на трите класирания през 2021 за компютърни науки, софтуерно инженерство и информатика (без информационни системи, защото не исках да влизам там). Понеже такава информация много не се разпространява, тук ще я споделя подробно. Очевидна бележка: това са баловете за мъже, за жени са различни. -Също в бележките под линия на оригиналната статия съм дал стойности и източници за [url ./#fn4 бройка кандидати през 2021]. +Също в бележките под линия на оригиналната статия съм дал стойности и източници за {url бройка кандидати през 2021;./#fn4}. Напомням, че 2021 беше последната година с два изпита по математика: Математика I и Математика II. Първият беше по-обикновен, със затворени и отворени въпроси, и задачи с решения. @@ -19,9 +19,9 @@ Балът се формираше така: .bulleted -- 3 по оценката от Математика II [*или*] 2.5 по оценката от Математика I (което от двете носи по-голямо число) +- 3 по оценката от Математика II {i или} 2.5 по оценката от Математика I (което от двете носи по-голямо число) - + -- ако си ходил на държавен зрелостен изпит по математика, оценката от него, [*иначе*] оценката по математика от дипломата +- ако си ходил на държавен зрелостен изпит по математика, оценката от него, {i иначе} оценката по математика от дипломата За някакво усещане за баловете, ще напиша минималната нужна оценка от изпитите, считайки оценката от ДЗИ или дипломата за 6,00. Ако балът е под 13.5, то тогава със сигурност са приети студенти, които са имали по-малко от 6.00 на ДЗИ/диплома и са компенсирали с резултати на изпитите по математика (не може да кандидатстваш с оценка, по-ниска от 3.000). @@ -30,7 +30,8 @@ ## Първо класиране -:table_4 +:table +:4 |= Специалност - форма на обучение |= Минимален бал |= Мин. оценка по Математика I @@ -67,14 +68,16 @@ |: 3.877 |: Информатика - платено редовно -|: [*11.62*] +|: {i 11.62} |: 3.000 |: 3.000 + ## Второ класиране -:table_4 +:table +:4 |= Специалност - форма на обучение |= Минимален бал |= Мин. оценка по Математика I @@ -91,7 +94,7 @@ |: 4.263 |: Информатика - редовно -|: [*10.64*] +|: {i 10.64} |: 3.000 |: 3.000 @@ -116,9 +119,11 @@ |: - + ## Трето класиране -:table_4 +:table +:4 |= Специалност - форма на обучение |= Минимален бал |= Мин. оценка по Математика I @@ -135,7 +140,7 @@ |: 4.406 |: Информатика - редовно -|: [*12.00*] +|: {i 12.00} |: 3.000 |: 3.000 diff --git a/src/blog/fmi-i-vissheto-obrazovanie-v-programistkata-industriq/index.du b/src/blog/fmi-i-vissheto-obrazovanie-v-programistkata-industriq/index.du index ec2f9b8..75fbcbf 100644 --- a/src/blog/fmi-i-vissheto-obrazovanie-v-programistkata-industriq/index.du +++ b/src/blog/fmi-i-vissheto-obrazovanie-v-programistkata-industriq/index.du @@ -1,46 +1,46 @@ -# ФМИ и висшето образование в програмистката индустрия +'def title ФМИ и висшето образование в програмистката индустрия +'def desc Сравнение на различни български университети с ФМИ, разглеждане на предметите във ФМИ и общо мнение за факултета -'define expected-reading 39 min -'define created 12 July 2023 -'define edited 14 July 2023 -[$pagenav] +# {title} + +{pagenav 39 min;12 July 2023;14 July 2023} :contents :numbered -1. [url #section-2 Кой съм аз] -2. [url #section-3 Университетите в България (София)] +1. {uhref Кой съм аз} +2. {uhref Университетите в България (София)} .numbered - 1. [url #section-4 УниБит] - 2. [url #section-5 НБУ] - 3. [url #section-6 Технически университет] + 1. {uhref УниБит} + 2. {uhref НБУ} + 3. {uhref Технически университет} -4. [url #section-7 ФМИ] +4. {uhref ФМИ} :numbered - 1. [url #section-8 Специалности] - 2. [url #section-9 Влизане] - 3. [url #section-10 Следване и оцеляване] + 1. {uhref Специалности} + 2. {uhref Влизане} + 3. {uhref Следване и оцеляване} .numbered - 1. [url #section-11 Оценяване, влачене и повтаряне] - 2. [url #section-12 Седмична заетост] - 3. [url #section-13 Преподаватели] - 4. [url #section-14 Избираеми дисциплини и работа] + 1. {uhref Оценяване, влачене и повтаряне} + 2. {uhref Седмична заетост} + 3. {uhref Преподаватели} + 4. {uhref Избираеми дисциплини и работа} - 4. [url #-2 Какво се учи в КН2] + 4. {uhref Какво се учи в КН2} :numbered - 1. [url #section-15 Училищната математика\nсрещу университетската математика] - 2. [url #section-16 Първи курс: М-то във ФМИ означава МатеМатика] + 1. {uhref Училищната математика\nсрещу университетската математика} + 2. {uhref Първи курс: М-то във ФМИ означава МатеМатика} .numbered - 1. [url #section-17 Зимен семестър] - 2. [url #section-18 Летен семестър] + 1. {uhref Зимен семестър} + 2. {uhref Летен семестър} - 3. [url #section-19 Втори курс: И-то във ФМИ означава математИка] + 3. {uhref Втори курс: И-то във ФМИ означава математИка} .numbered - 1. [url #section-20 Зимен семестър] - 2. [url #section-21 Летен семестър] + 1. {uhref Зимен семестър} + 2. {uhref Летен семестър} -5. [url #section-22 Има ли смисъл от следване във фми? ДА!] +5. {uhref Има ли смисъл от следване във фми? ДА!} @@ -49,15 +49,15 @@ И цялата тази дискусия се намира в постове от преди 5-10 години... Аз вече съм следвал 2 години в университет, плюс това имам сериозен опит от преди това. -Макар и този блогпост да е главно за [url https://www.fmi.uni-sofia.bg/ Факултета по Математика и Информатика] към [url https://www.uni-sofia.bg/index.php Софийски Университет], по-общата ми цел е да споделя всичко , което знам свързано с образованието в индустрията. +Макар и този блогпост да е главно за {url Факултета по Математика и Информатика;https://www.fmi.uni-sofia.bg/} към {url Софийски Университет;https://www.uni-sofia.bg/index.php}, по-общата ми цел е да споделя всичко , което знам свързано с образованието в индустрията. -Бърза бележка: всичко казано [=важи за моя випуск=], с времето нещата се изменят и може повечето информация тук да бъде [=остаряла=]. -Допълнително, [url ./balove-2021.html тук] имам изкарани баловете във ФМИ (на СУ) за 2021 година. +Бърза бележка: всичко казано {b важи за моя випуск}, с времето нещата се изменят и може повечето информация тук да бъде {b остаряла}. +Допълнително, {url тук;./balove-2021.html} имам изкарани баловете във ФМИ (на СУ) за 2021 година. ## Кой съм аз Този блогпост няма да бъде напълно неутрален и ще включва моето мнение, затова е добре да знаеш от къде идва моята гледна точка. -Завършил съм [url https://www.feg.bg/ 9 Френска езикова гимназия], обаче едновременно от 10 до 12 клас участвах интензивно в националната програма [url https://it-kariera.mon.bg/e-learning/ ИТ-кариера]. +Завършил съм {url 9 Френска езикова гимназия;https://www.feg.bg/}, обаче едновременно от 10 до 12 клас участвах интензивно в националната програма {url ИТ-кариера;https://it-kariera.mon.bg/e-learning/}. Накратко, в тази програма изучавах практически неща, главните няколко типове програмирания, и към края се занимавах с разработване на софтуер на сравнително индустриално ниво (или поне най-близкото до това). От цялата програма бях единствения от център София с пълно отличие. @@ -73,7 +73,7 @@ ## Университетите в България (София) Сега ще обсъдим какви са алтернативите на ФМИ, и защо те не са толкова добри. -В София има четири (смислени) университета, които предлагат някаква форма на софтуерно образование: [url https://www.uni-sofia.bg/ Софийски университет], [url https://nbu.bg/ Нов Български Университет], [url https://www.tu-sofia.bg/ Техническия Университет] и [url https://www.unibit.bg/ Университет по Библеотекознание и Информационни технологии]. +В София има четири (смислени) университета, които предлагат някаква форма на софтуерно образование: {url Софийски университет;https://www.uni-sofia.bg/}, {url Нов Български Университет;https://nbu.bg/}, {url Техническия Университет;https://www.tu-sofia.bg/} и {url Университет по Библеотекознание и Информационни технологии;https://www.unibit.bg/}. Този пост ще бъде посветен на първата от тези опции, но все пак покрай приятели и колеги имам добра представа за другите опции. ### УниБит @@ -103,8 +103,8 @@ ### Технически университет -Не съм чувал много, но техническият университет се занимава повече с инженерство, така че [url https://tu-sofia.bg/uplan/%D0%A4%D0%9A%D0%A1%D0%A2/%D0%91%D0%B0%D0%BA%D0%B0%D0%BB%D0%B0%D0%B2%D1%8A%D1%80/FKSU_UPlan_BCSCe_zadochno.pdf се учат не толкова свързани предмети], като физика, проектиране и електротехника. -[url https://old.reddit.com/r/bulgaria/comments/tqy9l4/%D1%84%D0%BC%D0%B8_%D0%B8%D0%BB%D0%B8_%D1%82%D1%83/ Доколкото виждам онлайн, мненията не са позитивни]: +Не съм чувал много, но техническият университет се занимава повече с инженерство, така че {url се учат не толкова свързани предмети;https://tu-sofia.bg/uplan/%D0%A4%D0%9A%D0%A1%D0%A2/%D0%91%D0%B0%D0%BA%D0%B0%D0%BB%D0%B0%D0%B2%D1%8A%D1%80/FKSU_UPlan_BCSCe_zadochno.pdf}, като физика, проектиране и електротехника. +{url Доколкото виждам онлайн, мненията не са позитивни;https://old.reddit.com/r/bulgaria/comments/tqy9l4/%D1%84%D0%BC%D0%B8_%D0%B8%D0%BB%D0%B8_%D1%82%D1%83/}: .quote За IT ТУ е абсолютна загуба на време - редовно ми идват стажанти от там. Ако не са се занимавали с програмиране от преди това, почваме от 0 @@ -126,10 +126,10 @@ Във ФМИ много от предметите са математики и програмиранията се говори, че не са много добре. Онлайн има стотици часове материали и курсове, повечето от които са безплатни, на всяка тема свързана с програмиране. -Допълнително имаш [url https://www.telerikacademy.com/ Telerik Academy] и [url https://softuni.bg/ SoftUni] (само искам да напомня, че [=СофтУни не е университет=], макар и така да се казват) - две места които предлагат разнообразни програмистки и чисто практически курсове (и също дават сертификати). +Допълнително имаш {url Telerik Academy;https://www.telerikacademy.com/} и {url SoftUni;https://softuni.bg/} (само искам да напомня, че {b СофтУни не е университет}, макар и така да се казват) - две места които предлагат разнообразни програмистки и чисто практически курсове (и също дават сертификати). А и повечето програмисти нямат висше и са самоуки, тоест този път не е изобщо странен, даже е най-често следвания. -Финалното ми мнение се намира [url #section-19 най-долу], но един такова решение трябва да се вземе с възможно най-много информация. +Финалното ми мнение се намира {url най-долу;#section-19}, но един такова решение трябва да се вземе с възможно най-много информация. ### Специалности @@ -137,18 +137,16 @@ Технически всяка се занимава с различни неща, но на практика всички влезли искат да са програмисти. От тях, най-желани са компютърни науки и софтуерно инженерство (тези ще наричам "хубавите" специалности). -В информатика се влизаше много лесно, там балът беше [url ./balove-2021.html безнадеждно нисък], обаче следването е най-трудно от всички останали дисциплини. -Късането е брутално, особено първи курс: по Алгебра 1 от към 200 човека (това включваше и минали години май) само един човек беше [*допуснат*] до изпит (ама си го мина де). +В информатика се влизаше много лесно, там балът беше {url безнадеждно нисък;./balove-2021.html}, обаче следването е най-трудно от всички останали дисциплини. +Късането е брутално, особено първи курс: по Алгебра 1 от към 200 човека (това включваше и минали години май) само един човек беше {i допуснат} до изпит (ама си го мина де). По дискретни структури бяха повече, цели 10тима човека. -Общо от 1ви курс преминаха успешно 20-30 човека във 2ри курс (за да минеш не е нужно всички изпити да си минал, ама детайли [url #section-10 по-късно]). +Общо от 1ви курс преминаха успешно 20-30 човека във 2ри курс (за да минеш не е нужно всички изпити да си минал, ама детайли {url по-късно;#section-10}). Има няколко причини за това: .bulleted - от една страна бала като е най-нисък, хората с най-ниски умения по математика се намират там, така че успехите ще са най-ниски, - от друга страна има и преподаватели които са прекомерно неадекватни като изпитване и преподаване. -'footnote inf-sistemi Признавам, за тази информация използвах [url https://forums.bgdev.org/index.php?showtopic=34217&st=0&#entry255351 това мнение от форум], никой не обсъжда ИС. - -Информационни системи от своя страна сякаш се занимава повече с бази данни и проектиране на информационни системи[$inf-sistemi], не толкова чисто програмиране и нещата около него. +Информационни системи от своя страна сякаш се занимава повече с бази данни и проектиране на информационни системи{fn Признавам, за тази информация използвах {url това мнение от форум;https://forums.bgdev.org/index.php?showtopic=34217&st=0&#entry255351}, никой не обсъжда ИС.}, не толкова чисто програмиране и нещата около него. Признавам, че не съм чувал много за тях, ама балът не изглежда да е много висок (мисля че е по-висок от информатика) и мисля, че следването е най-лесно от 4те специалности. Сега, компютърни науки и софтуерно инженерство. @@ -164,30 +162,28 @@ Само по Алгебра 1 и Геометрия минават към 20-30 човека от първия път, по останалите си минават повечето. Макар че сравнително непланирано им сложиха доста взискателни преподаватели през 2ри курс, не знам дали те ще останат в бъдещи години, така че разликата между КН1 и КН2 може да се стопи. -'footnote minali-1-kurs Тази статистика е взета директно от таблици с оценки на редовни студенти на [url https://learn.fmi.uni-sofia.bg/mod/resource/view.php?id=228877 първи курс по Дискретни структури] и [url https://learn.fmi.uni-sofia.bg/mod/resource/view.php?id=283034 втори курс по Дизайн и Анализ на Алгоритми]. Тези таблици са правени от лектора по списъци от СУСИ (онлайн системата за студенти). Ще спомена по-късно, но дългите факултетни номера, в които има и букви, са на студентите, влезли през 2021, докато кратките пет-цифрени са на студенти от минали години, които повтарят. - КН2 вече е доста по-трудно, тук ежегодно по Диференциално и интегрално смятане минават 20-30 човека, а по Дискретни структури минават по 10тина. Напомням, че аз влязох тук. -Приблизително 44%[$minali-1-kurs] от редовните студенти (които не повтарят) успешно минаха (минахме ;)) към втори курс. +Приблизително 44%{fn Тази статистика е взета директно от таблици с оценки на редовни студенти на {url първи курс по Дискретни структури;https://learn.fmi.uni-sofia.bg/mod/resource/view.php?id=228877} и {url втори курс по Дизайн и Анализ на Алгоритми;https://learn.fmi.uni-sofia.bg/mod/resource/view.php?id=283034}. Тези таблици са правени от лектора по списъци от СУСИ (онлайн системата за студенти). Ще спомена по-късно, но дългите факултетни номера, в които има и букви, са на студентите, влезли през 2021, докато кратките пет-цифрени са на студенти от минали години, които повтарят.} от редовните студенти (които не повтарят) успешно минаха (минахме ;)) към втори курс. Иначе имам впечатлението, че най-умните и умелите хора измежду компютърни науки и софтуерно инженерство се намират тук, макар че това зависи от випуска: няма гаранция, че един много умен кандидат-студент ще реши да се запише за КН (и ще попадне в КН2). Като обобщение, това са дисциплините подредени от най-трудна за минаване към най-лесна: :ordered -1. [=Информатика=]: много трудно, не по много основателни причини, макар че като цяло малцинството което успява да завърши са на високо ниво. +1. {b Информатика}: много трудно, не по много основателни причини, макар че като цяло малцинството което успява да завърши са на високо ниво. Не препоръчвам, ако не си много издържлив и КН и СИ не са се получили. -2. [=Компютърни науки, 2ри поток=]: трудно, но като цяло е сравнително основателно (пак на моменти е малко нечестно, но не толкова колкото при информатика), нивото просто е високо. +2. {b Компютърни науки, 2ри поток}: трудно, но като цяло е сравнително основателно (пак на моменти е малко нечестно, но не толкова колкото при информатика), нивото просто е високо. Поне от моя випуск, повечето от най-добрите се намират тук. Ако си представим, че има някакво перфектно ниво на обучение, където не е твърде лесно, но и не е твърде трудно, бих казал че КН2 се намира малко над това ниво. -3. [=Компютърни науки, 1ви поток=]: малко по-лесно от КН2, но с малко понижаване на качеството. +3. {b Компютърни науки, 1ви поток}: малко по-лесно от КН2, но с малко понижаване на качеството. Има добро количество материал, което в КН2 ти е набито в главата, докато при КН1 си го забравил след лятната ваканция (не че това не важи в обратната посока, но в КН2 ни вкарват повече неща в умовете). В сравнение с перфектното ниво, КН1 е малко под него. Обаче трябва да се има в предвид, че 2ри курс сложиха доста взискателни преподаватели. Ако това се запази, разликата между двата потока може да изчезне. -4. [=Софтуерно инженерство=]: забележимо по-лесно от компютърни науки, повечето хора по повечето дисциплини минават без твърде много проблеми. +4. {b Софтуерно инженерство}: забележимо по-лесно от компютърни науки, повечето хора по повечето дисциплини минават без твърде много проблеми. Ама нивото също спада забележително, макар и бала да е най-висок. Както споменах, при компютърни науки е по-добре, ама нивото на СИ пак е сравнително ок. -5. [=Информационни системи=]: нисичък бал и сравнително лесно, но не ми изглежда да е супер развиващо за програмисти. +5. {b Информационни системи}: нисичък бал и сравнително лесно, но не ми изглежда да е супер развиващо за програмисти. Не бих препоръчал, освен ако алтернативата не е информатика. @@ -200,35 +196,23 @@ Сега главният определящ изпит е просто "Математика" и включва сложни въпроси като "кое от следните числа е най-голямо" и "намерете броя решения на уравнението". Разбира се, с това си идват свои трудности, и най-малката грешка може да постави 10-20 човека над тебе като успех, но в края на деня не се изисква толкова много тренинг както при моите изпити. -'footnote mat-i-ii Макар че това не е много добра причина за смяна на изпитването, понеже схемата с два такива изпита (единия стандартен и другия с малко задачи, но с пълни решения) си е държала още от времето на комунизма. Моето предположение за тази промяна, е че новата система е влошила качеството на обучение твърде много и искат минималните оценки за влизане се повишават обратно към околността на 6ца, но това вече са мои си конспирации. - -'footnote 2021-kandidati Такива статистики много не се намират публично и линковете не са сложени на достъпно място, но успях да изровя директните линкове към разпределението по зали за [url https://www.uni-sofia.bg/index.php/bul/content/download/249347/1644279/version/1/file/2021-04-24_09-00_%D0%9C%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0+II.pdf първа изпитна сесия по Математика II], [url https://www.uni-sofia.bg/index.php/bul/content/download/250518/1651896/version/1/file/2021-05-23_09-00_%D0%9C%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0+I.pdf първата изпитна сесия по Математика I] и [url https://www.uni-sofia.bg/index.php/bul/content/download/250730/1653146/version/1/file/2021-05-30_09-00_%D0%9C%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0+II.pdf втората изпитна сесия по Математика II] през 2021 година (ако някой от тях спре да работи, архивирани са на [url https://web.archive.org/ archive.org]). До всяка зала пише колко човека са разпределени за там, така че общата бройка е една проста сума. Най-много хора са се явили на първата сесися по Математика II: 593, на Математика I са 514 и на втората сесия по Математика II са 568. - -Моята генерация беше последната по старата програма на обучение[$mat-i-ii], така че при кандидатстване се вземаше една от оценките на изпитите Математика I или Математика II (като втория изпит допринася повече към бала). +Моята генерация беше последната по старата програма на обучение{fn Макар че това не е много добра причина за смяна на изпитването, понеже схемата с два такива изпита (единия стандартен и другия с малко задачи, но с пълни решения) си е държала още от времето на комунизма. Моето предположение за тази промяна, е че новата система е влошила качеството на обучение твърде много и искат минималните оценки за влизане се повишават обратно към околността на 6ца, но това вече са мои си конспирации.}, така че при кандидатстване се вземаше една от оценките на изпитите Математика I или Математика II (като втория изпит допринася повече към бала). Математика I беше сравнително стандартен, напомнящ на модерната "Математика" или матурата, обаче Математика II беше съвсем друго животно: там имаш 8 задачи, всяка с отворен отговор и изисквано решение. -Този изпит беше трудният и до голяма степен определящият, от максимум 593[$2021-kandidati] човека се рееха слухове че само 20тина са имали 6,00. - -'footnote 2021-mesta Този документ вече е лесно достъпен в [url https://www.uni-sofia.bg/index.php/bul/content/download/259611/1706172/version/1/file/%D0%9C%D0%B5%D1%81%D1%82%D0%B0+%D0%94%D0%9F.pdf сайта на СУ]. Също говоря за нормалните места по държавна субсидия: без платено обучение и българи, живеещи в чужбина. - -'footnote visoki-iziskvaniq Доколкото съм чувал, тази схема е била валидна до към 2014, поне за специалности като компютърни науки и софтуерно инженерство. Сякаш малко след това баловете на всичко започват яко да падат, ама такива статистики вече хептен ги няма публично. Единствената така информация имат кандидат-студенти, и то за своята година в която влизат, и не се познавам с достатъчно хора, за да разпитвам. +Този изпит беше трудният и до голяма степен определящият, от максимум 593{fn Такива статистики много не се намират публично и линковете не са сложени на достъпно място, но успях да изровя директните линкове към разпределението по зали за {url първа изпитна сесия по Математика II;https://www.uni-sofia.bg/index.php/bul/content/download/249347/1644279/version/1/file/2021-04-24_09-00_%D0%9C%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0+II.pdf}, {url първата изпитна сесия по Математика I;https://www.uni-sofia.bg/index.php/bul/content/download/250518/1651896/version/1/file/2021-05-23_09-00_%D0%9C%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0+I.pdf} и {url втората изпитна сесия по Математика II;https://www.uni-sofia.bg/index.php/bul/content/download/250730/1653146/version/1/file/2021-05-30_09-00_%D0%9C%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0+II.pdf} през 2021 година (ако някой от тях спре да работи, архивирани са на {url archive.org;https://web.archive.org/}). До всяка зала пише колко човека са разпределени за там, така че общата бройка е една проста сума. Най-много хора са се явили на първата сесися по Математика II: 593, на Математика I са 514 и на втората сесия по Математика II са 568.} човека се рееха слухове че само 20тина са имали 6,00. -Въпреки това, влизането във ФМИ беше лесно, общо имаше 525[$2021-mesta] места, предостатъчно, имайки предвид, че не всички явили се на тези изпити, кандидатстваха в компютърна специалност (оценката важи за физическия и стопанския факултет). +Въпреки това, влизането във ФМИ беше лесно, общо имаше 525{fn Този документ вече е лесно достъпен в {url сайта на СУ;https://www.uni-sofia.bg/index.php/bul/content/download/259611/1706172/version/1/file/%D0%9C%D0%B5%D1%81%D1%82%D0%B0+%D0%94%D0%9F.pdf}. Също говоря за нормалните места по държавна субсидия: без платено обучение и българи, живеещи в чужбина.} места, предостатъчно, имайки предвид, че не всички явили се на тези изпити, кандидатстваха в компютърна специалност (оценката важи за физическия и стопанския факултет). Вече за конкретни специалности беше малко по-трудно, 300 от тези места бяха в хубавите компютърни специалности, така че конкуренцията беше горе-долу двама човека за едно място. Също е добре да спомена, че баловете бяха супер ниски, в компютърни науки влязох с 4.70 (на Математика II) на първо класиране, на второ можеше и с 4.30 да вляза. -Конкретни стойности за баловете от тази година съм изкарал [url ./balove-2021.html тук]. -В Софтуерно инженерство бяха малко по-високи изискванията (а там бяха най-високи от компютърните специалности), ама пак, далеч от времето, когато с 5.40 е можело и да не влезеш[$visoki-iziskvaniq]. +Конкретни стойности за баловете от тази година съм изкарал {url тук;./balove-2021.html}. +В Софтуерно инженерство бяха малко по-високи изискванията (а там бяха най-високи от компютърните специалности), ама пак, далеч от времето, когато с 5.40 е можело и да не влезеш{fn Доколкото съм чувал, тази схема е била валидна до към 2014, поне за специалности като компютърни науки и софтуерно инженерство. Сякаш малко след това баловете на всичко започват яко да падат, ама такива статистики вече хептен ги няма публично. Единствената така информация имат кандидат-студенти, и то за своята година в която влизат, и не се познавам с достатъчно хора, за да разпитвам.}. -'footnote 2022-kandidati Както за 2021, пак трябваше да се ровя, но намерих разпределението по зали за [url https://www.uni-sofia.bg/index.php/bul/content/download/266692/1750342/version/1/file/2022-04-03_09-00_%D0%9C%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0.pdf единствената изпитна сесия по Математика] през 2022 (също архивирано в [url https://web.archive.org/ archive.org]). - -'footnote 2023-kandidati Както за 2021, пак имаше ровене, но намерих разпределението по зали за [url https://www.uni-sofia.bg/index.php/bul/content/download/285793/1865079/version/1/file/2023-04-02_09-00_%D0%9C%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0%E2%80%93%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5%D0%BD_%D0%BF%D1%80%D0%BE%D1%82%D0%BE%D0%BA%D0%BE%D0%BB.pdf първата изпитна сесия по Математика] и [url https://www.uni-sofia.bg/index.php/bul/content/download/290157/1891849/version/1/file/2023-06-11_09-00_%D0%9C%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0.pdf втората изпитна сесия по математика] (както винаги, налични в [url https://web.archive.org/ archive.org]). На първата са се явили 979 и 875 на втората. - -С новия изпит вече конкуренцията е малко по-висока, все пак са се явили 969[$2022-kandidati] ученици на Математика през 2022 и максимум 979[$2023-kandidati] през 2023. +С новия изпит вече конкуренцията е малко по-висока, все пак са се явили 969{fn Както за 2021, пак трябваше да се ровя, но намерих разпределението по зали за {url единствената изпитна сесия по Математика;https://www.uni-sofia.bg/index.php/bul/content/download/266692/1750342/version/1/file/2022-04-03_09-00_%D0%9C%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0.pdf} през 2022 (също архивирано в {url archive.org;https://web.archive.org/}).} ученици на Математика през 2022 и максимум 979{fn Както за 2021, пак имаше ровене, но намерих разпределението по зали за {url първата изпитна сесия по Математика;https://www.uni-sofia.bg/index.php/bul/content/download/285793/1865079/version/1/file/2023-04-02_09-00_%D0%9C%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0%E2%80%93%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5%D0%BD_%D0%BF%D1%80%D0%BE%D1%82%D0%BE%D0%BA%D0%BE%D0%BB.pdf} и {url втората изпитна сесия по математика;https://www.uni-sofia.bg/index.php/bul/content/download/290157/1891849/version/1/file/2023-06-11_09-00_%D0%9C%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0.pdf} (както винаги, налични в {url archive.org;https://web.archive.org/}). На първата са се явили 979 и 875 на втората.} през 2023. Местата са същия брой, така че излиза към примерно трима човека за едно място и ако примерно имаш 3ка или 4ка може и да не влезеш във ФМИ. -Обаче, [=най-важното: материалът във ФМИ не се е изменил!=] +Обаче, {b най-важното: материалът във ФМИ не се е изменил!} Макар и изпитът да е значително по-лесен, трудността на материала не се е снижила (или поне толкова, колкото изпита) и в същото време математиката се изучава доста. Тоест, един човек, влязъл с най-ниския бал на Математика ще е далеч по-неподготвен за ФМИ от човек с минимален бал на Математика II. -Затова [=препоръчвам всеки кандидат-студент да може да реши някоя Математика II за към 4-4.50!=] +Затова {b препоръчвам всеки кандидат-студент да може да реши някоя Математика II за към 4-4.50!} Това са горе-долу 5-6 от 8те задачи. Иначе ако не можеш редовно да учиш математика и не можеш да се справиш с такива задачи (които са по-прости като характер в сравнение с това, което учим в университета), следването ти ще бъде твърде трудно според мен. @@ -253,12 +237,10 @@ Оценката се формира по различни начини при различните предмети, но най-често контролните и домашните през семестъра носят 40-50% и през сесията си изкарваш останалата част от оценката. Също понякога, ако си се справил достатъчно добре на контролните през семестъра, може да бъдеш освободен от изпит-задачи (не е нужно да ходиш и като оценка на него ти се пише средно аритметично от контролните). -Обаче почти винаги [=ако изкараш двойка на някой от изпитите през сесията, цялата ти оценка за предмета става двойка!=] - -'footnote september Разговорно на поправителната сесия им викаме септември, макар и само един-два дена от нея да са в този месец. Причината е, че просто до преди няколко години наистина е била през септември, но са я изместили назад. Защо са я изместили, не знам. +Обаче почти винаги {b ако изкараш двойка на някой от изпитите през сесията, цялата ти оценка за предмета става двойка!} Когато не си минал един предмет, ти го "влачиш". -За всеки предмет имаш две дати през академичната година, през които може да го вземеш: редовната сесията след семестър (тоест когато по принцип се изпитват хора по този предмет) и поправителната сесия, която се случва във втората половина от август[$september]. +За всеки предмет имаш две дати през академичната година, през които може да го вземеш: редовната сесията след семестър (тоест когато по принцип се изпитват хора по този предмет) и поправителната сесия, която се случва във втората половина от август{fn Разговорно на поправителната сесия им викаме септември, макар и само един-два дена от нея да са в този месец. Причината е, че просто до преди няколко години наистина е била през септември, но са я изместили назад. Защо са я изместили, не знам.}. По принцип имаш и ликвидационна сесия, ама идеята е, ако два изпита през поправителната сесия ти се препокриват, през поправителната да отидеш на единия и на ликвидационната да може да отидеш на другия (трябва да подадеш документ, че това си направил, не можеш да отложиш изпити ей така). Можеш да преминеш към следващия курс без проблеми ако влачиш максимум 3 предмета от годината. @@ -282,7 +264,7 @@ Количеството подготовка за едно контролно зависи от човек на човек, но ако нищо не си учил, бих казал че е поне една-две интензивни седмици за сериозните предмети са достатъчни. За домашните е по-малко, защото по принцип те са върху неща, изучавани на упражнения, така че ако си си водел записки (или споделящи колеги са водели) ще знаеш как да решиш всички задачи (разбира се, има изключения). -Това обаче е [=само за контролни-задачи по някои предмети=], все пак имаш теория и имаш задачи за които ти трябва теория, и тя вече не може да се научи толкова бързо. +Това обаче е {b само за контролни-задачи по някои предмети}, все пак имаш теория и имаш задачи за които ти трябва теория, и тя вече не може да се научи толкова бързо. Нещо много хубаво е, че никой не следи за присъствие на занятия и не се пишат отсъствия както в училище. Разбира се, това не означава, че не е нужно да се ходи на всички занятия, напротив, но ако искаш винаги може да пропуснеш нещо. @@ -305,16 +287,16 @@ Обаче, си задължен и да ходиш на избираеми дисциплини: имаш минимален брой избираеми за всеки семестър, минимален общ брой за всичките години и минимален брой ECTS кредити за всичките години. За разлика от училище, имаш доста голям избор и много от тях са интересни и полезни. -Обаче, [=не записвай избираеми през първи курс!=] -Скоро ще обсъдим предметите, обаче [=първи курс е най-труден и изисква цялото ти работно време!=] -Това трябва да навежда на мисълта, че [=не трябва да работиш по време на първи курс=], освен ако не ти се налага или не си от най-умните хора в специалността. +Обаче, {b не записвай избираеми през първи курс!} +Скоро ще обсъдим предметите, обаче {b първи курс е най-труден и изисква цялото ти работно време!} +Това трябва да навежда на мисълта, че {b не трябва да работиш по време на първи курс}, освен ако не ти се налага или не си от най-умните хора в специалността. Материалът е нещо напълно ново, не само като изучавани неща, ами и като концепции и модел на учене. -Ама каквото и да си говорим, [=най-доброто обучение се намира в избираемите дисциплини!=] +Ама каквото и да си говорим, {b най-доброто обучение се намира в избираемите дисциплини!} Не е задължително да си доцент или професор, за да направиш избираема, и може да я направиш както си искаш. Има много такива, които се водят от бивши студенти на ФМИ, които сега работят в големи компании, и предоставят супер практично и готино обучение. -За някои неща даже не можеш да намериш в България курсове, като [url https://intranet.fmi.uni-sofia.bg/index.php/s/uGI4XDReO3WoUok Реализация на езици за програмиране], където се разглежда как се правят компилатори или [url https://intranet.fmi.uni-sofia.bg/index.php/s/v2v4WlP2GdDbWtb Употреба и скриптиране на Vim], където подробно поглежда един от най-добрите текстови редактори някога създавани. +За някои неща даже не можеш да намериш в България курсове, като {url Реализация на езици за програмиране;https://intranet.fmi.uni-sofia.bg/index.php/s/uGI4XDReO3WoUok}, където се разглежда как се правят компилатори или {url Употреба и скриптиране на Vim;https://intranet.fmi.uni-sofia.bg/index.php/s/v2v4WlP2GdDbWtb}, където подробно поглежда един от най-добрите текстови редактори някога създавани. ### Какво се учи в КН2 @@ -336,17 +318,13 @@ Твърденията са неща, които казваме че са верни за дадена конструкция, тоест за нещо, което си измислим (и което не противоречи на аксиомите). Конструкция е ключова дума, понеже сътворяваме с въображение някакъв обект, нещо с някакви свойства и после доказваме, чисто формално и прецизно със стриктно определени уреди, че дадения обект прави това, което искаме. -'footnote def-set Формално няма дефиниция на множество, понеже става малко бездънно: какво е множество, еми колекция от елементи, какво е колекция от елементи, еми съвкупност от елементи, какво е съвкупност, еми множество от елементи. Формално казваме, че множество е първично понятие, тоест че няма дефиниция и се надяваме, че читателя схваща за какво се говори. - -'footnote axiom-of-choice В интерес на истината, това със сигурност е вярно само когато приемаме [url https://en.wikipedia.org/wiki/Axiom_of_choice аксиомата за избора], ако не я приемем, тогава доооста неща стават супер неинтуитивни и изглеждат грешни, обаче чисто формално и математически са верни. - Трудно ми е да дам лесен пример, понеже нищо в училище не може и да се сравнява, но нека да пробваме следното: нека да разгледаме множества. -Множество е просто някаква колекция от елементи[$def-set], представи си кутия с някакви предмети в нея. +Множество е просто някаква колекция от елементи{fn Формално няма дефиниция на множество, понеже става малко бездънно: какво е множество, еми колекция от елементи, какво е колекция от елементи, еми съвкупност от елементи, какво е съвкупност, еми множество от елементи. Формално казваме, че множество е първично понятие, тоест че няма дефиниция и се надяваме, че читателя схваща за какво се говори.}, представи си кутия с някакви предмети в нея. Аз твърдя, че едно празно множество е елемент на друго празно множество, тоест че една празната кутия се съдържа в друга празна кутия. -Това е очевидно грешно[$axiom-of-choice], нашето доказателство е, че щом кутията е празна, то по дефиниция няма елементи, следователно няма как да има друга кутия в нея. +Това е очевидно грешно{fn В интерес на истината, това със сигурност е вярно само когато приемаме {url аксиомата за избора;https://en.wikipedia.org/wiki/Axiom_of_choice}, ако не я приемем, тогава доооста неща стават супер неинтуитивни и изглеждат грешни, обаче чисто формално и математически са верни.}, нашето доказателство е, че щом кутията е празна, то по дефиниция няма елементи, следователно няма как да има друга кутия в нея. Ето: конструкция, твърдение и доказателство, доста елементарно и очевидно, но все пак се опитвам да не навлизам в детайли, а и в математиката има такива резултати, които не са хич очевидни. -Също, доказателството, че нещо не е вярно може би изглежда безполезно, но някои от [url https://en.wikipedia.org/wiki/Fermat%27s_Last_Theorem най-големите теореми на математиката са формулиране така]. +Също, доказателството, че нещо не е вярно може би изглежда безполезно, но някои от {url най-големите теореми на математиката са формулиране така;https://en.wikipedia.org/wiki/Fermat%27s_Last_Theorem}. Сега вече ще обсъдим конкретно изучаваните предмети в детайл. @@ -357,7 +335,7 @@ ##### Зимен семестър -[=Алгебра 1=]: пълното име е линейна алгебра. +{b Алгебра 1}: пълното име е линейна алгебра. Занимава се главно с линейни уравнения (ax + by + ... + mz = k), обаче интересното идва като изследваме операции върху тях и ги навържем в пространства. Много фундаментален предмет, използват се поне части от него в много клони на математиката и инженерството (защото много неща могат да се моделират с нея). Има употреби в machine learning, в компютърната графика, в алгоритми за препоръки (търсачки примерно), обработка на изображения и много други. @@ -365,7 +343,7 @@ Има по една малка задача всяка седмица, но не са трудни, изисква постоянство. Предметът се минава без твърде много трудности, лекционните записки са много прецизно написани и упражненията са супер. -[=Диференциално и интегрално смятане 1=]: с други думи, реален анализ. +{b Диференциално и интегрално смятане 1}: с други думи, реален анализ. Главно разглеждаме свойства и операции върху функции и редици числа. В училище учим производни; глаголът да правиш производни разговорно може да се нарече "производиране", обаче терминът е диференциране. Интегрирането е обраното действие на диференцирането, тоест намирането на функция, имайки само нейната производна. @@ -376,7 +354,7 @@ Главната цедка е теорията, на която имаш теоретични задачи, при които дори за 3ка ще трябва да приложиш малко усет към предмета. Като цяло просто изискванията са високи, иначе екипа са готини и бих казал, че оценяването е честно. -[=Дискретни структури=]: този предмет е малко смесица от три предмета - булева алгебра, увод в теория на множествата, комбинаторика и теория на графите. +{b Дискретни структури}: този предмет е малко смесица от три предмета - булева алгебра, увод в теория на множествата, комбинаторика и теория на графите. От всичките математики, това е може би най-важната за програмиране. В определен смисъл на думата, ДИС се занимава с безкрайно много и безкрайно малки елементи: на една функция може да и подадеш числото 1, но и 1.1, и 1.11 и так. нат., без проблем. Обаче ДСТР разглежда дискретни обекти, тоест някакъв краен брой конкретни неща. @@ -397,7 +375,7 @@ Ама трябва да предупредя, че не получаваш точки за половинчати решения, като цяло или си решил задачата коректно или не. Бих казал че при този предмет се появяват нечестности или прекомерно високи изисквания на моменти, но се минава. -[=Увод в програмирането=], неговото значение трябва да е очевидно. +{b Увод в програмирането}, неговото значение трябва да е очевидно. Изучава се C++, макар и някои неща да не са направени по най-добрите начини. Налага се да знаеш и ползваш точно нещата, които ти се преподават и нищо друго. Не бих казал, че е лошо направен, има някакво основание за тази методика, обаче някои неща се разглеждат твърде формално и програмирането не се изучава като динамичен предмет, в който може да решиш проблеми по много начини, а като задача по математика, където се изисква определено решение. @@ -410,9 +388,9 @@ ##### Летен семестър -[=Диференциално и интегрално смятане 2=]: директно продължение на ДИС1. +{b Диференциално и интегрално смятане 2}: директно продължение на ДИС1. -[=Геометрия=]: истинското име на този предмет е аналитична геометрия и няма нищо общо с училищната евклидова геометрия. +{b Геометрия}: истинското име на този предмет е аналитична геометрия и няма нищо общо с училищната евклидова геометрия. Разглеждаме пространствата и геометричните обекти като по-абстрактни неща, или по-конкретно, разглеждаме повече числата и зависимостите между конкретни обекти. Централно в компютърната графика и всичко около нея (обработка на изображения, 3D моделиране, ...). @@ -420,18 +398,18 @@ Упражненията са супер, има и много добри записки по тях. Минава се без твърде много проблеми. -[=Езици, автомати и изчислимост=]: вторият най-важен предмет от математиките, на английски се казва Theoretical Computer Science. +{b Езици, автомати и изчислимост}: вторият най-важен предмет от математиките, на английски се казва Theoretical Computer Science. Занимава се с различни теоретични обекти, които могат да правят изчисления върху текстови низове. Всичко свързано с анализ или шаблони върху текст използва нещата тук, а пък и отвъд. Ако някога си чувал за машина на Тюринг, Тюринг-завършеност на програмни езици или проблемът за спирането, от тука идват. Благодарение на тази наука е възможно да имплементираш компилатори на програмни езици и да правиш всички форми на разбор на текст (като обработката на уебстраници и интернет пакети). -Записките са много добри, даже публично се намират, заедно с минали изпитни теми, [url http://logic.fmi.uni-sofia.bg/eai.html тук]. +Записките са много добри, даже публично се намират, заедно с минали изпитни теми, {url тук;http://logic.fmi.uni-sofia.bg/eai.html}. И както по дискретни структури, асистентите не са консистентни и нивото малко криви. Ама в края на деня преподавателите са готини и не искат да прецакват хора, така че се минава спокойно. -[=Обектно ориентирано програмиране=]: това е най-популярният начин/парадигма за програмиране. -Обект е групиране на данни с функциите върху тях, като са изпълнени [url https://en.wikipedia.org/wiki/Object-oriented_design#Object-oriented_concepts няколко свойства]. +{b Обектно ориентирано програмиране}: това е най-популярният начин/парадигма за програмиране. +Обект е групиране на данни с функциите върху тях, като са изпълнени {url няколко свойства;https://en.wikipedia.org/wiki/Object-oriented_design#Object-oriented_concepts}. Кажи-речи всяка компания и всеки модерен програмен език, който се използва в индустрията, поддържа ООП. Екипът е същия като при УП, така че общото ми мнение е същото, макар че при ООП ситуацията е може би една идея по-релаксирана. @@ -444,7 +422,7 @@ ##### Зимен семестър -[=Компютърни архитектури=]: описание на хардуера. +{b Компютърни архитектури}: описание на хардуера. Малко се доближава и до електротехниката, но се разглеждат много фундаменталните хардуерни компоненти и техните функционалности в един компютър. Разглеждаме основните компонентни схеми за изчисления и хардуерно как се ползват и работят нещата. Не е кой знае колко полезен за средния програмист, освен ако не се занимаваш със системно програмиране, ама е много важен фундамент. @@ -453,22 +431,22 @@ Това е първият предмет при който няма задължителни упражнения, но никой не препоръчва да се ходи на избираемия практикум, понеже не е координиран много добре с лекциите и някои неща стават твърде трудни. Иначе минаването е лесно. -[=Основи на компютърната графика=]: има ли изобщо какво да обяснявам. +{b Основи на компютърната графика}: има ли изобщо какво да обяснявам. Разглеждаме част от математиката, но повече се занимаваме с 3D моделиране и идеите на сложните неща, не толкова тяхното имплементиране. Минаването е лесно, трябва да си малко консистентен със седмичните задачи обаче. И този лектор ми е един от любимите. Презентациите в които се намира материала са перфектно направени и упражненията са много приятни. -Ето [url https://boytchev.github.io/scorm/ тук] има редици малки задачки/игри с които можеше да изкараш малък бонус към оценката. +Ето {url тук;https://boytchev.github.io/scorm/} има редици малки задачки/игри с които можеше да изкараш малък бонус към оценката. -[=Структури от данни и програмиране=]: нещо като въведение в дизайн и анализ на алгоритмите. +{b Структури от данни и програмиране}: нещо като въведение в дизайн и анализ на алгоритмите. Занимаваме се с някои много важни структури от данни, като стек и опашка, и разглеждаме алгоритми върху тях. Супер важно за всеки програмист. Екипът пак е същия, както при УП и ООП, така че мнението ми продължава, но тук поне изискванията за писане на код са по-основателни. Все пак разглеждаме конкретни структури от данни и алгоритми, ако не ги ползваш в решенията на задачи, малко би се обезсмислила цялата история. -[=Функционално програмиране=]: втората най-използвана парадигма след ООП. +{b Функционално програмиране}: втората най-използвана парадигма след ООП. Идеята е, че разглеждаме всичко като функции, във всеки момент една функция връща нещо или приема нещо и никъде не пазим състояния. Тоест, една стойност се намира или като аргумент или като върната стойност. Също супер важно да се знае и може. @@ -478,18 +456,18 @@ ##### Летен семестър -[=Алгебра 2=]: дефакто разглеждаме теория на групите, което на английски съм го виждал и като "Modern algebra". +{b Алгебра 2}: дефакто разглеждаме теория на групите, което на английски съм го виждал и като "Modern algebra". Група е някакво множество от елементи и операция върху тях, като за операцията са изпълнени няколко свойства. Допълнително имаме и пръстен, където вече имаш множество и две операции върху тях. -Може би звучи странно, но е една от [url https://www.youtube.com/watch?v=mH0oCDa74tE най-интересните и шантави математики]. +Може би звучи странно, но е една от {url най-интересните и шантави математики;https://www.youtube.com/watch?v=mH0oCDa74tE}. Криптографията се основава на нея и има употреби в теория на графите. Екипът същия като при Алгебра 1, така че нямам оплаквания. Макар че този път няма седмични задачи - ура! -[=Дизайн и анализ на алгоритми=]: също едно име, което обяснява себе си. +{b Дизайн и анализ на алгоритми}: също едно име, което обяснява себе си. Разглеждаме методиките за сравняване на алгоритми (асимптотика) и как да докажем тяхната коректност. -Също разглеждаме доста основни и често използвани алгоритми, както и се допираме до [url https://en.wikipedia.org/wiki/NP_%28complexity%29 NP сложност]. +Също разглеждаме доста основни и често използвани алгоритми, както и се допираме до {url NP сложност;https://en.wikipedia.org/wiki/NP_%28complexity%29}. Още един много важен предмет. Тук сякаш асистентите преподават по-добре и нивото е по-изравнено. @@ -497,7 +475,7 @@ Обаче смятам, че на доста моменти навлиза твърде много в математиката и теорията, и има същите проблеми с оценяването както по ДСТР. Цели 15 човека минаха от първия път, така че нивото е горе-долу същото. -[=Изследване на операциите=]: решава оптимизационни задачи, тоест задачи при които искаш минимум или максимум, като за всяка променлива имаш някакво ограничение (на английски се казва Linear Programming, но няма нищо общо с програмиране). +{b Изследване на операциите}: решава оптимизационни задачи, тоест задачи при които искаш минимум или максимум, като за всяка променлива имаш някакво ограничение (на английски се казва Linear Programming, но няма нищо общо с програмиране). Една оптимизационна задача е примерно ако имаме фабрики за автомобили, всяка произвеждаща различно количество коли и складове в други градове, с различни капацитети, и имаме цената на пътя между градовете и складовете, как най-евтно ще пренесем всички автомобили в складовете. Има употреба ако се опитваш да решиш такъв тип задачи, но ми се струва от по-безполезните неща за един програмист. @@ -505,7 +483,7 @@ Лекторът е готин. Минаването е лесно, нещата не са супер трудни. -[=Компютърни мрежи=]: пак име, което само се обяснява. +{b Компютърни мрежи}: пак име, което само се обяснява. Абсолютно всичко свързано с интернет и мрежите, от протоколи до методи за маршрутизация. Като КАРХ не е от най-полезните за ежедневието, но е много важен фундамент. @@ -513,7 +491,7 @@ Както и по други предмети, лектора не иска да ни прецаква, затова минаването не е проблем. Даже бих казал, че е твърде лесно. -[=Операционни системи=]: може би най-важният не-математически предмет, ако беше направен свестно. +{b Операционни системи}: може би най-важният не-математически предмет, ако беше направен свестно. Имам много силно мнение за него, като цяло предмета се свежда до 70% менижиране на процеси, 20% менижиране на памет и 10% случайни неща. Имаше потенциалът да е от най-добрите предмети в целия бакалавър, ама програмата и изпитването беше наистина зле направено. @@ -527,7 +505,7 @@ Не бих казал, че се учат стари неща, които не са актуални, но за най-новите технологии трябва да се обърнеш към избираеми. Обучението е далеч от перфектно, обаче каквото и да си говорим, обучението никъде не е перфектно. -Бих казал, че качеството на курсове също [url https://kleopetrov.me/2017/01/31/return-return-and-how-to-breack-it/ може да бъде много по-ниско]. +Бих казал, че качеството на курсове също {url може да бъде много по-ниско;https://kleopetrov.me/2017/01/31/return-return-and-how-to-breack-it/}. Това е много голяма тема, обаче въпреки че не учим най-новите и използваемите неща, основите с които излизаш ти позволяват да научиш новите технологии значително по-бързо и в значително по-голяма дълбочина. Колкото и да не се харесва, математиката е в основата на всички кътчета от компютрите. Разбира се, има пре-достатъчно работа, която не изисква и елементарно събиране да знаеш, но ако се стремиш нагоре, математиката е нужна. @@ -539,4 +517,6 @@ 2. Студентстването като изживяване е веднъж в живота, все пак характерът става по-издържлив когато те скъсат по няколко изпита, за които си учил много. 3. Каквото и да си говорим, ФМИ е доста авторитетно учебно заведение, макар и диплома за един програмист да не е задължителна, със сигурност ще помогне значително. -И даже бих аргументирал, че е [=по-добре да следваш една година във ФМИ и да се откажеш, отколкото да следваш 4 години и да завършиш в който и да е друг университет!=] +И даже бих аргументирал, че е {b по-добре да следваш една година във ФМИ и да се откажеш, отколкото да следваш 4 години и да завършиш в който и да е друг университет!} + +{footnotes} diff --git a/src/blog/friendship-ended-with-funtoo-now-gentoo-is-my-best-friend/index.du b/src/blog/friendship-ended-with-funtoo-now-gentoo-is-my-best-friend/index.du index 1c6d67b..a4cd802 100644 --- a/src/blog/friendship-ended-with-funtoo-now-gentoo-is-my-best-friend/index.du +++ b/src/blog/friendship-ended-with-funtoo-now-gentoo-is-my-best-friend/index.du @@ -1,21 +1,21 @@ -# Friendship ended with Funtoo, now Gentoo is my best friend +'def title Friendship ended with Funtoo, now Gentoo is my best friend +'def desc Explaining why I switched from Funtoo to Gentoo as my main OS -'define expected-reading 11 min -'define created 28 May 2023 -'define edited 07 June 2023 -[$pagenav] +# {title} + +{pagenav 11 min;28 May 2023;07 June 2023} .contents .numbered -1. [url #terminology Terminology] -2. [url #public-enemy-no-1-packages Public Enemy No 1: Packages] -3. [url #i-didnt-follow-the-wolf-pack-philosophy I didn't follow the wolf pack philosophy] -4. [url #why-did-i-choose-funtoo-in-the-first-place Why did I choose Funtoo in the first place?] +1. {uhref Terminology} +2. {uhref Public Enemy No 1: Packages} +3. {uhref I didn't follow the wolf pack philosophy} +4. {uhref Why did I choose Funtoo in the first place?} .numbered - 1. [url #debunking-benefits Debunking benefits] - 2. [url #personal-advantages-over-gentoo Personal advantages over Gentoo] + 1. {uhref Debunking benefits} + 2. {uhref Personal advantages over Gentoo} -Around 6 months ago I wrote [url /blog/taming-the-fun-too Taming The Fun-too], a blog post sharing my personal experiences with the Funtoo linux distribution. +Around 6 months ago I wrote {url Taming The Fun-too;/blog/taming-the-fun-too}, a blog post sharing my personal experiences with the Funtoo linux distribution. What you don't know is that less than a month later, at the end of December, I installed Gentoo on my desktop computer, and an additional 3 months later my laptop followed. Here is what happened. @@ -24,19 +24,19 @@ Here is what happened. Before we begin, I want to take a second and explain some Gentoo/Funtoo terminology: :unordered -- [`emerge`] (as a verb): what does "install" mean? I would argue it means copying a program and the file it depends on somewhere on a system, with the goal of being able to run this program. +- {` emerge} (as a verb): what does "install" mean? I would argue it means copying a program and the file it depends on somewhere on a system, with the goal of being able to run this program. .p Now, in Gentoo and Funtoo, most programs are compiled from source code, so before you install you download it's source and compile. - For this reason, on such systems you would usually say a certain program/package is [*being emerged, not installed*] (and the words comes from the [url https://wiki.gentoo.org/wiki/Emerge package-manager command-line utility of the same name]). + For this reason, on such systems you would usually say a certain program/package is {i being emerged, not installed} (and the words comes from the {url package-manager command-line utility of the same name;https://wiki.gentoo.org/wiki/Emerge}). -- [`ebuild`] (file): the exact steps needed to emerge a package differ from one project to another, but how do you manage packages then? +- {` ebuild} (file): the exact steps needed to emerge a package differ from one project to another, but how do you manage packages then? The solution is that when you try to emerge something, a special file with detailed instructions is looked up: an ebuild file. - repository tree: the collection of all ebuilds -- [`use`] flags: every program can be built with different flags (aka options), which enable or disable certain features from being available in the result package. - For example, the text editor [url https://packages.gentoo.org/packages/app-editors/vim vim] supports sound, but not everyone would want to have that feature. +- {` use} flags: every program can be built with different flags (aka options), which enable or disable certain features from being available in the result package. + For example, the text editor {url vim;https://packages.gentoo.org/packages/app-editors/vim} supports sound, but not everyone would want to have that feature. ## Public Enemy No 1: Packages @@ -47,41 +47,41 @@ Most packages and their dependencies on Funtoo go unmaintained and untested for 'footnote required-3.8 Required might be a strong word, I don't remember if I tried (though I'm sure I did) just downgrading the Python version in the ebuild. Nevertheless, there were for sure useful packages which really did need it. -Python was stuck at version 3.7, while a lot of packages like barrier, libplacebo, mpv and pulseeffects[$packages-in-repo-tree] required[$required-3.8] at least 3.8. +Python was stuck at version 3.7, while a lot of packages like barrier, libplacebo, mpv and pulseeffects{packages-in-repo-tree} required{required-3.8} at least 3.8. So, with a lot of effort and poking around, I got python 3.8 to work, just barely. -What's even better is that eventually I reached an [=unfixable=] circular python dependency (between dev-python/packaging and dev-python/setuptools). +What's even better is that eventually I reached an {b unfixable} circular python dependency (between dev-python/packaging and dev-python/setuptools). -'footnote glibc This point may not be completely fair, since Funtoo has a system for [url https://web.archive.org/web/20230528115518/https://projects.funtoo.org/metatools/docs/autogen.html ebuild generation], which means that they might've made configuration changes and/or applied patches which "fix" that version, but still, it really isn't a good look. +'footnote glibc This point may not be completely fair, since Funtoo has a system for {url ebuild generation;https://web.archive.org/web/20230528115518/https://projects.funtoo.org/metatools/docs/autogen.html}, which means that they might've made configuration changes and/or applied patches which "fix" that version, but still, it really isn't a good look. -Another problem child was glibc, it is [*currently*] at [url https://github.com/funtoo/core-kit/tree/1.4-release/sys-libs/glibc version 2.33-r2], which under Gentoo [url https://gitweb.gentoo.org/repo/gentoo.git/tree/profiles/package.mask#n542 is officially masked and discouraged for usage][$glibc] and wouldn't you know it, also prevents some packages from being compiled (mainly I remember ungoogled-chromium). +Another problem child was glibc, it is {i currently} at {url version 2.33-r2;https://github.com/funtoo/core-kit/tree/1.4-release/sys-libs/glibc}, which under Gentoo {url is officially masked and discouraged for usage;https://gitweb.gentoo.org/repo/gentoo.git/tree/profiles/package.mask#n542}{glibc} and wouldn't you know it, also prevents some packages from being compiled (mainly I remember ungoogled-chromium). There were a lot more problematic packages, but I've forgotten most details. What I do remember is that the day I decided to hop to Gentoo, I tried to update my system and yet again I got some sort of issue, either a package couldn't compile properly or there was some dependency conflict. That was preceded by my unsuccessful attempts at getting the kicad package to work a couple of days prior. At that point, this had become completely normal. -[=But=] Funtoo shouldn't be blamed for it! +{b But} Funtoo shouldn't be blamed for it! ## I didn't follow the wolf pack philosophy -On the [url https://www.funtoo.org/Welcome Welcome] page of Funtoo's website, in the second paragraph, we are linked the [url https://www.funtoo.org/Wolf_Pack_Philosophy Wolf Pack Philosophy] page. +On the {url Welcome;https://www.funtoo.org/Welcome} page of Funtoo's website, in the second paragraph, we are linked the {url Wolf Pack Philosophy;https://www.funtoo.org/Wolf_Pack_Philosophy} page. This is essentially a document describing how a member of the community should behave, and I didn't follow it. Any member of the pack is supposed to: .unordered -- [=Be Mindful of the Pack=] by tackling challenges with the community\n +- {b Be Mindful of the Pack} by tackling challenges with the community\n but as I found (package) challenges, I tackled them on my own, not trying to consult anyone or ask for help -- [=Be Interconnected=] by supporting and being supported by the community\n +- {b Be Interconnected} by supporting and being supported by the community\n but I didn't connect with anyone on my issues -- [=Howl=] by expressing their needs and sharing their "adventures"\n +- {b Howl} by expressing their needs and sharing their "adventures"\n but I didn't express them and didn't share the work I've done Or more simply put, Funtoo is a small project, and you need to communicate with others to get things done. -'footnote kicad On that aforementioned kicad package, drobbins, the benevolent dictator for life of Funtoo, categorized it as a [url https://bugs.funtoo.org/browse/FL-8435?focusedId=52907&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-52907 package which people aren't interested in]. +'footnote kicad On that aforementioned kicad package, drobbins, the benevolent dictator for life of Funtoo, categorized it as a {url package which people aren't interested in;https://bugs.funtoo.org/browse/FL-8435?focusedId=52907&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-52907}. -Another way to look at it is that in a project of this scale, what gets supported is what the community uses, so in a way, I was trying to use Funtoo in the [*wrong*] way. +Another way to look at it is that in a project of this scale, what gets supported is what the community uses, so in a way, I was trying to use Funtoo in the {i wrong} way. This may sound ridiculous, but then again, they aren't making a project which "just works" for everyone (like Ubuntu or Linux Mint), this is a project by the community for the community. -You can't expect them to support everything that a big-scale distro does, like Gentoo, with a fraction of the manpower, so if nobody supports a package (which exists in the repository tree) that doesn't work and you don't at least speak up, it will probably stay broken[$kicad] (this kind of relates to the [=Is Territorial=] point in the philosophy). +You can't expect them to support everything that a big-scale distro does, like Gentoo, with a fraction of the manpower, so if nobody supports a package (which exists in the repository tree) that doesn't work and you don't at least speak up, it will probably stay broken{kicad} (this kind of relates to the {b Is Territorial} point in the philosophy). However, in my defense, I didn't open bug reports or create forum posts because my issues weren't "directly" related to Funtoo, or a normal Funtoo installation. Most of the time I would have an issue with a package, then get it's Gentoo counterpart, try to get all dependencies working one by one, and it will fail with some unsearchable error. @@ -102,12 +102,12 @@ Looking at these with the benefit of hindsight: .quote git > rsync By default, on Gentoo synchronization of ebuild files is done via rsync, while on Funtoo it's done with git. -Gentoo has actually supported git synchronization for quite a while, and [url https://wiki.gentoo.org/wiki/Portage_with_Git the setup is easy], so in the modern day it's really a matter of preference. -Though, [url https://lwn.net/Articles/759578/ rsync is probably better with bad internet connections]. +Gentoo has actually supported git synchronization for quite a while, and {url the setup is easy;https://wiki.gentoo.org/wiki/Portage_with_Git}, so in the modern day it's really a matter of preference. +Though, {url rsync is probably better with bad internet connections;https://lwn.net/Articles/759578/}. .quote profiles (flavors and mix-ins) -Funtoo has a system called [url https://www.funtoo.org/Funtoo_Profiles profiles]. +Funtoo has a system called {url profiles;https://www.funtoo.org/Funtoo_Profiles}. The idea is that you can group a whole set of packages and use flags into one name with the ability to turn them off and on again. So, if you want to install gnome on your system, you don't have to worry about flags and potential dependency problems, just use the gnome mix-in and everything will be ready to go for emerging. @@ -115,19 +115,19 @@ This is pretty cool but it's also somewhat unnecessary. You would save time on your very first install ever, but once you've set your flags on one machine, you'll just need to copy some files over (make.conf and package.use) and be done with it. There is a case to be made for people who often emerge and unmerge packages, but they are very much a minority (which I'm not a part of). -.quote Funtoo has [url https://wiki.gentoo.org/wiki/Stage_tarball stage 3 tarballs] with already setup DEs +.quote Funtoo has {url stage 3 tarballs;https://wiki.gentoo.org/wiki/Stage_tarball} with already setup DEs This means that on a Funtoo system, you could directly unpack the tarball (the initial prebuilt binaries), and without emerging anything, have a ready-to-go desktop environment. The huge benefit is that you can very quickly reboot into your "install" (after setting up the booting of course), and use your computer with the comfort of a graphical environment while everything else is being emerged. -Again, this is really cool, but at the end of the day, a normal "text-only" installation isn't very difficult, the [url https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation Gentoo handbook] is very detailed and well written, you install a system once so in the long term it wouldn't matter and I personally use a custom desktop environment setup, so those DEs would be bloat. +Again, this is really cool, but at the end of the day, a normal "text-only" installation isn't very difficult, the {url Gentoo handbook;https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation} is very detailed and well written, you install a system once so in the long term it wouldn't matter and I personally use a custom desktop environment setup, so those DEs would be bloat. .quote fixed release model -[url https://forums.funtoo.org/topic/1945-funtoo-release-model/#comment-9321 Funtoo releases fixed version of their distro], which means, in theory, packages will be way more stable and tested than normally. +{url Funtoo releases fixed version of their distro;https://forums.funtoo.org/topic/1945-funtoo-release-model/#comment-9321}, which means, in theory, packages will be way more stable and tested than normally. I've never found problems with packages being "too new", and this is more relevant to how the packages are managed by the maintainers, so it doesn't make that much of a difference to the end user, in my opinion. -.quote [url https://www.funtoo.org/Autogen autogens] +.quote {url autogens;https://www.funtoo.org/Autogen} Rather than making ebuilds manually, on Funtoo you can automatically generate them with simple Python code. This system probably reduces management time quite a lot, especially for a smaller team of maintainers, but you would still need to understand ebuild files. @@ -146,8 +146,8 @@ Unfortunately, for Gentoo it's the opposite effect, I couldn't compile most pack .quote package.use > make.conf -There is a big emphasis on writing your use flags in a separate [`/etc/portage/package.use`] file (or make it a folder and add use flags in different subfiles), and to try and change [`/etc/portage/make.conf`] as little as possible. -I generally believe this is a significantly better system than stuffing everything into [`make.conf`], and it isn't pushed that hard on Gentoo. +There is a big emphasis on writing your use flags in a separate {` /etc/portage/package.use} file (or make it a folder and add use flags in different subfiles), and to try and change {` /etc/portage/make.conf} as little as possible. +I generally believe this is a significantly better system than stuffing everything into {` make.conf}, and it isn't pushed that hard on Gentoo. That said, Gentoo still supports it, so I'm not missing out, but I probably wouldn't have used it. diff --git a/src/blog/gns3-initsh-no-such-file/index.du b/src/blog/gns3-initsh-no-such-file/index.du index 2b6f908..fdd666e 100644 --- a/src/blog/gns3-initsh-no-such-file/index.du +++ b/src/blog/gns3-initsh-no-such-file/index.du @@ -1,12 +1,12 @@ -# Fix "exec /gns3/init.sh: no such file or directory" +'def title Fix 'exec /gns3/init.sh: no such file or directory' +'def desc This problem occurs on new installations, the solution is to make GNS3 use Debian's busybox implementation. -'define expected-reading 1 min -'define created 14 June 2023 -'define edited 14 June 2023 -[$pagenav] +# {title} + +{pagenav 1 min;14 June 2023;14 June 2023} This problem can easily occur on new installations and can be hard to figure out. -In a [url https://github.com/GNS3/gns3-server/issues/2069#issuecomment-1296741195 GitHub issue], the solution that fixed it for me was using Debian's busybox: +In a {url GitHub issue;https://github.com/GNS3/gns3-server/issues/2069#issuecomment-1296741195}, the solution that fixed it for me was using Debian's busybox: :ordered 0. Get into a temporary folder diff --git a/src/blog/how-to-encrypt-email/index.du b/src/blog/how-to-encrypt-email/index.du index ec9d546..13b49a5 100644 --- a/src/blog/how-to-encrypt-email/index.du +++ b/src/blog/how-to-encrypt-email/index.du @@ -1,70 +1,70 @@ -# How to encrypt email +'def title How to encrypt email +'def desc For PGP add keys in your client. For S/MIME another article is linked. Also contains a comparison of a lot of mail clients. -'define expected-reading 5 min -'define created 16 September 2022 -'define edited 16 November 2022 -[$pagenav] +# {title} + +{pagenav 5 min;16 September 2022;16 November 2022} :contents :numbered -1. [url #getting-keys Getting keys] +1. {uhref Getting keys} :numbered - 1. [url #pgp PGP] + 1. {uhref PGP} .numbered - 1. [url #pgptool.org pgptool.org] - 2. [url #gnu-privacy-guard GNU Privacy Guard] + 1. {uhref pgptool.org} + 2. {uhref GNU Privacy Guard} - 2. [url #smime S/MIME] + 2. {uhref S/MIME} -2. [url #exchanging-keys Exchanging keys] -3. [url #configuring-clients Configuring clients] +2. {uhref Exchanging keys} +3. {uhref Configuring clients} -In [url /blog/encrypted-email this] blog post I shared the most common technologies for email encryption and a bit of how they work. PGP and S/MIME are the most popular schemes, with support from a lot of clients. +In {url this;/blog/encrypted-email} blog post I shared the most common technologies for email encryption and a bit of how they work. PGP and S/MIME are the most popular schemes, with support from a lot of clients. These are all the steps required to go from having no encryption, to encrypting all of your future emails. ## Getting keys -PGP and S/MIME are both built upon [url https://en.wikipedia.org/wiki/Public-key_cryptography public-key cryptography] so you and all of your recipients need to have a pair of public and private keys. +PGP and S/MIME are both built upon {url public-key cryptography;https://en.wikipedia.org/wiki/Public-key_cryptography} so you and all of your recipients need to have a pair of public and private keys. ### PGP -As [url /blog/encrypted-email/#pgp discussed], PGP relies on a [url https://en.wikipedia.org/wiki/Web_of_trust web of trust], meaning you can generate your keys by yourself. +As {url discussed;/blog/encrypted-email/#pgp}, PGP relies on a {url web of trust;https://en.wikipedia.org/wiki/Web_of_trust}, meaning you can generate your keys by yourself. #### pgptool.org -By far, the easiest way to do this is via the website [url https://pgptool.org/ pgptool.org]. Just open the link, fill out your details, select the recommended values (select never as your expiration time) and wait a couple minutes. After they are done, you can click the two red buttons to download your public and private keys. +By far, the easiest way to do this is via the website {url pgptool.org;https://pgptool.org/}. Just open the link, fill out your details, select the recommended values (select never as your expiration time) and wait a couple minutes. After they are done, you can click the two red buttons to download your public and private keys. #### GNU Privacy Guard -As an alternative, you can use a desktop program. The most popular one is [url https://www.gnupg.org/ GNU Privacy Guard] (GPG for short). It is [url https://gnupg.org/download/#binary available] on most desktop operating systems, including [url https://gpg4win.org/download.html Windows] and [url https://gpgtools.org/ MacOS]. +As an alternative, you can use a desktop program. The most popular one is {url GNU Privacy Guard;https://www.gnupg.org/} (GPG for short). It is {url available;https://gnupg.org/download/#binary} on most desktop operating systems, including {url Windows;https://gpg4win.org/download.html} and {url MacOS;https://gpgtools.org/}. -The [*Windows*] version comes with a graphical user interface, so it's easiest to use that: +The {i Windows} version comes with a graphical user interface, so it's easiest to use that: :ordered 1. Open the application "Kleopatra" -2. Click on [`File`] -> [`New Certificate`] +2. Click on {` File} -> {` New Certificate} -3. Input your details and press [`OK`] +3. Input your details and press {` OK} .bulleted - - Feel free to click on [`Advanced Settings`] and look if if the value for [`RSA`] is [`4096 bit`], the value for [`+ RSA`] is enabled and is [`4096 bits`], and finally both [`Signing`] and [`Authentication`] are selected + - Feel free to click on {` Advanced Settings} and look if if the value for {` RSA} is {` 4096 bit}, the value for {` + RSA} is enabled and is {` 4096 bits}, and finally both {` Signing} and {` Authentication} are selected -4. On the next screen, press [`Create`] +4. On the next screen, press {` Create} 5. You'll be asked for a password. Make one up, and enter it, but do not forget it! .bulleted - - The password is used for your private key. If anyone gets ahold if it, they [=will=] be able to impersonate you. A password makes sure that doesn't happen, at least until you tell everyone that your key was leaked. + - The password is used for your private key. If anyone gets ahold if it, they {b will} be able to impersonate you. A password makes sure that doesn't happen, at least until you tell everyone that your key was leaked. -6. On the final screen, click [`Finish`] +6. On the final screen, click {` Finish} -7. To help with the next chapter, we'll extract your public key. In "Kleopatra" you should see a line, containing your name and email. Right-click on it, and select [`Export Certificate`]. +7. To help with the next chapter, we'll extract your public key. In "Kleopatra" you should see a line, containing your name and email. Right-click on it, and select {` Export Certificate}. -On [*Linux*] and [*MacOS*], you can use the command line: +On {i Linux} and {i MacOS}, you can use the command line: :ordered 1. Enter this command in your favorite terminal @@ -72,7 +72,7 @@ On [*Linux*] and [*MacOS*], you can use the command line: ```bash gpg --full-generate-key -2. Follow the prompt on the screen (sample pictures available in [url https://www.encryptionconsulting.com/how-to-generate-pgp-key-pair/ encryptionconsulting.com]) +2. Follow the prompt on the screen (sample pictures available in {url encryptionconsulting.com;https://www.encryptionconsulting.com/how-to-generate-pgp-key-pair/}) 3. Export your public key (of course, change me@email.com and the location to the one you want, but don't forget the .asc extension) @@ -82,15 +82,15 @@ gpg --armor --export me@email.com > ~/Documents/me-email.com-publickey.asc ### S/MIME -Contrary to PGP, S/MIME relies on a certificate authority, meaning you'll have to buy your keys from someone. Any provider from [url https://support.google.com/a/answer/7448393?hl=en&ref_topic=9061730 Google]'s list of trusted CAs will work. +Contrary to PGP, S/MIME relies on a certificate authority, meaning you'll have to buy your keys from someone. Any provider from {url Google;https://support.google.com/a/answer/7448393?hl=en&ref_topic=9061730}'s list of trusted CAs will work. -Currently, the only one that provides free certificates is [url https://www.actalis.com/s-mime-certificates.aspx Actalis]. Their process is pretty straight forward, just follow the instructions (shown in [url https://www.dannyguo.com/blog/how-to-get-a-free-s-mime-certificate/ this] article). +Currently, the only one that provides free certificates is {url Actalis;https://www.actalis.com/s-mime-certificates.aspx}. Their process is pretty straight forward, just follow the instructions (shown in {url this;https://www.dannyguo.com/blog/how-to-get-a-free-s-mime-certificate/} article). ## Exchanging keys You should now have a text file with your public key in it. When you want to send an encrypted email to someone, ask them for their public key, and meanwhile send them your public key. It doesn't matter how you do that, even if it's with unencrypted emails. -Remember, [=never=] send your [=private=] key to anyone! +Remember, {b never} send your {b private} key to anyone! ## Configuring clients @@ -98,13 +98,14 @@ Now we need to configure your email application to automatically encrypt and dec When writing a message, don't forget to check if encryption is turned on for this email! On most clients, in the compose window, you'll have to select an option to enable encryption, but others do that automatically. -[*Freemium means it has a free and a paid tier. Premium means you have to pay for it. FOSS means it's free and open source. FreemiumOSS means it is free and open source, but also has paid tiers.*] +{i Freemium means it has a free and a paid tier. Premium means you have to pay for it. FOSS means it's free and open source. FreemiumOSS means it is free and open source, but also has paid tiers.} -:table_6 -'define 1 [^[url #1 1]^] -'define 2 [^[url #2 2]^] -'define 3 [^[url #3 3]^] -'define * [^[url #* *]^] +:table +:6 +'def 1 {^ {url 1;#1}} +'def 2 {^ {url 2;#2}} +'def 3 {^ {url 3;#3}} +'def * {^ {url *;#*}} |= Client |= Type @@ -123,23 +124,23 @@ When writing a message, don't forget to check if encryption is turned on for thi |: Gmail |: Freemium |: Web -|: [url https://flowcrypt.com/ Yes][$1] -|: [url https://flowcrypt.com/ Yes][$1] -|: [url https://support.google.com/a/answer/6374496?hl=en&ref_topic=9061730 Yes][$2] +|: {url Yes;https://flowcrypt.com/}{1} +|: {url Yes;https://flowcrypt.com/}{1} +|: {url Yes;https://support.google.com/a/answer/6374496?hl=en&ref_topic=9061730}{2} |: Outlook |: Freemium |: Web |: No |: No -|: [url https:://support.microsoft.com/en-us/office/encrypt-email-messages-373339cb-bf1a-4509-b296-802a39d801dc#bkmk_encryptwithsmime Yes][$2] +|: {url Yes;https:://support.microsoft.com/en-us/office/encrypt-email-messages-373339cb-bf1a-4509-b296-802a39d801dc#bkmk_encryptwithsmime}{2} |: iCloud mail |: Freemium |: Web -|: [url https://support.apple.com/en-us/HT201214 Yes] -|: [url https://support.apple.com/en-us/HT201214 Yes] -|: [url https://support.apple.com/en-us/HT202345 Yes] +|: {url Yes;https://support.apple.com/en-us/HT201214} +|: {url Yes;https://support.apple.com/en-us/HT201214} +|: {url Yes;https://support.apple.com/en-us/HT202345} |: Yahoo! |: Freemium @@ -151,22 +152,22 @@ When writing a message, don't forget to check if encryption is turned on for thi |: Protonmail |: Freemium |: Web -|: [url https://proton.me/support/how-to-use-pgp Yes] -|: [url https://proton.me/support/how-to-use-pgp Yes] +|: {url Yes;https://proton.me/support/how-to-use-pgp} +|: {url Yes;https://proton.me/support/how-to-use-pgp} |: No |: Roundcube |: Self-hosted |: Web -|: [url https://github.com/roundcube/roundcubemail/tree/master/plugins/enigma Yes][$1] -|: [url https://github.com/roundcube/roundcubemail/tree/master/plugins/enigma Yes][$1] -|: [url https://github.com/roundcube/roundcubemail/issues/4977 No] +|: {url Yes;https://github.com/roundcube/roundcubemail/tree/master/plugins/enigma}{1} +|: {url Yes;https://github.com/roundcube/roundcubemail/tree/master/plugins/enigma}{1} +|: {url No;https://github.com/roundcube/roundcubemail/issues/4977} |: Rainloop |: Self-hosted |: Web |: Yes -|: [url https://github.com/RainLoop/rainloop-webmail/issues/1798 No] +|: {url No;https://github.com/RainLoop/rainloop-webmail/issues/1798} |: No |= Desktop @@ -179,44 +180,44 @@ When writing a message, don't forget to check if encryption is turned on for thi |: Thunderbird |: FOSS |: Windows, MacOS, Linux -|: [url https://support.mozilla.org/en-US/kb/openpgp-thunderbird-howto-and-faq#w_i-have-never-used-openpgp-with-thunderbird-before-how-do-i-setup-openpgp Yes] -|: [url https://support.mozilla.org/en-US/kb/openpgp-thunderbird-howto-and-faq#w_i-have-never-used-openpgp-with-thunderbird-before-how-do-i-setup-openpgp Yes] -|: [url https://support.mozilla.org/en-US/kb/openpgp-thunderbird-howto-and-faq Yes] +|: {url Yes;https://support.mozilla.org/en-US/kb/openpgp-thunderbird-howto-and-faq#w_i-have-never-used-openpgp-with-thunderbird-before-how-do-i-setup-openpgp} +|: {url Yes;https://support.mozilla.org/en-US/kb/openpgp-thunderbird-howto-and-faq#w_i-have-never-used-openpgp-with-thunderbird-before-how-do-i-setup-openpgp} +|: {url Yes;https://support.mozilla.org/en-US/kb/openpgp-thunderbird-howto-and-faq} |: Outlook |: Premium |: Windows, MacOS |: No |: No -|: [url https://support.microsoft.com/en-us/office/encrypt-email-messages-373339cb-bf1a-4509-b296-802a39d801dc#bkmk_encryptwithsmime Yes] +|: {url Yes;https://support.microsoft.com/en-us/office/encrypt-email-messages-373339cb-bf1a-4509-b296-802a39d801dc#bkmk_encryptwithsmime} |: Mailbird |: Premium |: Windows -|: [url https://mailbird.featureupvote.com/suggestions/74494/pgp-encryption-support No] -|: [url https://mailbird.featureupvote.com/suggestions/74494/pgp-encryption-support No] -|: [url https://mailbird.featureupvote.com/suggestions/160861/smime-support No] +|: {url No;https://mailbird.featureupvote.com/suggestions/74494/pgp-encryption-support} +|: {url No;https://mailbird.featureupvote.com/suggestions/74494/pgp-encryption-support} +|: {url No;https://mailbird.featureupvote.com/suggestions/160861/smime-support} |: Evolution |: FOSS |: Linux -|: [url https://help.gnome.org/users/evolution/stable/mail-encryption-gpg-set-up.html.en Yes] -|: [url https://help.gnome.org/users/evolution/stable/mail-encryption-gpg-set-up.html.en Yes] -|: [url https://help.gnome.org/users/evolution/stable/mail-encryption-s-mime-manage.html.en Yes] +|: {url Yes;https://help.gnome.org/users/evolution/stable/mail-encryption-gpg-set-up.html.en} +|: {url Yes;https://help.gnome.org/users/evolution/stable/mail-encryption-gpg-set-up.html.en} +|: {url Yes;https://help.gnome.org/users/evolution/stable/mail-encryption-s-mime-manage.html.en} |: Sylpheed |: FOSS |: Windows, MacOS, Linux -|: [url https://sylpheed.sraoss.jp/doc/manual/en/sylpheed-8.html#ss8.2 Yes] -|: [url https://sylpheed.sraoss.jp/doc/manual/en/sylpheed-8.html#ss8.2 Yes] -|: [url https://www.sraoss.jp/pipermail/sylpheed/2011-May/004551.html No] +|: {url Yes;https://sylpheed.sraoss.jp/doc/manual/en/sylpheed-8.html#ss8.2} +|: {url Yes;https://sylpheed.sraoss.jp/doc/manual/en/sylpheed-8.html#ss8.2} +|: {url No;https://www.sraoss.jp/pipermail/sylpheed/2011-May/004551.html} |: Claws-mail |: FOSS |: Windows, Linux -|: [url https://claws-mail.org/plugin.:php?plugin=gpg Yes][$1] -|: [url https://claws-mail.org/plugin.php?plugin=gpg Yes][$1] -|: [url https://claws-mail.org/plugins.php Yes][$1] +|: {url Yes;https://claws-mail.org/plugin.:php?plugin=gpg}{1} +|: {url Yes;https://claws-mail.org/plugin.php?plugin=gpg}{1} +|: {url Yes;https://claws-mail.org/plugins.php}{1} |= Mobile |: @@ -230,14 +231,14 @@ When writing a message, don't forget to check if encryption is turned on for thi |: Android, iOS |: No |: No -|: Yes[$3] +|: Yes{3} |: Outlook |: Free |: Android, iOS |: No |: No -|: Yes[$3] +|: Yes{3} |: Apple Mail |: Free @@ -263,26 +264,30 @@ When writing a message, don't forget to check if encryption is turned on for thi |: Protonmail |: Free |: Android, iOS -|: [url https://proton.me/support/how-to-use-pgp Yes] -|: [url https://proton.me/support/how-to-use-pgp Yes] +|: {url Yes;https://proton.me/support/how-to-use-pgp} +|: {url Yes;https://proton.me/support/how-to-use-pgp} |: No |: K-9 Mail |: FOSS |: Android -|: [url https://docs.k9mail.app/en/current/security/pgp/ Yes] -|: [url https://docs.k9mail.app/en/current/security/pgp/ Yes] -|: [url https://docs.k9mail.app/en/current/security/overview/#end-to-end-encryption No] +|: {url Yes;https://docs.k9mail.app/en/current/security/pgp/} +|: {url Yes;https://docs.k9mail.app/en/current/security/pgp/} +|: {url No;https://docs.k9mail.app/en/current/security/overview/#end-to-end-encryption} |: FairEmail |: FreemiumOSS |: Android -|: [url https://github.com/M66B/FairEmail/blob/master/FAQ.md Yes] -|: [url https://github.com/M66B/FairEmail/blob/master/FAQ.md Yes] -|: [url https://github.com/M66B/FairEmail/blob/master/FAQ.md Yes][$*] +|: {url Yes;https://github.com/M66B/FairEmail/blob/master/FAQ.md} +|: {url Yes;https://github.com/M66B/FairEmail/blob/master/FAQ.md} +|: {url Yes;https://github.com/M66B/FairEmail/blob/master/FAQ.md}{*} + -<span id="1">[^1^]</span> Available with an extension/plugin\n -<span id="2">[^2^]</span> Available in a paid version of the software (assuming the software is Freemium; this is true for all Premium software)\n -<span id="3">[^3^]</span> Available with a Premium account (even if the software is Free)\n -<span id="*">[^*^]</span> You can read S/MIME messages, but signing and encrypting is a pro feature +<span id="1">{^ 1}</span> Available with an extension/plugin\n +<span id="2">{^ 2}</span> Available in a paid version of the software (assuming the software is Freemium; this is true for all Premium software)\n +<span id="3">{^ 3}</span> Available with a Premium account (even if the software is Free)\n +<span id="*">{^ *}</span> You can read S/MIME messages, but signing and encrypting is a pro feature +'def 1 +'def 2 +'def 3 diff --git a/src/blog/how-to-use-jira/bug.du b/src/blog/how-to-use-jira/bug.du index d776367..3b29ef3 100644 --- a/src/blog/how-to-use-jira/bug.du +++ b/src/blog/how-to-use-jira/bug.du @@ -1,21 +1,18 @@ -# Bug tracking template - How to use Jira +'def title Bug tracking template - How to use Jira +'def desc The bug tracking template offers only issue tracking, no boards, no cards, no backlog. -'define expected-reading 1 min -'define created 24 July 2020 -'define edited 16 September 2020 -[$pagenav] +# {title} -'define start_link ./ -'define prev_link ./scrum.html Scrum template -'define next_link ./releases.html Releases -[$pagination_middle] +{pagenav 1 min;24 July 2020;edited 16 September 2020} -The Bug Tracking template is completely different from the [url ./scrum.html Scrum] and [url ./kanban.html Kanban] templates, because it [=offers only issue tracking=]. +{pagination ./;Scrum template;./scrum.html;Releases;./releases.html} -[=There are no boards, no cards, no backlog=]. All issues are accessed from the [`Issues`] page from the sidebar. +The Bug Tracking template is completely different from the {url Scrum;./scrum.html} and {url Kanban;./kanban.html} templates, because it {b offers only issue tracking}. -[image ./img/issues-sidebar.png] +{b There are no boards, no cards, no backlog}. All issues are accessed from the {` Issues} page from the sidebar. -That's why this template is [=available only when creating a project=]. +{img ./img/issues-sidebar.png} -Of course, [=you can add boards at any time=], but this project template doesn't add any by itself. +That's why this template is {b available only when creating a project}. + +Of course, {b you can add boards at any time}, but this project template doesn't add any by itself. diff --git a/src/blog/how-to-use-jira/cards.du b/src/blog/how-to-use-jira/cards.du index 8a5f1b7..a2bcb1d 100644 --- a/src/blog/how-to-use-jira/cards.du +++ b/src/blog/how-to-use-jira/cards.du @@ -1,161 +1,158 @@ -# Cards - How to use Jira +'def title Cards - How to use Jira +'def desc Each issue is represented as an object with properties. More specifically, these objects are called 'cards'. -'define expected-reading 4 min -'define created 24 July 2020 -'define edited 03 June 2021 -[$pagenav] +# {title} -'define start_link ./ -'define prev_link ./filters.html Filters -'define next_link ./projects.html Projects -[$pagination_middle] +{pagenav 4 min;24 July 2020;03 June 2021} + +{pagination ./;Filters;./filters.html;Projects;./projects.html} .contents .numbered -1. [url #properties Properties] -2. [url #creating Creating] -3. [url #viewing Viewing] -4. [url #how-to-use How to use] +1. {uhref Properties} +2. {uhref Creating} +3. {uhref Viewing} +4. {uhref How to use} .numbered - 1. [url #right-side Right side] - 2. [url #work-log Work log] - 3. [url #issue-flagging Issue flagging] - 4. [url #basic-issue-information Basic issue information] + 1. {uhref Right side} + 2. {uhref Work log} + 3. {uhref Issue flagging} + 4. {uhref Basic issue information} -[=Each issue is represented as an object with properties=]. More specifically, these objects are called 'cards'. +{b Each issue is represented as an object with properties}. More specifically, these objects are called 'cards'. -[image ./img/kanban-cards.png] +{img ./img/kanban-cards.png} ## Properties Each card has the following properties: -[image ./img/fields-cards.png] +{img ./img/fields-cards.png} :unordered -- [=Project=] - the [url ./projects.html project] this card is stored in +- {b Project} - the {url project;./projects.html} this card is stored in - [image ./img/project-create-card.png] + {img ./img/project-create-card.png} -- [=Issue type=] - the basic purpose of an issue (Improvement, Bug, ...) +- {b Issue type} - the basic purpose of an issue (Improvement, Bug, ...) - [image ./img/issue-types.png] + {img ./img/issue-types.png} :bulleted - - [image ./img/story-type.png Story] - functionality or feature expressed as a goal, something like "As a user, I want to be able to pay for my order via PayPal" + - {img Story;./img/story-type.png} - functionality or feature expressed as a goal, something like "As a user, I want to be able to pay for my order via PayPal" - - [image ./img/bug-type.png Bug] - a problem/error + - {img Bug;./img/bug-type.png} - a problem/error - - [image ./img/epic-type.png Epic] - a collection of issues, issues are linked through 'Epic link' (see below) + - {img Epic;./img/epic-type.png} - a collection of issues, issues are linked through 'Epic link' (see below) - - [image ./img/task-type.png Task] - a small piece of work + - {img Task;./img/task-type.png} - a small piece of work - - [image ./img/sub-task-type.png Sub-task] - an issue that is directly connected to another issue. This is used for when a given issue needs to be broken down into separate even smaller issues. + - {img Sub-task;./img/sub-task-type.png} - an issue that is directly connected to another issue. This is used for when a given issue needs to be broken down into separate even smaller issues. -- [=Summary=] - a (required) brief explanation of the issue +- {b Summary} - a (required) brief explanation of the issue - [image ./img/summary-create-card.png] + {img ./img/summary-create-card.png} -- [=Description=] - detailed explanation of the issue +- {b Description} - detailed explanation of the issue - [image ./img/description-create-card.png] + {img ./img/description-create-card.png} -- [=Reporter=] - person who created the issue +- {b Reporter} - person who created the issue - [image ./img/reporter-create-card.png] + {img ./img/reporter-create-card.png} -- [=Assignee=] - person who will work on the issue +- {b Assignee} - person who will work on the issue - [image ./img/assignee-create-card.png] + {img ./img/assignee-create-card.png} -- [=Labels=] - tags with which you can organise even more the issue +- {b Labels} - tags with which you can organise even more the issue - [image ./img/label-create-card.png] + {img ./img/label-create-card.png} -- [=Epic link=] - link of issue with type Epic +- {b Epic link} - link of issue with type Epic - [image ./img/epic-link-create-card.png] + {img ./img/epic-link-create-card.png} ## Creating -To create a card yourself, you need to [=press the [`Create`] button on the top bar=]. +To create a card yourself, you need to {b press the {` Create} button on the top bar}. -[image ./img/create-header.png] +{img ./img/create-header.png} ## Viewing -[=All=] cards (issues) can be viewed from a [url ./projects.html project]'s side menu, under 'Issues'. +{b All} cards (issues) can be viewed from a {url project;./projects.html}'s side menu, under 'Issues'. -[image ./img/issues-sidebar.png] +{img ./img/issues-sidebar.png} -Of course, they can also be viewed through [=[url ./filters.html filters]=] and a [=[url ./projects.html project]'s board=]. +Of course, they can also be viewed through {b {url filters;./filters.html}} and a {b {url project;./projects.html}'s board}. ## How to use -By default, opening a card presents, at the top, it's [=key=] (think of it as an ID), +By default, opening a card presents, at the top, it's {b key} (think of it as an ID), -[image ./img/card-key.png] +{img ./img/card-key.png} -it's [=summary=] below it, +it's {b summary} below it, -[image ./img/card-summary.png] +{img ./img/card-summary.png} -options for adding [=attachments=], [=subtasks=], [=linking issues=] and [=adding more apps=] (think of apps like extensions), +options for adding {b attachments}, {b subtasks}, {b linking issues} and {b adding more apps} (think of apps like extensions), -[image ./img/card-attach-subtask.png] +{img ./img/card-attach-subtask.png} -following are the [=description=], [=actual attachments=], [=subtasks=], [=linked issues=], etc., +following are the {b description}, {b actual attachments}, {b subtasks}, {b linked issues}, etc., -[image ./img/desc-att-sub-link.png] +{img ./img/desc-att-sub-link.png} -and at the bottom you have the [=activity=], consisting of [=comments=] on the issue, +and at the bottom you have the {b activity}, consisting of {b comments} on the issue, -[image ./img/activity-comments.png] +{img ./img/activity-comments.png} -[=history=] of things that have happened to that issue, +{b history} of things that have happened to that issue, -[image ./img/activity-history.png] +{img ./img/activity-history.png} -and [=work logs=] (a bit later we talk about them in more detail). +and {b work logs} (a bit later we talk about them in more detail). -[image ./img/activity-work-log.png] +{img ./img/activity-work-log.png} ### Right side -To the right side, you have all of the different [=properties=] (some fields without a value will be hidden). +To the right side, you have all of the different {b properties} (some fields without a value will be hidden). -[image ./img/card-right-side.png] +{img ./img/card-right-side.png} -On the top right you can change [=watch options=] ([url https://www.idalko.com/jira-watch-issues/ watching an issue] means you get notified by all changes done to it), you can [=share=] the card and do [=actions=] (the three dots). +On the top right you can change {b watch options} ({url watching an issue;https://www.idalko.com/jira-watch-issues/} means you get notified by all changes done to it), you can {b share} the card and do {b actions} (the three dots). -[image ./img/card-top-right.png] +{img ./img/card-top-right.png} -[=Actions=] are things you can do to the whole card, like moving or deleting it. +{b Actions} are things you can do to the whole card, like moving or deleting it. -[image ./img/card-actions.png] +{img ./img/card-actions.png} -The most notable options are [`[url https://confluence.atlassian.com/jirasoftwarecloud/logging-work-on-issues-902499028.html Log work]`] and [`Add flag`]. +The most notable options are {` {url Log work;https://confluence.atlassian.com/jirasoftwarecloud/logging-work-on-issues-902499028.html}} and {` Add flag}. ### Work log -In Jira, you can [=estimate how long an issue will take for it to be resolved=]. This is done through [=logging work=]. +In Jira, you can {b estimate how long an issue will take for it to be resolved}. This is done through {b logging work}. -In the [`Log work`] screen, you'll be met with a [`Time spent`] and [`Time remaining`] fields, that you'll need to fill with the appropriate information. +In the {` Log work} screen, you'll be met with a {` Time spent} and {` Time remaining} fields, that you'll need to fill with the appropriate information. -[image ./img/time-tracking.png] +{img ./img/time-tracking.png} -The time remaining takes a [=default=] value from the [=previous time log=], so you don't need to specify it every time. +The time remaining takes a {b default} value from the {b previous time log}, so you don't need to specify it every time. ### Issue flagging -A [=flagged issue=] is an issue that is very important. Flagged issues are displayed in yellow to signify their needed attention. +A {b flagged issue} is an issue that is very important. Flagged issues are displayed in yellow to signify their needed attention. -[image ./img/flagged-card.png] +{img ./img/flagged-card.png} ### Basic issue information -On the bottom right you can see [=when the issue was created=] and [=when it was last updated=]. You can also access the field configuration menu from the [`Configure`] button. It won't be covered in this tutorial, you can read about it [url https://confluence.atlassian.com/adminjiracloud/changing-a-field-configuration-844500798.html here]. +On the bottom right you can see {b when the issue was created} and {b when it was last updated}. You can also access the field configuration menu from the {` Configure} button. It won't be covered in this tutorial, you can read about it {url here;https://confluence.atlassian.com/adminjiracloud/changing-a-field-configuration-844500798.html}. -[image ./img/time-and-configure.png] +{img ./img/time-and-configure.png} diff --git a/src/blog/how-to-use-jira/components.du b/src/blog/how-to-use-jira/components.du index 5f22167..71c77f4 100644 --- a/src/blog/how-to-use-jira/components.du +++ b/src/blog/how-to-use-jira/components.du @@ -1,50 +1,47 @@ -# Components - How to use Jira +'def title Components - How to use Jira +'def desc Components are yet another way to group issues together. They don't have any specific meaning like versions, their usage depends on the project's organisation. -'define expected-reading 2 min -'define created 24 July 2020 -'define edited 03 June 2021 -[$pagenav] +# {title} -'define start_link ./ -'define prev_link ./pages.html Pages -'define next_link ./dashboards.html Dashboards -[$pagination_middle] +{pagenav 2 min;24 July 2020;03 June 2021} + +{pagination ./;Pages;./pages.html;Dashboards;./dashboards.html} .contents .numbered -1. [url #creating-and-editing Creating and editing] -2. [url #adding-issues Adding issues] +1. {uhref Creating and editing} +2. {uhref Adding issues} -Components are [=yet another way to group issues together=]. They don't have any specific meaning like versions, their usage depends on the project's organisation. +Components are {b yet another way to group issues together}. They don't have any specific meaning like versions, their usage depends on the project's organisation. ## Creating and editing -Creating and editing them is done from the [=[`Components`] menu in the sidebar=]. +Creating and editing them is done from the {b {` Components} menu in the sidebar}. -[image ./img/components-sidebar.png] +{img ./img/components-sidebar.png} -Creating one is done through the button on the top right (in the center if you don't have any components) by the name of [`Create component`]. +Creating one is done through the button on the top right (in the center if you don't have any components) by the name of {` Create component}. -[image ./img/create-component-empty.png] +{img ./img/create-component-empty.png} -[image ./img/create-component-full.png] +{img ./img/create-component-full.png} Clicking on it presents you with a screen where you input it's information. -[image ./img/create-component-page.png] +{img ./img/create-component-page.png} -[=A name is the only requirement=]. You can also add a [=description=], [=a lead(er) for the component=] and [=person who gets assigned to an issue by default=]. +{b A name is the only requirement}. You can also add a {b description}, {b a lead(er) for the component} and {b person who gets assigned to an issue by default}. ## Adding issues -Adding an issue to a component can be done either [=when creating it=] or [=when viewing it=]. +Adding an issue to a component can be done either {b when creating it} or {b when viewing it}. -[=Right under the summary=], there is a place for indicating a component, named [`Components`]. +{b Right under the summary}, there is a place for indicating a component, named {` Components}. -[image ./img/components-create-card.png] +{img ./img/components-create-card.png} -When viewing an issue, you can add one from the [`Components`] field to the right (you might need to first click on [`Show more fields`]). +When viewing an issue, you can add one from the {` Components} field to the right (you might need to first click on {` Show more fields}). -[image ./img/show-fields.png] +{img ./img/show-fields.png} -[image ./img/components-field.png] +{img ./img/components-field.png} diff --git a/src/blog/how-to-use-jira/dashboards.du b/src/blog/how-to-use-jira/dashboards.du index ddac024..d91a373 100644 --- a/src/blog/how-to-use-jira/dashboards.du +++ b/src/blog/how-to-use-jira/dashboards.du @@ -1,65 +1,63 @@ -# Dashboards - How to use Jira +'def title Dashboards - How to use Jira +'def desc Dashboards are a place where you can view a lot of information. -'define expected-reading 2 min -'define created 24 July 2020 -'define edited 03 June 2021 -[$pagenav] +# {title} -'define start_link ./ -'define prev_link ./components.html Components -[$pagination_end] +{pagenav 2 min;24 July 2020;03 June 2021} + +{pagination ./;Components;./components.html} .contents .numbered -1. [url #adding-a-dashboard Adding a dashboard] -2. [url #adding-gadgets Adding gadgets] +1. {uhref Adding a dashboard} +2. {uhref Adding gadgets} -Dashboards are a [=place where you can view a lot of information=]. +Dashboards are a {b place where you can view a lot of information}. -[image ./img/default-dashboard.png] +{img ./img/default-dashboard.png} -Dashboards are composed of [=gadgets=]. +Dashboards are composed of {b gadgets}. -[image ./img/gadgets.png] +{img ./img/gadgets.png} -Gadgets have functionality for [=displaying certain information=], like [`Average Age Chart`] or [`Issues in progress`]. Each gadget can be setup to [=take information from one or more projects and/or saved filters=]. +Gadgets have functionality for {b displaying certain information}, like {` Average Age Chart} or {` Issues in progress}. Each gadget can be setup to {b take information from one or more projects and/or saved filters}. ## Adding a dashboard -Dashboard can be added from the top bar, under [`Create dashboard`] in the [`Dashboards`] menu +Dashboard can be added from the top bar, under {` Create dashboard} in the {` Dashboards} menu -[image ./img/create-dashboard-top.png] +{img ./img/create-dashboard-top.png} -or, if you are already in a dashboard, from [`Create dashboard`] in the three dots menu. +or, if you are already in a dashboard, from {` Create dashboard} in the three dots menu. -[image ./img/create-dashboard-dots.png] +{img ./img/create-dashboard-dots.png} ## Adding gadgets -[=Note=]: you cannot add gadgets to the default dashboard. +{b Note}: you cannot add gadgets to the default dashboard. -You can add gadgets either [=through the [`Add gadget`] button in the top right=] +You can add gadgets either {b through the {` Add gadget} button in the top right} -[image ./img/add-gadget-top.png] +{img ./img/add-gadget-top.png} -or, [=if you don't have any gadets=], [=from the [`add a new gadget`] message(s)=]. +or, {b if you don't have any gadets}, {b from the {` add a new gadget} message(s)}. -[image ./img/add-a-gadget.png] +{img ./img/add-a-gadget.png} -After that, you are greeted by a window that [=shows all of the avalable ones=] (you might need to [=press [`Load all gadgets`]=]). +After that, you are greeted by a window that {b shows all of the avalable ones} (you might need to {b press {` Load all gadgets}}). -[image ./img/load-all.png] +{img ./img/load-all.png} -[image ./img/add-gadget.png] +{img ./img/add-gadget.png} -Adding a gadget is as simple as clicking the button [`Add gadget`] next to the name of the gadget you want to add. +Adding a gadget is as simple as clicking the button {` Add gadget} next to the name of the gadget you want to add. -[image ./img/introduction-add.png] +{img ./img/introduction-add.png} -After it is added, you'll [=need to configure it=], usually a gadget [=requires atleast a filter/project=]. +After it is added, you'll {b need to configure it}, usually a gadget {b requires atleast a filter/project}. -[image ./img/bubble.png] +{img ./img/bubble.png} -Options for different gadgets can be found on [=their top right corner, in the three dots menu=]. +Options for different gadgets can be found on {b their top right corner, in the three dots menu}. -[image ./img/bubble-dots.png] +{img ./img/bubble-dots.png} diff --git a/src/blog/how-to-use-jira/filters.du b/src/blog/how-to-use-jira/filters.du index f66b78c..484e121 100644 --- a/src/blog/how-to-use-jira/filters.du +++ b/src/blog/how-to-use-jira/filters.du @@ -1,44 +1,42 @@ -# Filters - How to use Jira +'def title Filters - How to use Jira +'def desc Filters work like an advanced issue search that you can save. With filters you filter issues from chosen project(s) by their properties. -'define expected-reading 1 min -'define created 24 July 2020 -'define edited 03 June 2021 -[$pagenav] +# {title} -'define prev_link ./ Introduction -'define next_link ./cards.html Cards -[$pagination_second] +{pagenav 1 min;24 July 2020;03 June 2021} + +{pagination ;Introduction;./;Cards;./cards.html} .contents .numbered -1. [url #criteria Criteria] -2. [url #jql JQL] +1. {uhref Criteria} +2. {uhref JQL} -[=Filters work like an advanced issue search that you can save=]. With filters you filter issues from chosen project(s) by their properties (status, type, start date, etc.). +{b Filters work like an advanced issue search that you can save}. With filters you filter issues from chosen project(s) by their properties (status, type, start date, etc.). -Making filters is done through the [`Advanced issue search`] page, from the [`Filters`] menu. +Making filters is done through the {` Advanced issue search} page, from the {` Filters} menu. -[image ./img/filters-advanced-issue-search.png] +{img ./img/filters-advanced-issue-search.png} ## Criteria -From here you can see some criteria: [`Project`], [`Type`], [`Status`], [`Assignee`]. +From here you can see some criteria: {` Project}, {` Type}, {` Status}, {` Assignee}. -[image ./img/criteria-advanced-issue-search.png] +{img ./img/criteria-advanced-issue-search.png} -Clicking on the criteria will reveal what options you can choose for it. Access to more criteria can be obtained via the [`+ More`] menu. +Clicking on the criteria will reveal what options you can choose for it. Access to more criteria can be obtained via the {` + More} menu. -[image ./img/plus-more-advanced-issue-search.png] +{img ./img/plus-more-advanced-issue-search.png} -After configuring your desired options, you can [=save the filter=] and use it later. To do so, simply click on [`Save as`] and enter a name for it. +After configuring your desired options, you can {b save the filter} and use it later. To do so, simply click on {` Save as} and enter a name for it. -[image ./img/save-as-advanced-issue-search.png] -[image ./img/save-filter-filters-advanced-issue-search.png] +{img ./img/save-as-advanced-issue-search.png} +{img ./img/save-filter-filters-advanced-issue-search.png} -You can view all of your filters from the conveniently named [`View all filters`] option in the [`Filters`] menu. +You can view all of your filters from the conveniently named {` View all filters} option in the {` Filters} menu. -[image ./img/view-all-filters-advanced-issue-search.png] +{img ./img/view-all-filters-advanced-issue-search.png} ## JQL -You can do [=more advanced search=] through [`JQL`] (Jira Query Language), but we won't be covering this topic. I can recommend [url https://www.atlassian.com/blog/jira-software/jql-the-most-flexible-way-to-search-jira-14 this article] on the subject. +You can do {b more advanced search} through {` JQL} (Jira Query Language), but we won't be covering this topic. I can recommend {url this article;https://www.atlassian.com/blog/jira-software/jql-the-most-flexible-way-to-search-jira-14} on the subject. diff --git a/src/blog/how-to-use-jira/index.du b/src/blog/how-to-use-jira/index.du index 9ea578d..879c817 100644 --- a/src/blog/how-to-use-jira/index.du +++ b/src/blog/how-to-use-jira/index.du @@ -1,75 +1,74 @@ -# Introduction - How to use Jira +'def title Introduction - How to use Jira +'def desc Jira is one of the most used project management and issue tracking products out there. It has a lot of features and can be overwhelming to newcomers. -'define expected-reading 19 min -'define created 24 July 2020 -'define edited 03 June 2021 -[$pagenav] +# {title} -'define next_link ./filters.html Filters -[$pagination_start] +{pagenav 19 min;24 July 2020;03 June 2021} + +{pagination ;;;Filters;./filters.html} :contents :numbered -1. [url ./filters.html Filters] +1. {url Filters;./filters.html} .numbered - 1. [url ./filters.html#criteria Criteria] - 2. [url ./filters.html#jql JQL] + 1. {url Criteria;./filters.html#criteria} + 2. {url JQL;./filters.html#jql} -2. [url ./cards.html Cards] +2. {url Cards;./cards.html} .numbered - 1. [url ./cards.html#properties Properties] - 2. [url ./cards.html#creating Creating] - 3. [url ./cards.html#viewing Viewing] - 4. [url ./cards.html#how-to-use How to use] + 1. {url Properties;./cards.html#properties} + 2. {url Creating;./cards.html#creating} + 3. {url Viewing;./cards.html#viewing} + 4. {url How to use;./cards.html#how-to-use} .numbered - 1. [url ./cards.html#right-side Right side] - 2. [url ./cards.html#work-log Work log] - 3. [url ./cards.html#issue-flagging Issue flagging] - 4. [url ./cards.html#basic-issue-information Basic issue information] + 1. {url Right side;./cards.html#right-side} + 2. {url Work log;./cards.html#work-log} + 3. {url Issue flagging;./cards.html#issue-flagging} + 4. {url Basic issue information;./cards.html#basic-issue-information} -3. [url ./projects.html Projects] +3. {url Projects;./projects.html} :numbered - 1. [url ./projects.html#creating-a-project Creating a project] - 2. [url ./projects.html#boards Boards] + 1. {url Creating a project;./projects.html#creating-a-project} + 2. {url Boards;./projects.html#boards} .numbered - 1. [url ./projects.html#columns Columns] - 2. [url ./projects.html#adding-more-boards-to-a-project Adding more boards to a project] + 1. {url Columns;./projects.html#columns} + 2. {url Adding more boards to a project;./projects.html#adding-more-boards-to-a-project} - 3. [url ./projects.html#backlog Backlog] - 4. [url ./projects.html#add-item Add item] + 3. {url Backlog;./projects.html#backlog} + 4. {url Add item;./projects.html#add-item} -4. [url ./kanban.html Kanban template] +4. {url Kanban template;./kanban.html} .numbered - 1. [url ./kanban.html#create-board Create board] - 2. [url ./kanban.html#backlog Backlog] + 1. {url Create board;./kanban.html#create-board} + 2. {url Backlog;./kanban.html#backlog} -5. [url ./scrum.html Scrum template] +5. {url Scrum template;./scrum.html} .numbered - 1. [url ./scrum.html#backlog Backlog] - 2. [url ./scrum.html#boards-and-issues Boards and Issues] - 3. [url ./scrum.html#create-board Create board] + 1. {url Backlog;./scrum.html#backlog} + 2. {url Boards and Issues;./scrum.html#boards-and-issues} + 3. {url Create board;./scrum.html#create-board} -6. [url ./bug.html Bug tracking template] +6. {url Bug tracking template;./bug.html} -7. [url ./releases.html Releases] +7. {url Releases;./releases.html} -8. [url ./pages.html Pages] +8. {url Pages;./pages.html} -9. [url ./components.html Components] +9. {url Components;./components.html} .numbered - 1. [url ./components.html#creating-and-editing Creating and editing] - 2. [url ./components.html#adding-issues Adding issues] + 1. {url Creating and editing;./components.html#creating-and-editing} + 2. {url Adding issues;./components.html#adding-issues} -10. [url ./dashboards.html Dashboards] +10. {url Dashboards;./dashboards.html} .numbered - 1. [url ./dashboards.html#adding-a-dashboard Adding a dashboard] - 2. [url ./dashboards.html#adding-gadgets Adding gadgets] + 1. {url Adding a dashboard;./dashboards.html#adding-a-dashboard} + 2. {url Adding gadgets;./dashboards.html#adding-gadgets} -[url https://www.atlassian.com/software/jira Jira] is one of the most used project management and issue tracking products out there. +{url Jira;https://www.atlassian.com/software/jira} is one of the most used project management and issue tracking products out there. It has a lot of features that can be quite overwhelming for new comers, especially these who are new to project management software. That's why I'm writing this tutorial. -[=Note=]: certain actions can be done only from a project administrator +{b Note}: certain actions can be done only from a project administrator diff --git a/src/blog/how-to-use-jira/kanban.du b/src/blog/how-to-use-jira/kanban.du index 0a6e707..215641b 100644 --- a/src/blog/how-to-use-jira/kanban.du +++ b/src/blog/how-to-use-jira/kanban.du @@ -1,38 +1,35 @@ -# Kanban template - How to use Jira +'def title Kanban template - How to use Jira +'def desc Kanban is a way for visually organising work items (issues). Kanban consists of columns and cards, where cards are the work items and are moved from column to column. -'define expected-reading 1 min -'define created 24 July 2020 -'define edited 03 June 2021 -[$pagenav] +# {title} -'define start_link ./ -'define prev_link ./projects.html Projects -'define next_link ./scrum.html Scrum template -[$pagination_middle] +{pagenav 1 min;24 July 2020;03 June 2021} + +{pagination ./;Projects;./projects.html;Scrum template;./scrum.html} .contents .numbered -1. [url #create-board Create board] -2. [url #backlog Backlog] +1. {uhref Create board} +2. {uhref Backlog} -Kanban is a [=way for visually organising work items=] (issues in our case). Kanban consists of [=columns=] and [=cards=], where cards are the work items and are [=moved from one column to another=] depending on the situation. This should sound [=familiar=], because that is how [url ./projects.md Boards] work. +Kanban is a {b way for visually organising work items} (issues in our case). Kanban consists of {b columns} and {b cards}, where cards are the work items and are {b moved from one column to another} depending on the situation. This should sound {b familiar}, because that is how {url Boards;./projects.md} work. In a projects that uses the kanban template, boards can access directly all of the available issues. -This tutorial focuses on the basics, but you can find a lot of information in [url https://www.atlassian.com/agile/kanban these sets of articles] from Atlassian. +This tutorial focuses on the basics, but you can find a lot of information in {url these sets of articles;https://www.atlassian.com/agile/kanban} from Atlassian. ## Create board -This template can be chosen when [=creating a project=] +This template can be chosen when {b creating a project} -[image ./img/choose-classic-template.png] +{img ./img/choose-classic-template.png} -and [=from the [`Create board`] screen=]. +and {b from the {` Create board} screen}. -[image ./img/scrum-kanban-board.png] +{img ./img/scrum-kanban-board.png} ## Backlog -In kanban, [=the backlog is just another column in your board(s)=]. It can be removed entirely. +In kanban, {b the backlog is just another column in your board(s)}. It can be removed entirely. -[image ./img/backlog-kanban.png] +{img ./img/backlog-kanban.png} diff --git a/src/blog/how-to-use-jira/pages.du b/src/blog/how-to-use-jira/pages.du index 5340091..9b07971 100644 --- a/src/blog/how-to-use-jira/pages.du +++ b/src/blog/how-to-use-jira/pages.du @@ -1,22 +1,18 @@ -# Pages - How to use Jira +'def title Pages - How to use Jira +'def desc Pages are a place for documents for your team. The goal is to have a centralised location where everyone in your team can share knowledge. -'define expected-reading 1 min -'define created 24 July 2020 -'define edited 16 September 2020 -[$pagenav] +# {title} -'define start_link ./ -'define prev_link ./releases.html Releases -'define next_link ./components.html Components -[$pagination_middle] +{pagenav 1 min;24 July 2020;edited 16 September 2020} -[=Pages are a place for documents for your team=]. The goal is to have a centralised location where everyone in your team can share knowledge. +{pagination ./;Releases;./releases.html;Components;./components.html} -[image ./img/test-page.png] +{b Pages are a place for documents for your team}. The goal is to have a centralised location where everyone in your team can share knowledge. -Pages are powered by another Atlasian product, named [`Confluence`]. It is a [=subscription-based software=], but it does also offer a free 30-day trial. +{img ./img/test-page.png} -[=All documents=] (pages) that you write are [=organised into [`Spaces`]=]. When creating a page you can choose one of many templates or just start off with a blank one. +Pages are powered by another Atlasian product, named {` Confluence}. It is a {b subscription-based software}, but it does also offer a free 30-day trial. -[=Confluence won't be covered in this tutorial=]. You can read more about it [url https://www.atlassian.com/software/confluence/guides/get-started/set-up here]. +{b All documents} (pages) that you write are {b organised into {` Spaces}}. When creating a page you can choose one of many templates or just start off with a blank one. +{b Confluence won't be covered in this tutorial}. You can read more about it {url here;https://www.atlassian.com/software/confluence/guides/get-started/set-up}. diff --git a/src/blog/how-to-use-jira/projects.du b/src/blog/how-to-use-jira/projects.du index fd64c86..77642a4 100644 --- a/src/blog/how-to-use-jira/projects.du +++ b/src/blog/how-to-use-jira/projects.du @@ -1,158 +1,155 @@ -# Projects - How to use Jira +'def title Projects - How to use Jira +'def desc Projects are a collection of issues with added functionality for organising them, getting statistics, etc. -'define expected-reading 4 min -'define created 24 July 2020 -'define edited 03 June 2021 -[$pagenav] +# {title} -'define start_link ./ -'define prev_link ./cards.html Cards -'define next_link ./kanban.html Kanban template -[$pagination_middle] +{pagenav 4 min;24 July 2020;03 June 2021} + +{pagination ./;Cards;./cards.html;Kanban template;./kanban.html} :contents :numbered -1. [url #creating-a-project Creating a project] -2. [url #boards Boards] +1. {uhref Creating a project} +2. {uhref Boards} .numbered - 1. [url #columns Columns] - 2. [url #adding-more-boards-to-a-project Adding more boards to a project] + 1. {uhref Columns} + 2. {uhref Adding more boards to a project} -3. [url #backlog Backlog] -4. [url #add-item Add item] +3. {uhref Backlog} +4. {uhref Add item} -In short, [=projects are a collection of issues=] with added functionality for [=organising them, getting statistics, etc=]. +In short, {b projects are a collection of issues} with added functionality for {b organising them, getting statistics, etc}. -[image ./img/projects.png] +{img ./img/projects.png} ## Creating a project -To create a project, either [=click on [`Create project`] from the menu [`Projects`] in the top bar=], +To create a project, either {b click on {` Create project} from the menu {` Projects} in the top bar}, -[image ./img/create-project-top.png] +{img ./img/create-project-top.png} -or [=click on the [`Create project`] button in the [`View all projects`] page=]. +or {b click on the {` Create project} button in the {` View all projects} page}. -[image ./img/view-all-projects-top.png] +{img ./img/view-all-projects-top.png} -[image ./img/create-project.png] +{img ./img/create-project.png} -[=Note=]: when you [=have created your account=] the first thing you'll see is the [`Create project`] page. +{b Note}: when you {b have created your account} the first thing you'll see is the {` Create project} page. -You'll be met by the [`Choose project type`] screen. From here choose [`Classic project`], in this tutorial the [`Next-gen project`] types [=won't be covered=]. +You'll be met by the {` Choose project type} screen. From here choose {` Classic project}, in this tutorial the {` Next-gen project} types {b won't be covered}. -[image ./img/choose-project-type.png] +{img ./img/choose-project-type.png} -After that you'll need to put a [=name=] for your project, set a [=key=] (used as an ID for issues ; it is automatically generated, but you can change it if you want) and select a [=template=]. +After that you'll need to put a {b name} for your project, set a {b key} (used as an ID for issues ; it is automatically generated, but you can change it if you want) and select a {b template}. -[image ./img/create-project-new.png] +{img ./img/create-project-new.png} -This tutorial covers [=only=] the three classic software templates: [=[url ./kanban.html Kanban]=], [=[url ./scrum.html Scrum]=] and [=[url ./bug.html Bug tracking]=]. +This tutorial covers {b only} the three classic software templates: {b {url Kanban;./kanban.html}}, {b {url Scrum;./scrum.html}} and {b {url Bug tracking;./bug.html}}. -[image ./img/choose-classic-template.png] +{img ./img/choose-classic-template.png} -In a nutshell, [=templates=] govern how [=boards and issues should work together=]. Later in the tutorial we cover the differences between these templates. +In a nutshell, {b templates} govern how {b boards and issues should work together}. Later in the tutorial we cover the differences between these templates. -Projects also have [url ./releases.html Releases], [url ./pages.html Pages] and [url ./components.html Components], that are also explored. +Projects also have {url Releases;./releases.html}, {url Pages;./pages.html} and {url Components;./components.html}, that are also explored. ## Boards -Each project contains, amongst many other things, boards. [=Boards are a way to better organise results from [url ./filters.html filters]=]. By default every project gets a board with a filter for all of the project's issues. +Each project contains, amongst many other things, boards. {b Boards are a way to better organise results from {url filters;./filters.html}}. By default every project gets a board with a filter for all of the project's issues. ### Columns -[=Boards are divided into columns=] that contain the cards (issues). A card can move [=freely=] from one column to another. +{b Boards are divided into columns} that contain the cards (issues). A card can move {b freely} from one column to another. -[image ./img/SOD.png] +{img ./img/SOD.png} -To illustrate how this could be useful, let's say we have three columns: [`TO DO`], [`DOING`] and [`DONE`]. +To illustrate how this could be useful, let's say we have three columns: {` TO DO}, {` DOING} and {` DONE}. -[image ./img/todo-doing-done.png] +{img ./img/todo-doing-done.png} -When you create an issue you initially put it in the [`TO DO`] column. After someone has started working on it, they put the issue in the [`DOING`] column. Finally, when the issue is resolved, it is put in the [`DONE`] column. +When you create an issue you initially put it in the {` TO DO} column. After someone has started working on it, they put the issue in the {` DOING} column. Finally, when the issue is resolved, it is put in the {` DONE} column. -Of course, the name, quantity and purpose of different columns [=depend on the project's organisation=]. +Of course, the name, quantity and purpose of different columns {b depend on the project's organisation}. -Adding and removing columns can be done from the [`Columns`] tab in the [`Board settings`] menu (three dots on the top right of a board). +Adding and removing columns can be done from the {` Columns} tab in the {` Board settings} menu (three dots on the top right of a board). -[image ./img/board-settings.png] +{img ./img/board-settings.png} -[image ./img/columns-edit.png] +{img ./img/columns-edit.png} ### Adding more boards to a project -You can also add to a project as many [=[url ./scrum.html Scrum]=] and [=[url ./kanban.html Kanban]=] templated boards as you want. +You can also add to a project as many {b {url Scrum;./scrum.html}} and {b {url Kanban;./kanban.html}} templated boards as you want. -This can be done, either while in a board, from [=clicking the three dots and choosing [`Create board`]=] +This can be done, either while in a board, from {b clicking the three dots and choosing {` Create board}} -[image ./img/create-board.png] +{img ./img/create-board.png} -or [=in the sidebar, from the [`Board`] menu=]. +or {b in the sidebar, from the {` Board} menu}. -[image ./img/sidebar-create-board.png] +{img ./img/sidebar-create-board.png} -After that, you are met with the [`Create a board`] window, where you can choose your template. +After that, you are met with the {` Create a board} window, where you can choose your template. -[image ./img/scrum-kanban-board.png] +{img ./img/scrum-kanban-board.png} Once you've made your choice, you will be met with three options: -[image ./img/board-from.png] +{img ./img/board-from.png} :unordered -- [=Board created with new Software project=] - creates a new project with a new board (has the name of the project). +- {b Board created with new Software project} - creates a new project with a new board (has the name of the project). - [image ./img/npb.png] + {img ./img/npb.png} -- [=Board from existing project=] - creates a board that gets the filter from another project +- {b Board from existing project} - creates a board that gets the filter from another project - [image ./img/ntb.png] + {img ./img/ntb.png} -- [=Board from an existing Saved Filter=] - as it says, you add to the project (indicated in the [`Location`] field) a board based on a saved filter +- {b Board from an existing Saved Filter} - as it says, you add to the project (indicated in the {` Location} field) a board based on a saved filter - [image ./img/ntb-filter.png] + {img ./img/ntb-filter.png} ## Backlog -[=The backlog is a place for issues that outline a general task/feature=]. +{b The backlog is a place for issues that outline a general task/feature}. -Depending on your project template, the backlog will either be a [=separate window ([url ./scrum.html Scrum])=], +Depending on your project template, the backlog will either be a {b separate window ({url Scrum;./scrum.html})}, -[image ./img/scrum-backlog.png] +{img ./img/scrum-backlog.png} -[=just a column in a board ([url ./kanban.html Kanban])=], +{b just a column in a board ({url Kanban;./kanban.html})}, -[image ./img/backlog-kanban.png] +{img ./img/backlog-kanban.png} -or [=nonexistent ([url ./bug.md bug tracking])=]. +or {b nonexistent ({url bug tracking;./bug.md})}. The purpose of the backlog depends on the template and it is described in the page of each template. ## Add item -[=You can also add some resources to the sidebar of your project=] for everyone to use. That is done through the [`Add Item`] menu. +{b You can also add some resources to the sidebar of your project} for everyone to use. That is done through the {` Add Item} menu. -[image ./img/add-item-kanban.png] +{img ./img/add-item-kanban.png} -From here you can [=add a website shortcut=], simply by putting the web address and giving it a name. +From here you can {b add a website shortcut}, simply by putting the web address and giving it a name. -[image ./img/add-item-to-project.png] +{img ./img/add-item-to-project.png} -[image ./img/add-shortcut.png] +{img ./img/add-shortcut.png} The name is used for showing the shortcut on the sidebar. -[image ./img/added-site.png] +{img ./img/added-site.png} -You can also add a [`Bitbucket`] or [`GitHub`] repository which you can [=leave=] only as a [=shortcut=], or you can [=integrate=] it so that [=issues are transferred to Jira=]. +You can also add a {` Bitbucket} or {` GitHub} repository which you can {b leave} only as a {b shortcut}, or you can {b integrate} it so that {b issues are transferred to Jira}. -[image ./img/test-repo.png] +{img ./img/test-repo.png} -[image ./img/test-repo-sidebar.png] +{img ./img/test-repo-sidebar.png} -[=Integration won't be covered in this tutorial=], but I can recommend [url https://www.idalko.com/jira-github-integration/ this] article for [`GitHub`] integration and [url https://www.idalko.com/jira-bitbucket-integration/ this] one for [`Bitbucket`] integration. +{b Integration won't be covered in this tutorial}, but I can recommend {url this;https://www.idalko.com/jira-github-integration/} article for {` GitHub} integration and {url this;https://www.idalko.com/jira-bitbucket-integration/} one for {` Bitbucket} integration. -From the [`Add Item`] menu you can also [=toggle the shortcut to [url ./pages.html Pages]=]. +From the {` Add Item} menu you can also {b toggle the shortcut to {url Pages;./pages.html}}. diff --git a/src/blog/how-to-use-jira/releases.du b/src/blog/how-to-use-jira/releases.du index 1642c61..f3fc54f 100644 --- a/src/blog/how-to-use-jira/releases.du +++ b/src/blog/how-to-use-jira/releases.du @@ -1,21 +1,18 @@ -# Releases - How to use Jira +'def title Releases - How to use Jira +'def desc The Releases page in a project shows versions, the ones in development and the ones that are completed. -'define expected-reading 1 min -'define created 24 July 2020 -'define edited 16 September 2020 -[$pagenav] +# {title} -'define start_link ./ -'define prev_link ./bug.html Bug tracking template -'define next_link ./pages.html Pages -[$pagination_middle] +{pagenav 1 min;24 July 2020;edited 16 September 2020} -The [`Releases`] page in a project shows [=versions=], the ones in development and the ones that are completed. +{pagination ./;Bug tracking template;./bug.html;Pages;./pages.html} -[=Versions are just a big collection of issues=] and the [=goal of a released version=] is for [=all of it's issues to be resolved=]. It serves as a point in time for the development of a project. +The {` Releases} page in a project shows {b versions}, the ones in development and the ones that are completed. + +{b Versions are just a big collection of issues} and the {b goal of a released version} is for {b all of it's issues to be resolved}. It serves as a point in time for the development of a project. ## Adding issues to a version -When creating an issue, you can specify a version in the [`Fix versions`] property. +When creating an issue, you can specify a version in the {` Fix versions} property. -[image ./img/fix-versions.png] +{img ./img/fix-versions.png} diff --git a/src/blog/how-to-use-jira/scrum.du b/src/blog/how-to-use-jira/scrum.du index dffe4ec..64a524a 100644 --- a/src/blog/how-to-use-jira/scrum.du +++ b/src/blog/how-to-use-jira/scrum.du @@ -1,55 +1,52 @@ -# Scrum template - How to use Jira +'def title Scrum template - How to use Jira +'def desc The scrum template is very similar to the kanban template with one big difference: sprints. -'define expected-reading 2 min -'define created 24 July 2020 -'define edited 03 June 2021 -[$pagenav] +# {title} -'define start_link ./ -'define prev_link ./kanban.html Kanban template -'define next_link ./bug.html Bug tracking template -[$pagination_middle] +{pagenav 2 min;24 July 2020;03 June 2021} + +{pagination ./;Kanban template;./kanban.html;Bug tracking template;./bug.html} .contents .numbered -1. [url #backlog Backlog] -2. [url #boards-and-issues Boards and Issues] -3. [url #create-board Create board] +1. {uhref Backlog} +2. {uhref Boards and Issues} +3. {uhref Create board} -The scrum template is very similar to the kanban template, with one big difference: [=sprints=]. +The scrum template is very similar to the kanban template, with one big difference: {b sprints}. -[=All issues=] are put into the [=backlog=] (which is now a [=separate page=]). From there, they are organised into [=sprints=]. +{b All issues} are put into the {b backlog} (which is now a {b separate page}). From there, they are organised into {b sprints}. -In general [url https://www.atlassian.com/agile agile software development], a [=sprint is a small duration of time=] (one to four weeks) where the team focuses on a [=set of tasks=] and at the end everyone [=evaluates the results=] and plans the next sprint. +In general {url agile software development;https://www.atlassian.com/agile}, a {b sprint is a small duration of time} (one to four weeks) where the team focuses on a {b set of tasks} and at the end everyone {b evaluates the results} and plans the next sprint. -Your [=boards only work on the issues of the currently active sprint=]. +Your {b boards only work on the issues of the currently active sprint}. ## Backlog -As we've discussed, the [=backlog=] is used for organising [=all issues=] into [=sprints=]. +As we've discussed, the {b backlog} is used for organising {b all issues} into {b sprints}. -[image ./img/sample-scrum-backlog.png] +{img ./img/sample-scrum-backlog.png} -From here you can also organise [=Versions=] (refer to [url ./releases.html Releases]) and [=Epics=] (refer to [url ./cards.html Cards]). An important note is that Epics in this context don't need to have their linked issues in only one sprint. +From here you can also organise {b Versions} (refer to {url Releases;./releases.html}) and {b Epics} (refer to {url Cards;./cards.html}). An important note is that Epics in this context don't need to have their linked issues in only one sprint. -[image ./img/versions-and-epics.png] +{img ./img/versions-and-epics.png} -Creating a sprint is done from the conveniently named [`Create sprint`] button. It shows a box on top where you can either move issues from the backlog to the sprint or create entirely new issues. +Creating a sprint is done from the conveniently named {` Create sprint} button. It shows a box on top where you can either move issues from the backlog to the sprint or create entirely new issues. -[image ./img/sample-sprint.png] +{img ./img/sample-sprint.png} ## Boards and Issues -As previously mentioned, boards have access only to the issues in the active sprint. This is also reflected in the user interface. After selecting a board from the sidebar, you view it from the [`Active sprints`] page. +As previously mentioned, boards have access only to the issues in the active sprint. This is also reflected in the user interface. After selecting a board from the sidebar, you view it from the {` Active sprints} page. -[image ./img/active-sprints.png] +{img ./img/active-sprints.png} ## Create board -This template can be chosen when [=creating a project=] +This template can be chosen when {b creating a project} -[image ./img/choose-classic-template.png] +{img ./img/choose-classic-template.png} -and [=from the [`Create board`] screen=]. +and {b from the {` Create board} screen}. -[image ./img/scrum-kanban-board.png] +{img ./img/scrum-kanban-board.png} diff --git a/src/blog/icon-fonts-arent-evil-you-just-have-to-care/index.du b/src/blog/icon-fonts-arent-evil-you-just-have-to-care/index.du index 35e9fcf..744eac3 100644 --- a/src/blog/icon-fonts-arent-evil-you-just-have-to-care/index.du +++ b/src/blog/icon-fonts-arent-evil-you-just-have-to-care/index.du @@ -1,48 +1,48 @@ -# Icon fonts aren't evil, you just have to care +'def title Icon fonts aren't evil, you just have to care +'def desc Arguing that icon fonts provide useful features and using them can be done in a non-disruptive way to accessibility -'define expected-reading 9 min -'define created 19 July 2023 -'define edited 19 July 2023 -[$pagenav] +# {title} + +{pagenav 9 min;19 July 2023;19 July 2023} .contents .numbered -1. [url #the-problem-with-svgs The problem with SVGs] -2. [url #icon-fonts Icon fonts] +1. {uhref The problem with SVGs} +2. {uhref Icon fonts} .numbered - 1. [url #text-antialiasing-unavoidable Text antialiasing: unavoidable] - 2. [url #better-control-over-svgs-not-always-needed Better control over SVGs: not always needed] - 3. [url #fetching-failures-and-accessible-fonts-fixable-with-care Fetching failures and accessible fonts: fixable with care] - 4. [url #screen-reader-accessibility-almost-unavoidable Screen reader accessibility: almost unavoidable] - 5. [url #file-size-fixable-with-care File size: fixable with care] + 1. {uhref Text antialiasing: unavoidable} + 2. {uhref Better control over SVGs: not always needed} + 3. {uhref Fetching failures and accessible fonts: fixable with care} + 4. {uhref Screen reader accessibility: almost unavoidable} + 5. {uhref File size: fixable with care} -Recently I did a [url https://gitlab.com/Syndamia/syndamiadotcom/-/merge_requests/10 whole bunch of changes to the way this website works] and one of them included replacing all SVG icons with an icon font. -While doing research, I found [url https://www.youtube.com/watch?v=9xXBYcWgCHA Seren Davies' talk] as well as [url https://www.irigoyen.dev/blog/2021/02/17/stop-using-icon-fonts/ many] [url http://technotes.iangreenleaf.com/posts/font-awesome-not-awesome.html other] [url https://www.ianfeather.co.uk/ten-reasons-we-switched-from-an-icon-font-to-svg/ posts] being against them. +Recently I did a {url whole bunch of changes to the way this website works;https://gitlab.com/Syndamia/syndamiadotcom/-/merge_requests/10} and one of them included replacing all SVG icons with an icon font. +While doing research, I found {url Seren Davies' talk;https://www.youtube.com/watch?v=9xXBYcWgCHA} as well as {url many;https://www.irigoyen.dev/blog/2021/02/17/stop-using-icon-fonts/} {url other;http://technotes.iangreenleaf.com/posts/font-awesome-not-awesome.html} {url posts;https://www.ianfeather.co.uk/ten-reasons-we-switched-from-an-icon-font-to-svg/} being against them. A lot of these concerns and issues are valid and multiple times I stopped that rework, but in the end I believe, with enough care, you could make them work almost perfectly. ## The problem with SVGs First, we have to get acquaintanced with why I wanted change: before the big rework, this website used SVG images for all icons. -For [url https://gitlab.com/Syndamia/syndamiadotcom/-/releases/v3.0 quite a while] I've added support for an alternative light theme, but ever since the beginning icons have been an issue. +For {url quite a while;https://gitlab.com/Syndamia/syndamiadotcom/-/releases/v3.0} I've added support for an alternative light theme, but ever since the beginning icons have been an issue. How can you change the color, or more specifically, the internal styling of an SVG? -You have a [url https://stackoverflow.com/questions/22252472/how-can-i-change-the-color-of-an-svg-element couple of options], if you include it with a normal [`<img>`] tag, as I was doing, you could do some [url https://stackoverflow.com/a/53336754 magic with filters] to change the exact color, though this is kinda difficult and [url https://caniuse.com/css-filters browsers support filters since somewhat recently]. +You have a {url couple of options;https://stackoverflow.com/questions/22252472/how-can-i-change-the-color-of-an-svg-element}, if you include it with a normal {` {nohtml <img>}} tag, as I was doing, you could do some {url magic with filters;https://stackoverflow.com/a/53336754} to change the exact color, though this is kinda difficult and {url browsers support filters since somewhat recently;https://caniuse.com/css-filters}. This is a deal-breaker, because I care about older browsers and without that CSS property, icons become very difficult to see on the light theme. -Another option is to load it with an [`\<object>`], [`\<embed>`] or [`\<iframe>`] tag, though they all [url https://stackoverflow.com/a/21503151 require JavaScript] to edit the internal styling and have [url https://vecta.io/blog/best-way-to-embed-svg a lot of problems]: +Another option is to load it with an {` {nohtml <object>}}, {` {nohtml <embed>}} or {` {nohtml <iframe>}} tag, though they all {url require JavaScript;https://stackoverflow.com/a/21503151} to edit the internal styling and have {url a lot of problems;https://vecta.io/blog/best-way-to-embed-svg}: .bulleted -- [`\<object>`] [url https://vecta.io/blog/best-way-to-embed-svg#2-using-an--object--tag causes problems for search engines or the workaround forces downloading multiple files for the same image]. +- {` {nohtml <object>}} {url causes problems for search engines or the workaround forces downloading multiple files for the same image;https://vecta.io/blog/best-way-to-embed-svg#2-using-an--object--tag}. Worst-case scenario, for every icon you would need two different HTTP requests, which significantly increases required traffic for devices on slow connections, no dice. -- [`\<embed>`] isn't part of the HTML specification, so it could disappear from browsers at any moment and it may have very different behaviours between browsers -- [`\<iframe>`] is [url https://stackoverflow.com/a/23178537 hard to maintain and causes problems for search engines] +- {` {nohtml <embed>}} isn't part of the HTML specification, so it could disappear from browsers at any moment and it may have very different behaviours between browsers +- {` {nohtml <iframe>}} is {url hard to maintain and causes problems for search engines;https://stackoverflow.com/a/23178537} The final option is putting SVG images directly inline with the rest of the HTML. However, this also comes with it's drawbacks: .bulleted - There will be no icon caching, since they'll be a part of the downloaded webpage. -- [url https://caniuse.com/svg-html5 Browsers before ~2012 didn't support them], which is a deal-breaker since navigation-critical items wouldn't be displayed on those browsers. +- {url Browsers before ~2012 didn't support them;https://caniuse.com/svg-html5}, which is a deal-breaker since navigation-critical items wouldn't be displayed on those browsers. - It would also require a little bit more work to maintain, since if I wanted to change an icon I would have to go somewhere and manually insert it's contents, rather than just downloading it and replacing the existing icon. Nevertheless, this is the best option and the one I was thinking about the most. @@ -50,9 +50,9 @@ Nevertheless, this is the best option and the one I was thinking about the most. ## Icon fonts The alternative is to create your own font, where you replace certain unicode symbols with your own custom graphics. -It is [url https://caniuse.com/mdn-css_properties_font-family universally supported], changing color is as easy as changing text, adding an icon somewhere is as easy as pasting a unicode character there and the font itself can be cached. +It is {url universally supported;https://caniuse.com/mdn-css_properties_font-family}, changing color is as easy as changing text, adding an icon somewhere is as easy as pasting a unicode character there and the font itself can be cached. Is this too perfect to be true? -Yes, yes it is, there are quite a lot of caveats (outlined very well, with images, on [url https://css-tricks.com/icon-fonts-vs-svg/ this post by Chris Coyier]). +Yes, yes it is, there are quite a lot of caveats (outlined very well, with images, on {url this post by Chris Coyier;https://css-tricks.com/icon-fonts-vs-svg/}). ### Text antialiasing: unavoidable @@ -68,24 +68,24 @@ However, I don't have any desire to do either of these, in practice my icons are ### Fetching failures and accessible fonts: fixable with care Now, to the big problem, what happens if the browser doesn't fetch the font or if a dyslexic person changes it to something they find easier to read. -This is one of the main issues, outlined in the aforementioned [url https://www.youtube.com/watch?v=9xXBYcWgCHA Seren Davies' talk]. +This is one of the main issues, outlined in the aforementioned {url Seren Davies' talk;https://www.youtube.com/watch?v=9xXBYcWgCHA}. -Unicode defines certain characters as part of so-called [url https://en.wikipedia.org/wiki/Private_Use_Areas Private Use Areas] (PUA), meaning those character won't ever have a standard glyph (image) assigned to them and any font can define them freely. +Unicode defines certain characters as part of so-called {url Private Use Areas;https://en.wikipedia.org/wiki/Private_Use_Areas} (PUA), meaning those character won't ever have a standard glyph (image) assigned to them and any font can define them freely. The effect is that on different fonts, such a character will appear as a completely different glyph, though most don't define them at all, leaving you with a default blank square. -This is horrible: if the font doesn't get downloaded or if you [=need=] to change it to something you can actually read, you'll get random irrelevant glyphs at best and blank squares everywhere at worst. -To add insult to injury, icon fonts like [url https://fontawesome.com/ font-awesome] contain their icons almost exclusively in the PUA! +This is horrible: if the font doesn't get downloaded or if you {b need} to change it to something you can actually read, you'll get random irrelevant glyphs at best and blank squares everywhere at worst. +To add insult to injury, icon fonts like {url font-awesome;https://fontawesome.com/} contain their icons almost exclusively in the PUA! However, this all can be fixed, at least to an extent. The main tricks are: :numbered -1. [=Adding text to every clickable option=], where possible. +1. {b Adding text to every clickable option}, where possible. For example, I changed my theme button from an icon to "Dark theme" or "Light theme" (depending on the current theme). .p - Even outside this topic, having text instead of icons [url https://dev.to/megazear7/no-icon-web-design-16eb has many benefits], mainly making it easier for users to understand how to interact with the website. + Even outside this topic, having text instead of icons {url has many benefits;https://dev.to/megazear7/no-icon-web-design-16eb}, mainly making it easier for users to understand how to interact with the website. -2. [=Putting important navigational and functional icons outside the PUA=] (and leaving decorational ones there). +2. {b Putting important navigational and functional icons outside the PUA} (and leaving decorational ones there). .p For example, on mobile devices my sidebar is put on the top, but as to not take too much space, it is "folded" up. @@ -99,29 +99,29 @@ The main tricks are: But, to do the second trick, you would need your own custom font. Thankfully, there are programs which can edit already existing ones, so you won't have to know how to make one yourself. -I personally really like [url https://tabler-icons.io/ tabler-icons] (and more specifically, [url https://github.com/tabler/tabler-icons/releases/tag/v2.10.0 version 2.10.0]) and for the editing I use [url https://fontforge.org/en-US/ FontForge]. -So, I download the [`.ttf`] version of the font and then a (part of a) [url https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/FontForge-helper.ff#L37-74 FontForge script I made moves glyphs from the PUA to standard characters]. +I personally really like {url tabler-icons;https://tabler-icons.io/} (and more specifically, {url version 2.10.0;https://github.com/tabler/tabler-icons/releases/tag/v2.10.0}) and for the editing I use {url FontForge;https://fontforge.org/en-US/}. +So, I download the {` .ttf} version of the font and then a (part of a) {url FontForge script I made moves glyphs from the PUA to standard characters;https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/FontForge-helper.ff#L37-74}. ### Screen reader accessibility: almost unavoidable Text readers usually struggle quite a lot with Unicode characters and especially with those in the PUA. -Generally, you have [url https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes accessibility attributes] like [url https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label aria-label], where you can explain what the given character does. +Generally, you have {url accessibility attributes;https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes} like {url aria-label;https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label}, where you can explain what the given character does. But SVGs have a title and description tags built-in, existing inside the image file itself, which is way better than adding an aria property. ### File size: fixable with care When every icon is on a separate image, you'll download it only when needed, however with a custom font, you'll always need to download the whole font, which includes icons you don't use. -For the aforementioned tabler-icons, the [`.ttf`] font file is 1.8 MB! +For the aforementioned tabler-icons, the {` .ttf} font file is 1.8 MB! That is waaaay too much, especially since the font could block rendering of the page. But in reality, if you remove the icons that you don't use, the size difference could actually go in favor of fonts. -In the [url https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/FontForge-helper.ff#L17-35 first half of my FontForge script] I select everything that isn't the 16 icons I actually use, and remove it. +In the {url first half of my FontForge script;https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/FontForge-helper.ff#L17-35} I select everything that isn't the 16 icons I actually use, and remove it. The same tabler-icons, but exported as (very well optimized for size) SVG files took up ~28KB in total, however the font with only those same icons was ~7KB in size. -In reality, the most icons loaded by a page ([url /assets /assets]) totaled ~22KB in size, which is still a ~3 times reduction. +In reality, the most icons loaded by a page ({url /assets;/assets}) totaled ~22KB in size, which is still a ~3 times reduction. On average a page probably requests less than 7KB of icons, but still, 7KB isn't that much and once you fetch it, it get's cached and you don't have to request it ever again. Overall, I would say size-wise, with a font containing only what you need, it could easily take up less space than the separate SVGs. -If you still have speed issues, [url https://www.filamentgroup.com/lab/font-events.html there are always ways to load fonts progressively]. +If you still have speed issues, {url there are always ways to load fonts progressively;https://www.filamentgroup.com/lab/font-events.html}. \n diff --git a/src/blog/index.du b/src/blog/index.du index cf0bf46..d282d38 100644 --- a/src/blog/index.du +++ b/src/blog/index.du @@ -1,113 +1,116 @@ -# Blog +'def title Blog +'def desc Articles detailing personal experiences or exploration of certain topics + +# {title} Articles detailing personal experiences or exploration of certain topics. \n -#### [*2024*] +#### {i 2024} :defs -; [$bg] 18 Nov   [url /blog/switchut-izgorq Суичът изгоря!] -: [`Shallow dive`] | [`Story`] | [`Networking`] [`Switch`] [`NetworkPartner`] +; {bg} 18 Nov   {url Суичът изгоря!;/blog/switchut-izgorq} +: {` Shallow dive} | {` Story} | {` Networking} {` Switch} {` NetworkPartner} -; [$gb] 06 Oct   [url /blog/the-physics-behind-a-black-hole-shader The physics behind a black hole shader] -: [`Deep dive`] | [`Physics`] | [`General theory of relativity`] [`Celestial mechanics`] [`Gravity`] [`Black Hole`] [`Algorithm`] +; {gb} 06 Oct   {url The physics behind a black hole shader;/blog/the-physics-behind-a-black-hole-shader} +: {` Deep dive} | {` Physics} | {` General theory of relativity} {` Celestial mechanics} {` Gravity} {` Black Hole} {` Algorithm} -; [$gb] 20 Feb   [url /blog/microsoft-and-foss-extinguish Microsoft and FOSS: a fire to be extinguished] -: [`Shallow dive`] | [`Opinion`] | [`Microsoft`] [`GitHub`] [`Linux`] [`FOSS`] +; {gb} 20 Feb   {url Microsoft and FOSS: a fire to be extinguished;/blog/microsoft-and-foss-extinguish} +: {` Shallow dive} | {` Opinion} | {` Microsoft} {` GitHub} {` Linux} {` FOSS} -#### [*2023*] +#### {i 2023} :defs -; [$gb] 16 Dec   [url /blog/fix-qc-timeout Fix "qc timeout" kernel log error] -: [`Linux`] | [`kernel`] | [`libata`] [`qc`] [`logs`] [`DMA`] +; {gb} 16 Dec   {url Fix "qc timeout" kernel log error;/blog/fix-qc-timeout} +: {` Linux} | {` kernel} | {` libata} {` qc} {` logs} {` DMA} -; [$gb] 30 Aug   [url /blog/thinkpad-x270-my-favorite-machine ThinkPad X270 - my favorite machine] -: [`Medium dive`] | [`Review`] | [`Lenovo`] [`ThinkPad`] [`Yoga`] +; {gb} 30 Aug   {url ThinkPad X270 - my favorite machine;/blog/thinkpad-x270-my-favorite-machine} +: {` Medium dive} | {` Review} | {` Lenovo} {` ThinkPad} {` Yoga} -; [$gb] 19 Jul   [url /blog/icon-fonts-arent-evil-you-just-have-to-care Icon fonts aren't evil, you just have to care] -: [`Shallow dive`] | [`Web development`] | [`Icon font`] [`SVG`] [`Accessibility`] [`FontForge`] +; {gb} 19 Jul   {url Icon fonts aren't evil, you just have to care;/blog/icon-fonts-arent-evil-you-just-have-to-care} +: {` Shallow dive} | {` Web development} | {` Icon font} {` SVG} {` Accessibility} {` FontForge} -; [$bg] 14 Jul   [url /blog/fmi-i-vissheto-obrazovanie-v-programistkata-industriq ФМИ и висшето образование в програмистката индустрия] -: [`Deep dive`] | [`University`] | [`FMI`] [`Education`] +; {bg} 14 Jul   {url ФМИ и висшето образование в програмистката индустрия;/blog/fmi-i-vissheto-obrazovanie-v-programistkata-industriq} +: {` Deep dive} | {` University} | {` FMI} {` Education} -; [$gb] 28 Jun   [url /blog/fix-network-brother-printers Fix networked Brother printers not working in Linux] -: [`Linux`] | [`CUPS`] | [`Printers`] [`Brother`] [`Network`] [`avahi`] +; {gb} 28 Jun   {url Fix networked Brother printers not working in Linux;/blog/fix-network-brother-printers} +: {` Linux} | {` CUPS} | {` Printers} {` Brother} {` Network} {` avahi} -; [$gb] 14 Jun   [url /blog/gns3-initsh-no-such-file Fix "exec /gns3/init.sh: no such file or directory"] -: [`Linux`] | [`GNS3`] | [`Docker`] [`busybox`] +; {gb} 14 Jun   {url Fix "exec /gns3/init.sh: no such file or directory";/blog/gns3-initsh-no-such-file} +: {` Linux} | {` GNS3} | {` Docker} {` busybox} -; [$gb] 07 Jun   [url /blog/friendship-ended-with-funtoo-now-gentoo-is-my-best-friend Friendship ended with Funtoo, now Gentoo is my best friend] -: [`Shallow dive`] | [`Linux`] | [`Funtoo`] [`Gentoo`] [`portage`] [`packages`] [`emerge`] [`ebuild`] +; {gb} 07 Jun   {url Friendship ended with Funtoo, now Gentoo is my best friend;/blog/friendship-ended-with-funtoo-now-gentoo-is-my-best-friend} +: {` Shallow dive} | {` Linux} | {` Funtoo} {` Gentoo} {` portage} {` packages} {` emerge} {` ebuild} -; [$gb] 01 May   [url /blog/bash-is-weird BASH is weird] -: [`Shallow dive`] | [`bash`] | [`Linux`] [`scripting`] +; {gb} 01 May   {url BASH is weird;/blog/bash-is-weird} +: {` Shallow dive} | {` bash} | {` Linux} {` scripting} -; [$gb] 26 Apr   [url /blog/install-drivers-for-epson-scanners Install drivers for Epson scanners] -: [`Linux`] | [`SANE`] | [`Scanners`] [`Epson`] [`epkowa`] [`iscan`] +; {gb} 26 Apr   {url Install drivers for Epson scanners;/blog/install-drivers-for-epson-scanners} +: {` Linux} | {` SANE} | {` Scanners} {` Epson} {` epkowa} {` iscan} -; [$gb] 25 Apr   [url /blog/managing-apps-with-adb-without-root Managing Android apps with ADB (and without root)] -: [`Android`] | [`ADB`] | [`Apps`] [`Linux`] [`Windows`] +; {gb} 25 Apr   {url Managing Android apps with ADB (and without root);/blog/managing-apps-with-adb-without-root} +: {` Android} | {` ADB} | {` Apps} {` Linux} {` Windows} -; [$gb] 18 Apr   [url /blog/sane-explanation-of-compilers/part-1 Sane explanation of compilers: Part 1] -: [`Deep dive`] | [`Compilers`] | [`C`] [`yacc`] [`bison`] [`math`] [`Trees`] [`Regex`] [`Grammar`] [`Languages`] +; {gb} 18 Apr   {url Sane explanation of compilers: Part 1;/blog/sane-explanation-of-compilers/part-1} +: {` Deep dive} | {` Compilers} | {` C} {` yacc} {` bison} {` math} {` Trees} {` Regex} {` Grammar} {` Languages} -; [$gb] 13 Jan   [url /blog/plan9-in-linux-mouse-menus Plan 9 in Linux: Mouse menus] -: [`Medium dive`] | [`Linux`] | [`Plan 9`] [`mouse`] [`bash`] [`script`] [`X11`] [`openbox`] [`jgmenu`] [`plumber`] +; {gb} 13 Jan   {url Plan 9 in Linux: Mouse menus;/blog/plan9-in-linux-mouse-menus} +: {` Medium dive} | {` Linux} | {` Plan 9} {` mouse} {` bash} {` script} {` X11} {` openbox} {` jgmenu} {` plumber} -; [$gb] 01 Jan   [url /blog/virt-manager-freeze-on-browse virt-manager freezing up when clicking Browse in any window] -: [`Linux`] | [`virt-manager`] | [`QEMU/KVM`] [`libvirt`] [`Linux`] [`GTK`] +; {gb} 01 Jan   {url virt-manager freezing up when clicking Browse in any window;/blog/virt-manager-freeze-on-browse} +: {` Linux} | {` virt-manager} | {` QEMU/KVM} {` libvirt} {` Linux} {` GTK} -#### [*2022*] +#### {i 2022} :defs -; [$gb] 23 Dec   [url /blog/2.6-years-of-web-design 2.6 years of web design] -: [`Shallow dive`] | [`Web design`] +; {gb} 23 Dec   {url 2.6 years of web design;/blog/2.6-years-of-web-design} +: {` Shallow dive} | {` Web design} -; [$gb] 13 Dec   [url /blog/when-a-language-forces-simpler-thinking When a language forces simpler thinking] -: [`Shallow dive`] | [`Common Lisp`] | [`Advent of Code`] +; {gb} 13 Dec   {url When a language forces simpler thinking;/blog/when-a-language-forces-simpler-thinking} +: {` Shallow dive} | {` Common Lisp} | {` Advent of Code} -; [$gb] 04 Dec   [url /blog/taming-the-fun-too Taming The Fun-too] -: [`Story`] | [`Funtoo`] | [`Linux`] [`Gentoo`] [`packages`] +; {gb} 04 Dec   {url Taming The Fun-too;/blog/taming-the-fun-too} +: {` Story} | {` Funtoo} | {` Linux} {` Gentoo} {` packages} -; [$gb] 01 Nov   [url /blog/turn-off-notifications-windows How to turn off notifications on Windows] -: [`Windows 10`] | [`Settings`] | [`Notifications`] +; {gb} 01 Nov   {url How to turn off notifications on Windows;/blog/turn-off-notifications-windows} +: {` Windows 10} | {` Settings} | {` Notifications} -; [$gb] 01 Nov   [url /blog/disable-sticky-keys-popup How to disable Sticky Keys prompt] -: [`Windows`] | [`Settings`] | [`Sticky Keys`] +; {gb} 01 Nov   {url How to disable Sticky Keys prompt;/blog/disable-sticky-keys-popup} +: {` Windows} | {` Settings} | {` Sticky Keys} -; [$gb] 26 Oct   [url /blog/remove-weather-widget How to remove Windows Weather Widget] -: [`Windows 10`] | [`Settings`] | [`Taskbar`] [`Weather Widget`] +; {gb} 26 Oct   {url How to remove Windows Weather Widget;/blog/remove-weather-widget} +: {` Windows 10} | {` Settings} | {` Taskbar} {` Weather Widget} -; [$gb] 04 Oct   [url /blog/windows-run-dialog Windows Run dialog] -: [`Windows`] | [`Commands`] | [`Run`] [`Settings`] +; {gb} 04 Oct   {url Windows Run dialog;/blog/windows-run-dialog} +: {` Windows} | {` Commands} | {` Run} {` Settings} -; [$gb] 03 Oct   [url /blog/export-skype How to export Skype data] -: [`Skype`] | [`Export`] | [`Archive`] [`skype-parser`] +; {gb} 03 Oct   {url How to export Skype data;/blog/export-skype} +: {` Skype} | {` Export} | {` Archive} {` skype-parser} -; [$gb] 16 Sep   [url /blog/how-to-encrypt-email How to encrypt email] -: [`All`] | [`Email`] | [`PGP`] [`S/MIME`] [`Email Client`] [`Gmail`] [`Outlook`] [`Protonmail`] +; {gb} 16 Sep   {url How to encrypt email;/blog/how-to-encrypt-email} +: {` All} | {` Email} | {` PGP} {` S/MIME} {` Email Client} {` Gmail} {` Outlook} {` Protonmail} -; [$gb] 10 Sep   [url /blog/encrypted-email Encrypted email] -: [`Medium dive`] | [`Email`] | [`Encryption`] [`Security`] [`PGP`] [`S/MIME`] [`Protonmail`] [`Tutanota`] +; {gb} 10 Sep   {url Encrypted email;/blog/encrypted-email} +: {` Medium dive} | {` Email} | {` Encryption} {` Security} {` PGP} {` S/MIME} {` Protonmail} {` Tutanota} -; [$gb] 30 Jul   [url /blog/fix-no-frame-buffer-plan9 Fix "No frame buffer" error in <span class="no-wrap">Plan 9</span>] -: [`Plan 9`] | [`Configuration`] | [`QEMU/KVM`] [`Linux`] [`monitor`] +; {gb} 30 Jul   {url Fix "No frame buffer" error in <span class="no-wrap">Plan 9</span>;/blog/fix-no-frame-buffer-plan9} +: {` Plan 9} | {` Configuration} | {` QEMU/KVM} {` Linux} {` monitor} -; [$gb] 30 Jul   [url /blog/install-plan9-with-virt-manager Install <span class="no-wrap">Plan 9</span> with virt-manager] -: [`Plan 9`] | [`Installation`] | [`Setup`] [`QEMU/KVM`] [`virt-manager`] [`Linux`] +; {gb} 30 Jul   {url Install <span class="no-wrap">Plan 9</span> with virt-manager;/blog/install-plan9-with-virt-manager} +: {` Plan 9} | {` Installation} | {` Setup} {` QEMU/KVM} {` virt-manager} {` Linux} -#### [*2020*] +#### {i 2020} :defs -; [$gb] 24 Jul   [url /blog/how-to-use-jira How to use Jira] -: [`Project Management`] | [`Jira`] | [`Agile`] [`Issue tracking`] [`Bug tracking`] [`Kanban`] [`Atlassian`] +; {gb} 24 Jul   {url How to use Jira;/blog/how-to-use-jira} +: {` Project Management} | {` Jira} | {` Agile} {` Issue tracking} {` Bug tracking} {` Kanban} {` Atlassian} -; [$gb] 21 May   [url /blog/connect-to-mysql-in-dotnet-ef Connect to Mysql in .NET and Entity Framework] -: [`ASP.Net`] | [`MySQL`] | [`Entity Framework`] [`Pomelo`] +; {gb} 21 May   {url Connect to Mysql in .NET and Entity Framework;/blog/connect-to-mysql-in-dotnet-ef} +: {` ASP.Net} | {` MySQL} | {` Entity Framework} {` Pomelo} -; [$gb] 20 May   [url /blog/mundus-first-shot-at-gamedev Mundus: My first shot at game development] -: [`Deep dive`] | [`Gamedev`] | [`2D`] [`Sandbox`] [`Crafting`] [`Building`] [`Fighting`] [`GtkSharp 2.0`] [`C#`] +; {gb} 20 May   {url Mundus: My first shot at game development;/blog/mundus-first-shot-at-gamedev} +: {` Deep dive} | {` Gamedev} | {` 2D} {` Sandbox} {` Crafting} {` Building} {` Fighting} {` GtkSharp 2.0} {` C#} diff --git a/src/blog/install-drivers-for-epson-scanners/index.du b/src/blog/install-drivers-for-epson-scanners/index.du index d6f6486..0d3c5ec 100644 --- a/src/blog/install-drivers-for-epson-scanners/index.du +++ b/src/blog/install-drivers-for-epson-scanners/index.du @@ -1,27 +1,23 @@ -# Install drivers for Epson scanners +'def title Install drivers for Epson scanners +'def desc First, make sure you have SANE installed on your machine. Second look through SANE project website, most scanners are supported out of the box, but about 15% of them either aren't supported or are untested. -'define expected-reading 3 min -'define created 26 April 2023 -'define edited 26 April 2023 -[$pagenav] +# {title} -'footnote gentoo-sane On Gentoo the package is [`sane-backends`], as per the [url https://wiki.gentoo.org/wiki/SANE wiki]. +{pagenav 3 min;26 April 2023;26 April 2023} Sometimes your Epson scanner might work out of the box, and sometimes it might not. -First, make sure you have [url http://sane-project.org/ SANE] installed on your machine[$gentoo-sane]. -Second look through [url http://www.sane-project.org/sane-mfgs.html#Z-EPSON the website], most scanners are supported out of the box, but about 15% of them either aren't supported or are untested. +First, make sure you have {url SANE;http://sane-project.org/} installed on your machine{fn On Gentoo the package is {` sane-backends}, as per the {url wiki;https://wiki.gentoo.org/wiki/SANE}.}. +Second look through {url the website;http://www.sane-project.org/sane-mfgs.html#Z-EPSON}, most scanners are supported out of the box, but about 15% of them either aren't supported or are untested. ## Complete or Good -'footnote openrc-sane For OpenRC: [`rc-service saned status`] - If your scanner falls into the first category, labeled "Complete" or "Good", you probably have an issue with SANE. -Make sure the [`saned`] service is running without errors[$openrc-sane]: +Make sure the {` saned} service is running without errors{fn For OpenRC: {` rc-service saned status}}: ```bash systemctl status saned.service -and make sure the [url http://www.sane-project.org/man/sane-epson2.5.html sane-epson2] (or [url http://www.sane-project.org/man/sane-epson.5.html sane-epson]) back-end is enabled, you should have [`epson2`] (or [`epson`]) without a leading [`#`] inside [`/etc/sane.d/dll.conf`]. +and make sure the {url sane-epson2;http://www.sane-project.org/man/sane-epson2.5.html} (or {url sane-epson;http://www.sane-project.org/man/sane-epson.5.html}) back-end is enabled, you should have {` epson2} (or {` epson}) without a leading {` #} inside {` /etc/sane.d/dll.conf}. ## epkowa plus non-free interpreter @@ -30,15 +26,15 @@ If it's unsupported and there is a note .quote supported by the epkowa backend plus non-free interpreter you can still make it work. -You'll have to get the [=non-free=] (free as in [url https://en.wikipedia.org/wiki/Free_software_movement publicly available source code], you don't have to pay for anything) Epson Scan 2 software. +You'll have to get the {b non-free} (free as in {url publicly available source code;https://en.wikipedia.org/wiki/Free_software_movement}, you don't have to pay for anything) Epson Scan 2 software. -It can be downloaded from [url https://support.epson.net/linux/en/epsonscan2.php the support site] as a [`deb`] or [`rpm`] package. -If your system doesn't natively work with any of those (i.e. it isn't listed under "Distribution" and isn't some sort of derivative of those), you can still try the [`rpm`] package. +It can be downloaded from {url the support site;https://support.epson.net/linux/en/epsonscan2.php} as a {` deb} or {` rpm} package. +If your system doesn't natively work with any of those (i.e. it isn't listed under "Distribution" and isn't some sort of derivative of those), you can still try the {` rpm} package. :ordered -1. Install [`rpm`] with your package manager +1. Install {` rpm} with your package manager -2. Download the 32 or 64 bit [=[ rpm ]=] package +2. Download the 32 or 64 bit {b [ rpm ]} package 3. Extract it @@ -51,12 +47,14 @@ tar -xf epsonscan2-bundle-SOMETHING.rpm.tar.gz sudo rpm -Uvh --nodeps ./epsonscan2-bundle-SOMETHING.rpm/core/epsonscan2-SOMETHING.rpm ./epsonscan2-bundle-SOMETHING.rpm/plugins/epsonscan2-non-free-plugin-SOMETHING.rpm -Alternatively, you can install the [`deb`] package with [`dpkg`] or build and install it from [url https://download.ebz.epson.net/man/linux/epsonscan2_e.html#sec5-1-4 source] (source file is available at the bottom of the [url https://support.epson.net/linux/en/epsonscan2.php support site]). +Alternatively, you can install the {` deb} package with {` dpkg} or build and install it from {url source;https://download.ebz.epson.net/man/linux/epsonscan2_e.html#sec5-1-4} (source file is available at the bottom of the {url support site;https://support.epson.net/linux/en/epsonscan2.php}). -'footnote gentoo-epkowa Surprisingly enough, on my Gentoo installation everything works fine without the package. Either something else is helping me or [url http://www.catb.org/jargon/html/magic-story.html something is in the "more magic" position]... +'footnote gentoo-epkowa Surprisingly enough, on my Gentoo installation everything works fine without the package. Either something else is helping me or {url something is in the "more magic" position;http://www.catb.org/jargon/html/magic-story.html}... -You will need[$gentoo-epkowa] to install [`iscan`], which usually provides the aforementioned [`epkowa`] backend. -Also make sure you have [`epkowa`] inside [`/etc/sane.d/dll.conf`] without a leading [`#`]. +You will need{gentoo-epkowa} to install {` iscan}, which usually provides the aforementioned {` epkowa} backend. +Also make sure you have {` epkowa} inside {` /etc/sane.d/dll.conf} without a leading {` #}. Finally, only for the very first time after connecting your powered-on scanner, start "Epson Scan 2", select it and press "Next". The drivers should automatically be installed and you can close the window and use your own scanning software of choice afterwards. + +{footnotes} diff --git a/src/blog/install-plan9-with-virt-manager/index.du b/src/blog/install-plan9-with-virt-manager/index.du index c60eb31..1160808 100644 --- a/src/blog/install-plan9-with-virt-manager/index.du +++ b/src/blog/install-plan9-with-virt-manager/index.du @@ -1,33 +1,33 @@ -# Install Plan 9 with virt-manager +'def title Install Plan 9 with virt-manager +'def desc Installing Plan 9 isn't difficult, but using virt-manager brings certain complications. -'define expected-reading 4 min -'define created 30 July 2022 -'define edited 30 July 2022 -[$pagenav] +# {title} + +{pagenav 4 min;30 July 2022;30 July 2022} .contents .numbered -1. [url #creating-the-virtual-machine Creating the virtual machine] -2. [url #installing-plan-9-itself Installing Plan 9 itself] +1. {uhref Creating the virtual machine} +2. {uhref Installing Plan 9 itself} -Installing [url https://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs Plan 9 by Bell Labs] with [`qemu`] itself isn't difficult and there are [url https://9p.io/wiki/plan9/Installing_Plan_9_on_Qemu/ official instructions]. However, when using [`virt-manager`], there are certain uncertainties that might worry a first-timer and certain issues that arise. +Installing {url Plan 9 by Bell Labs;https://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs} with {` qemu} itself isn't difficult and there are {url official instructions;https://9p.io/wiki/plan9/Installing_Plan_9_on_Qemu/}. However, when using {` virt-manager}, there are certain uncertainties that might worry a first-timer and certain issues that arise. ## Creating the virtual machine -We'll be installing Plan 9 with a CD (ISO) image. You can download the latest version (compiled every night) from [url https://9p.io/plan9/download.html here]. For a compressed version and checksums, refer to [url https://9p.io/wiki/plan9/Download/index.html this page]. +We'll be installing Plan 9 with a CD (ISO) image. You can download the latest version (compiled every night) from {url here;https://9p.io/plan9/download.html}. For a compressed version and checksums, refer to {url this page;https://9p.io/wiki/plan9/Download/index.html}. :ordered -1. Press the [*"Create a new virtual machine"*] and select [*"Local install media (ISO image or CDROM)"*] +1. Press the {i "Create a new virtual machine"} and select {i "Local install media (ISO image or CDROM)"} -2. For the install media select the extracted [`.iso`] CD image of Plan 9 and for operating system chose [*"Generic or unknown OS (generic)"*] +2. For the install media select the extracted {` .iso} CD image of Plan 9 and for operating system chose {i "Generic or unknown OS (generic)"} 3. For memory select 512 MiB (the default 1024 MiB is also fine) and 1 CPU .unordered - - Plan 9 is stupid lightweight and according to [url https://9p.io/wiki/plan9/Installation_instructions/index.html the installation instructions] you need 16-32 MB of memory, but I still prefer to give it a little more, just in case I decide to do something extreme. + - Plan 9 is stupid lightweight and according to {url the installation instructions;https://9p.io/wiki/plan9/Installation_instructions/index.html} you need 16-32 MB of memory, but I still prefer to give it a little more, just in case I decide to do something extreme. - You can also increase these values as much as you like, Plan 9 should be able to handle the more resources -4. If you plan to only test the OS out, choose [*"Create a disk image for the virtual machine"*] and enter 2 GiB of size. If you plan more serious use, you might want to follow [url https://9p.io/wiki/plan9/Installing_Plan_9_on_Qemu/ the qemu instructions] and create a larger disk in the [`.raw`] format. +4. If you plan to only test the OS out, choose {i "Create a disk image for the virtual machine"} and enter 2 GiB of size. If you plan more serious use, you might want to follow {url the qemu instructions;https://9p.io/wiki/plan9/Installing_Plan_9_on_Qemu/} and create a larger disk in the {` .raw} format. 5. Finally click finish. @@ -35,57 +35,57 @@ We'll be installing Plan 9 with a CD (ISO) image. You can download the latest ve ## Installing Plan 9 itself If everything worked correctly, on boot you should see the screen in step 1. -From here on out, it's dead simple, and I even recommend just going through [url https://www.youtube.com/watch?v=NNWFTq0ZwLE Hatty Hacker's "Basic Plan 9 Installation" YouTube video]. +From here on out, it's dead simple, and I even recommend just going through {url Hatty Hacker's "Basic Plan 9 Installation" YouTube video;https://www.youtube.com/watch?v=NNWFTq0ZwLE}. I'll show a more abridged version of what you need to do. :ordered 1. On the boot screen press 1 and enter - [image ./img/boot-screen.png] + {img ./img/boot-screen.png} 2. On the questions "use DMA for ide drive" and "mouseport is" press enter -3. On "vgasize" press enter, or set up a higher (standard) resolution with 24 colors. Examples: [`1920x1080x24`], [`1280x720x24`] +3. On "vgasize" press enter, or set up a higher (standard) resolution with 24 colors. Examples: {` 1920x1080x24}, {` 1280x720x24} .unordered - - A very incomplete list can be found [url https://9p.io/wiki/plan9/setting_the_right_monitor_size/index.html here] + - A very incomplete list can be found {url here;https://9p.io/wiki/plan9/setting_the_right_monitor_size/index.html} -4. [=Very important!=] On "monitor" enter [`vesa`]. [`xga`] (or [`vga`]) will work during installation but seem to break when booting the installed OS. +4. {b Very important!} On "monitor" enter {` vesa}. {` xga} (or {` vga}) will work during installation but seem to break when booting the installed OS. .unordered - - If you mistakenly leave it at [`xga`], refer to [url /blog/fix-no-frame-buffer-plan9 this tutorial]. + - If you mistakenly leave it at {` xga}, refer to {url this tutorial;/blog/fix-no-frame-buffer-plan9}. From here on out, you press enter at most of the prompts. The following list enumerates all cases where you need to do something else than press enter. :ordered -1. On "Disk partiton" question, enter [`sdC0`] (the option that says Hard Disk on it) +1. On "Disk partiton" question, enter {` sdC0} (the option that says Hard Disk on it) - [image ./img/partdisk-partition.png] + {img ./img/partdisk-partition.png} -2. On "Install mbr" question, enter [`y`] +2. On "Install mbr" question, enter {` y} - [image ./img/partdisk-mbr.png] + {img ./img/partdisk-mbr.png} -3. When you get ">>>" before the cursor, press w, then enter, then q and finally enter. This should happen twice, when in [`disk/fdisk`] and [`disk/prep`] +3. When you get ">>>" before the cursor, press w, then enter, then q and finally enter. This should happen twice, when in {` disk/fdisk} and {` disk/prep} - [image ./img/partdisk-fdisk.png] + {img ./img/partdisk-fdisk.png} - [image ./img/prepdisk-prep.png] + {img ./img/prepdisk-prep.png} -4. On "Distribution disk" type out the one that ends with [`data`] (and potentially has [`cdrom`] besides it). This is most commonly [`/dev/sdC1/data`] +4. On "Distribution disk" type out the one that ends with {` data} (and potentially has {` cdrom} besides it). This is most commonly {` /dev/sdC1/data} - [image ./img/mountdist-distribution-disk.png] + {img ./img/mountdist-distribution-disk.png} -5. When you get "/%" before cursor (during mountdisk task) just enter [`exit`] +5. When you get "/%" before cursor (during mountdisk task) just enter {` exit} - [image ./img/mountdist-browse.png] + {img ./img/mountdist-browse.png} -6. On "Enable boot method" enter [`plan9`] +6. On "Enable boot method" enter {` plan9} - [image ./img/bootsetup-boot-method.png] + {img ./img/bootsetup-boot-method.png} After finishing the installation and seeing the message "Feel free to shutdown your computer", Force Off the virtual machine and then power it on again. -On boot, on the first prompt press enter, and on the second enter [`glenda`]. Enjoy Plan 9! +On boot, on the first prompt press enter, and on the second enter {` glenda}. Enjoy Plan 9! diff --git a/src/blog/making-sense-of-android-root/index.du b/src/blog/making-sense-of-android-root/index.du new file mode 100644 index 0000000..c34ca1f --- /dev/null +++ b/src/blog/making-sense-of-android-root/index.du @@ -0,0 +1,69 @@ +# Making sense of Android root + +'define expected-reading ? min +'define created ? +'define edited ? +[$pagenav] + +## Revision on Android rooting + +## Root solutions + +### Magisk + +The init process starts the system, it launches zygote processes. +The entire point is that root level access is extremely restricted, init removes its own access after booting and zygote never allows it to begin with. +Of course, certain stuff need root access, but this is effectively determined at boot and in your boot image. + +In essence, magisk inserts itself in init, so that a special Magisk process is launched, which has full privileges, and everything else is then resumed. +This is why you need to patch/flash boot.img, that is where the instruction for init are located. + +### KernelSU + +It extends the linux kernel with additional features. +Instead of creating a new process, everything works as normal, except that when apps launch syscalls to the kernel, something else could happen than normal. + +You still need to patch/flash boot.img, since that is where the kernel resides, but in general, kernelsu is better hidden/hideable and more powerful. + +## Modules + +### Zygisk + +In Android, all system and user processes (with the same ABI) are started by the "Zygote" process. +zygisk (zygote - magisk) is inserted in the zygote process, which then allows you to fully control how new processes are handled. +You can force them to execute custom code, you can change file access, etc. + +### SuSFS + +Hides paths on the filesystem level at the kernel level. + +### XPosed + +Allows you to insert ROM-level modules, without flashing a new ROM. +So, changes which you'll normally need to make at the Android source-code level, which will be then compiled into a new ROM (version), can be made in-place without all that. + +## Google Play Integrity + +To increase security, google implemented play integrity: a series of checks which happen on your device, which allows apps to verify whether +you device has been tampered with in any way. +The app requests an "integrity token", Google Play Services (not Android itself!) evaluates the device state, returns an encrypted token with the +resultant device status and then the app (should) sends it back to the servers for decryption and decision making. + +### Basic Integrity + +This checks for properties on your device. +As you can imagine, it is not too difficult to circumvent, so every time it checks for bootloader unlock, for example, it returns false. + +### Device Integrity + +This method is harder to pass and uses device fingerprinting. +The device and user interactions are monitored and a unique ID is created. +This is much harder to fix, and the solution is to essentially just use a working fingerprint. +And to pass arbitrary fingerprints you need root. + +### Strong Integrity + +This creates checks using your CPU's trusted execution environment. +This environment knows something is up the moment you unlock your bootloader, so there is no way to spoof the check. +Our only saving grace is that most devices do not support this feature, so there are modules which trick the system into thinking the device is older and to pass the check without really doing it. + diff --git a/src/blog/managing-apps-with-adb-without-root/index.du b/src/blog/managing-apps-with-adb-without-root/index.du index 3dd9ae1..b4b0fd9 100644 --- a/src/blog/managing-apps-with-adb-without-root/index.du +++ b/src/blog/managing-apps-with-adb-without-root/index.du @@ -1,38 +1,38 @@ -# Managing apps with ADB (and without root) +'def title Managing apps with ADB (and without root) +'def desc Often new phones come with a lot of bloatware, which usually cannot be uninstalled from within the phone. This could be circumvented by rooting your device, but a better solution is using the Android Debug Bridge. -'define expected-reading 8 min -'define created 25 February 2023 -'define edited 25 February 2023 -[$pagenav] +# {title} + +{pagenav 8 min;25 February 2023;25 February 2023} .contents .numbered -1. [url #installing Installing] -2. [url #opening-a-shell-and-connecting-to-your-device Opening a shell and connecting to your device] -3. [url #managing-applications Managing applications] -4. [url #what-to-remove What to remove] +1. {uhref Installing} +2. {uhref Opening a shell and connecting to your device} +3. {uhref Managing applications} +4. {uhref What to remove} Often new phones, especially Samsung ones, come with a whole lot of bloatware, which usually cannot be uninstalled from within the phone. -This could be circumvated by rooting your phone, essentially gaining full administrative control over the device, however this process can be somewhat involved and could [url https://www.xda-developers.com/samsung-galaxy-z-fold-3-unlock-bootloader-broken-camera/ cause issues]. +This could be circumvated by rooting your phone, essentially gaining full administrative control over the device, however this process can be somewhat involved and could {url cause issues;https://www.xda-developers.com/samsung-galaxy-z-fold-3-unlock-bootloader-broken-camera/}. A better solution is using the Android Debug Bridge (ADB), a developer tool with which you can more fluently control your device. Of course, you still won't get full control, but it is as close as it gets, without requiring any permanent and involved configurations. -If you're having trouble, [url https://www.xda-developers.com/install-adb-windows-macos-linux/ XDA's article], as well as [url https://www.maketecheasier.com/uninstall-system-apps-without-root-android/ these] [url https://www.maketecheasier.com/get-started-with-android-debug-bridge-adb/ maketecheasier] [url https://www.maketecheasier.com/enable-developer-options-in-android-42/ articles] go into more detail and show pictures. +If you're having trouble, {url XDA's article;https://www.xda-developers.com/install-adb-windows-macos-linux/}, as well as {url these;https://www.maketecheasier.com/uninstall-system-apps-without-root-android/} {url maketecheasier;https://www.maketecheasier.com/get-started-with-android-debug-bridge-adb/} {url articles;https://www.maketecheasier.com/enable-developer-options-in-android-42/} go into more detail and show pictures. ## Installing Windows: .numbered -1. Download the official platform tools from [url https://dl.google.com/android/repository/platform-tools-latest-windows.zip here] +1. Download the official platform tools from {url here;https://dl.google.com/android/repository/platform-tools-latest-windows.zip} 2. Extract the files in a folder and navigate to it Linux (or MacOS): .bulleted -- With your package manager, it should be called [`android-tools`], [`android-tools-adb`] or [`android-platform-tools`] -- Worst case scenario, download and extract it from [url https://dl.google.com/android/repository/platform-tools-latest-linux.zip here] for Linux, and [url https://dl.google.com/android/repository/platform-tools-latest-darwin.zip here] for MacOS. +- With your package manager, it should be called {` android-tools}, {` android-tools-adb} or {` android-platform-tools} +- Worst case scenario, download and extract it from {url here;https://dl.google.com/android/repository/platform-tools-latest-linux.zip} for Linux, and {url here;https://dl.google.com/android/repository/platform-tools-latest-darwin.zip} for MacOS. ## Opening a shell and connecting to your device @@ -40,66 +40,66 @@ ADB is very powerfull, so by default phones don't allow you to connect to the de First, we'll allow such a connection: .numbered -1. Go to [`Settings/About phone`] (depending on your Android skin, this might be located in a slightly different place) +1. Go to {` Settings/About phone} (depending on your Android skin, this might be located in a slightly different place) 2. Tap "Build number" 7 times, until a message says you're done -3. Navigate to the Developer options, which is often in [`Settings/Developer options`], but could also be inside the [`Settings/System`] menu +3. Navigate to the Developer options, which is often in {` Settings/Developer options}, but could also be inside the {` Settings/System} menu 4. Enable the "USB debugging option" (if a popup appears, click OK) ADB is a command-line only tool, so first open a terminal inside the platform-tools directory: .bulleted - On Window, Right-click in the directory and press "Open PowerShell window here" or "Open command window here" or "Open in Terminal" (different OS versions show a different option) -- On Linux (and MacOS), open a terminal window and [`cd`] to the platform-tools directory +- On Linux (and MacOS), open a terminal window and {` cd} to the platform-tools directory Connect your phone to the computer with a USB cable, change the transfer mode to "File transfer" and in the terminal enter: -```shell +```sh adb devices On your phone you should get a poppup asking "Allow USB debugging?", press OK. You should get a "List of devices attached", and it should have one entry (a line below it, with some number and letters and then the word "device"). -'footnote interactive-shell You could just run every command like [`adb shell COMMAND`], which wouldn't give you an interactive shell, so it is less convinient +'footnote interactive-shell You could just run every command like {` adb shell COMMAND}, which wouldn't give you an interactive shell, so it is less convinient -Now, we'll open a shell[$interactive-shell], a program with which to directly enter commands that the device understands: +Now, we'll open a shell{interactive-shell}, a program with which to directly enter commands that the device understands: -```shell +```sh adb shell ## Managing applications There are 3 general commands that you would want to use: -```shell +```sh pm list packages Which prints the internal names of all applications that are installed on the device. All of the other commands use those names (without the leading "package:", if it exists) for referring to applications. -```shell +```sh pm uninstall -k --user 0 PACKAGE Where PACKAGE is an aforementioned application name. This command just uninstalls the app for the normal user, meaning it will be brought back on factory reset. -```shell +```sh pm disable --user 0 PACKAGE Disabled PACKAGE, so it wouldn't work but you wouldn't need to reinstall it (just enable it). -Beware that, if it shows some sort of error (anything that isn't "Success"), you'll probably need to use [`disable-user`], rather than just [`disable`]. +Beware that, if it shows some sort of error (anything that isn't "Success"), you'll probably need to use {` disable-user}, rather than just {` disable}. -After you're done, you can pretty much just unplug your device, but remember to [=turn back off the "USB debugging" option!=] +After you're done, you can pretty much just unplug your device, but remember to {b turn back off the "USB debugging" option!} ## What to remove This is a lost of commands, which remove a whole lot of arguably unnecessary apps. -Use [=AT YOUR OWN RISK!=] -Although they shouldn't, they might cause problems [=FOR WHICH I'M NOT RESPONSIBLE!=] +Use {b AT YOUR OWN RISK!} +Although they shouldn't, they might cause problems {b FOR WHICH I'M NOT RESPONSIBLE!} :unordered - Facebook -```shell +```sh pm uninstall -k --user 0 package:com.facebook.services pm uninstall -k --user 0 package:com.facebook.katana pm uninstall -k --user 0 package:com.facebook.system @@ -107,13 +107,13 @@ pm uninstall -k --user 0 package:com.facebook.appmanager - Netflix -```shell +```sh pm uninstall -k --user 0 com.netflix.partner.activation pm uninstall -k --user 0 com.netflix.mediaclient - Microsoft apps -```shell +```sh pm uninstall -k --user 0 com.microsoft.skydrive pm uninstall -k --user 0 com.skype.raider pm uninstall -k --user 0 com.microsoft.office.excel @@ -122,7 +122,7 @@ pm uninstall -k --user 0 com.microsoft.office.powerpoint - Google apps -```shell +```sh pm uninstall -k --user 0 com.google.android.googlequicksearchbox pm uninstall -k --user 0 com.google.android.gm pm uninstall -k --user 0 com.google.android.apps.tachyon @@ -141,17 +141,17 @@ pm uninstall -k --user 0 com.google.android.apps.plus - Windows 10 Phone comanion -```shell +```sh pm uninstall -k --user 0 com.microsoft.appmanager - AR Emoji -```shell +```sh pm uninstall -k --user 0 com.samsung.android.aremoji - Bixby -```shell +```sh pm uninstall -k --user 0 com.samsung.android.bixby.agent pm uninstall -k --user 0 com.samsung.android.bixby.es.globalaction pm uninstall -k --user 0 com.samsung.android.bixbyvision.framework @@ -169,7 +169,7 @@ pm uninstall -k --user 0 com.samsung.android.app.spage - Samsung Pass/Pay -```shell +```sh pm uninstall -k --user 0 com.samsung.android.samsungpassautofill pm uninstall -k --user 0 com.samsung.android.authfw pm uninstall -k --user 0 com.samsung.android.samsungpass @@ -178,13 +178,13 @@ pm uninstall -k --user 0 com.samsung.android.spayfw - Samsung Kids -```shell +```sh pm uninstall -k --user 0 com.samsung.android.kidsinstaller pm uninstall -k --user 0 com.samsung.android.app.camera.sticker.facearavatar.preload - Samsung Game Launcher -```shell +```sh pm uninstall -k --user 0 com.samsung.android.game.gamehome pm uninstall -k --user 0 com.enhance.gameservice pm uninstall -k --user 0 com.samsung.android.game.gametools @@ -192,50 +192,50 @@ pm uninstall -k --user 0 com.samsung.android.game.gos - Galaxy Friends -```shell +```sh pm uninstall -k --user 0 com.samsung.android.mateagent - Samsung Smartthings -```shell +```sh pm uninstall -k --user 0 com.samsung.android.easysetup pm uninstall -k --user 0 com.samsung.android.beaconmanager pm uninstall -k --user 0 com.samsung.android.oneconnect - Carmode -```shell +```sh pm uninstall -k --user 0 com.samsung.android.drivelink.stub - Stickers -```shell +```sh pm uninstall -k --user 0 com.sec.android.mimage.avatarstickers - Samsung Global Goals -```shell +```sh pm uninstall -k --user 0 com.samsung.sree - Samsung Members -```shell +```sh pm uninstall -k --user 0 com.samsung.android.voc - Samsung LED cover -```shell +```sh pm uninstall -k --user 0 com.samsung.android.app.ledbackcover pm uninstall -k --user 0 com.sec.android.cover.ledcover - Samsung TV -```shell +```sh pm uninstall -k --user 0 com.sec.android.app.withtv - Knox -```shell +```sh pm uninstall -k --user 0 com.samsung.knox.securefolder pm uninstall -k --user 0 com.knox.vpn.proxyhandler pm uninstall -k --user 0 com.samsung.knox.keychain @@ -246,33 +246,33 @@ pm uninstall -k --user 0 com.samsung.android.knox.containercore - Samsung DEX -```shell +```sh pm uninstall -k --user 0 com.sec.android.desktopmode.uiservice pm uninstall -k --user 0 com.samsung.desktopsystemui pm uninstall -k --user 0 com.sec.android.app.desktoplauncher - Samsung Browser -```shell +```sh pm uninstall -k --user 0 com.sec.android.app.sbrowser pm uninstall -k --user 0 com.samsung.android.app.sbrowseredge - Samsung Email -```shell +```sh pm uninstall -k --user 0 com.samsung.android.email.provider pm uninstall -k --user 0 com.wsomacp - Samsung Smartthings -```shell +```sh pm uninstall -k --user 0 com.samsung.android.easysetup pm uninstall -k --user 0 com.samsung.android.beaconmanager pm uninstall -k --user 0 com.samsung.android.oneconnect - Gear VR -```shell +```sh pm uninstall -k --user 0 com.samsung.android.hmt.vrsvc pm uninstall -k --user 0 com.samsung.android.app.vrsetupwizardstub pm uninstall -k --user 0 com.samsung.android.hmt.vrshell @@ -280,19 +280,19 @@ pm uninstall -k --user 0 com.google.vr.vrcore - Printings -```shell +```sh pm uninstall -k --user 0 com.android.bips pm uninstall -k --user 0 com.google.android.printservice.recommendation pm uninstall -k --user 0 com.android.printspooler - Upday news -```shell +```sh pm uninstall -k --user 0 de.axelspringer.yana.zeropage - Verizon -```shell +```sh pm uninstall -k --user 0 com.vcast.mediamanager pm uninstall -k --user 0 com.samsung.vmmhux pm uninstall -k --user 0 com.vzw.hss.myverizon @@ -304,12 +304,12 @@ pm uninstall -k --user 0 com.vznavigator.[You_Model_Here] - T-mobile -```shell +```sh pm uninstall -k --user 0 com.mobitv.client.tmobiletvhd pm uninstall -k --user 0 us.com.dt.iq.appsource.tmobile \n -More information on available package commands can be shown with [`pm help`]. -You can learn more about the adb tool from [url https://developer.android.com/studio/command-line/adb developer.android.com]. +More information on available package commands can be shown with {` pm help}. +You can learn more about the adb tool from {url developer.android.com;https://developer.android.com/studio/command-line/adb}. diff --git a/src/blog/microsoft-and-foss-extinguish/index.du b/src/blog/microsoft-and-foss-extinguish/index.du index f699a64..0f99b45 100644 --- a/src/blog/microsoft-and-foss-extinguish/index.du +++ b/src/blog/microsoft-and-foss-extinguish/index.du @@ -1,21 +1,21 @@ -# Microsoft and FOSS: a fire to be extinguished +'def title Microsoft and FOSS: a fire to be extinguished +'def desc Sharing my thoughts on how Microsoft is (probably) trying to kill FOSS in the long term -'define expected-reading 6 min -'define created 20 February 2024 -'define edited 20 February 2024 -[$pagenav] +# {title} + +{pagenav 6 min;20 February 2024;20 February 2024} .contents .numbered -1. [url #githubs-embrace-and-extensions GitHub's embrace and extensions] -2. [url #blowtorch-to-the-penguin Blowtorch to the penguin] -3. [url #but-these-are-good-things-for-the-user But these are good things for the user] +1. {uhref GitHub's embrace and extensions} +2. {uhref Blowtorch to the penguin} +3. {uhref But these are good things for the user} .numbered - 1. [url #the-practical-answer The practical answer] - 2. [url #the-moral-answer The moral answer] + 1. {uhref The practical answer} + 2. {uhref The moral answer} -A week ago [url https://devblogs.microsoft.com/commandline/introducing-sudo-for-windows/ Microsoft announced they'll be adding "sudo" to Windows]. -I'm not really knowledgeable enough to be certain what I'm saying is true, so I could be wrong, but upon hearing these news, my mind immediately jumped to the [url https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguish EEE: Embrace, Extend, Extinguish]. +A week ago {url Microsoft announced they'll be adding "sudo" to Windows;https://devblogs.microsoft.com/commandline/introducing-sudo-for-windows/}. +I'm not really knowledgeable enough to be certain what I'm saying is true, so I could be wrong, but upon hearing these news, my mind immediately jumped to the {url EEE: Embrace, Extend, Extinguish;https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguish}. As it is explained on Wikipedia, this is a very old and successful tactic, where Microsoft would enter new markets by: @@ -31,22 +31,22 @@ Open-source by itself is primarily about publishing the source code of your proj Now we have: .bulleted -- [url https://octoverse.github.com/ GitHub Octoverse], yearly reports on open-source globally, but quite often through the lens of GitHub -- [url https://resources.github.com/newsletter/ GitHub Insider], a monthly newsletter -- [url https://github.com/features/copilot/ GitHub Copilot], an AI developer tool -- [url https://github.com/enterprise GitHub Enterprise], an AI developer platform -- [url https://github.blog/ GitHub blog], mostly a set of tutorials and informational articles regarding GitHub +- {url GitHub Octoverse;https://octoverse.github.com/}, yearly reports on open-source globally, but quite often through the lens of GitHub +- {url GitHub Insider;https://resources.github.com/newsletter/}, a monthly newsletter +- {url GitHub Copilot;https://github.com/features/copilot/}, an AI developer tool +- {url GitHub Enterprise;https://github.com/enterprise}, an AI developer platform +- {url GitHub blog;https://github.blog/}, mostly a set of tutorials and informational articles regarding GitHub and the list just goes on. GitHub isn't just a public place to view open-source software anymore, if you are a novice developer or you just don't care that much, it will be very easy to associate the FOSS community with the GitHub community. Once you've started using all of those services and tools, there is no coming back, because other repository platforms focus only on repositories. -I mean, [url https://gitlab.com/ GitLab] doesn't offer a developer forum like [url https://docs.github.com/en/discussions/collaborating-with-your-community-using-discussions/about-discussions GitHub Discussions], you won't find a [url https://sourcehut.org/ sourcehut]-branded FOSS newsletter, [url https://sourceforge.net/ SourceForge] won't allow you to add [url https://github.com/abhisheknaiidu/awesome-github-profile-readme animations, graphics, games, etc. on your profile], there isn't a [url https://codeberg.org/ codeberg] [url https://cli.github.com/ command-line repository management app], so [*obviously GitHub is where it's at for FOSS*]. +I mean, {url GitLab;https://gitlab.com/} doesn't offer a developer forum like {url GitHub Discussions;https://docs.github.com/en/discussions/collaborating-with-your-community-using-discussions/about-discussions}, you won't find a {url sourcehut;https://sourcehut.org/}-branded FOSS newsletter, {url SourceForge;https://sourceforge.net/} won't allow you to add {url animations, graphics, games, etc. on your profile;https://github.com/abhisheknaiidu/awesome-github-profile-readme}, there isn't a {url codeberg;https://codeberg.org/} {url command-line repository management app;https://cli.github.com/}, so {i obviously GitHub is where it's at for FOSS}. -And you'll be introduced to GitHub before any of the others, thanks to the [url https://education.github.com/pack GitHub Student Developer Pack], where students can get free access to a variety of services, or to [url https://docs.github.com/en/education/manage-coursework-with-github-classroom/get-started-with-github-classroom/about-github-classroom GitHub classroom], where newer developers will probably publish their first pieces of code. +And you'll be introduced to GitHub before any of the others, thanks to the {url GitHub Student Developer Pack;https://education.github.com/pack}, where students can get free access to a variety of services, or to {url GitHub classroom;https://docs.github.com/en/education/manage-coursework-with-github-classroom/get-started-with-github-classroom/about-github-classroom}, where newer developers will probably publish their first pieces of code. -Why learn to use the git terminal command when [url https://desktop.github.com/ GitHub Desktop] abstract everything away in a beautiful clicky interface (as a "bonus", this will make you associate git with GitHub too), why follow [url https://news.ycombinator.com/ Hacker News] or multiple different FOSS websites, when Microsoft provides. +Why learn to use the git terminal command when {url GitHub Desktop;https://desktop.github.com/} abstract everything away in a beautiful clicky interface (as a "bonus", this will make you associate git with GitHub too), why follow {url Hacker News;https://news.ycombinator.com/} or multiple different FOSS websites, when Microsoft provides. Why learn anything, when Microsoft's GitHub serves it to you on a silver platter? Well, for an increasing number of developers, I fear, the answer is: "there is no point". @@ -54,10 +54,10 @@ Well, for an increasing number of developers, I fear, the answer is: "there is n ## Blowtorch to the penguin Now let's talk about Microsoft's other plaything: Linux. -Here, I feel, the tactic is even more obvious: thanks to [url https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux WSL], Linux applications look and run like any other Windows app. -Thanks to [url https://en.wikipedia.org/wiki/Windows_Terminal Windows Terminal], Windows can't be seen as a lesser OS for developers, all benefits of having a proper, fully-fledged, UNIX-like command-line can now be found on Windows. +Here, I feel, the tactic is even more obvious: thanks to {url WSL;https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux}, Linux applications look and run like any other Windows app. +Thanks to {url Windows Terminal;https://en.wikipedia.org/wiki/Windows_Terminal}, Windows can't be seen as a lesser OS for developers, all benefits of having a proper, fully-fledged, UNIX-like command-line can now be found on Windows. -I mean, they've added the sudo command for crying out loud, there is even an official [url https://en.wikipedia.org/wiki/Windows_Package_Manager Windows package manager]! +I mean, they've added the sudo command for crying out loud, there is even an official {url Windows package manager;https://en.wikipedia.org/wiki/Windows_Package_Manager}! For a novice or someone uninterested, you wouldn't ever have to learn how to use Linux. You'll use Windows as you've known for your entire life, and if you need something even vaguely related to Linux, you'll just easily get it on another silver platter. @@ -82,7 +82,7 @@ It's tempting to imagine Linux software or Linux projects turn into Windows soft ### The moral answer -[url https://en.wikipedia.org/wiki/We_choose_to_go_to_the_Moon We do things, not because they are easy, but because they are hard]. +{url We do things, not because they are easy, but because they are hard;https://en.wikipedia.org/wiki/We_choose_to_go_to_the_Moon}. Knowledge is the most important resource we have, everything humanity has achieved has been with the creation, expansion and distribution of knowledge. Developers are the craftsmen of computer software and to create you need knowledge, the more you have the more you can do. diff --git a/src/blog/mundus-first-shot-at-gamedev/basic-concepts.du b/src/blog/mundus-first-shot-at-gamedev/basic-concepts.du index 630ed2f..4bc87f8 100644 --- a/src/blog/mundus-first-shot-at-gamedev/basic-concepts.du +++ b/src/blog/mundus-first-shot-at-gamedev/basic-concepts.du @@ -1,25 +1,23 @@ -# Basic Concepts - Mundus: My first shot at game development +'def title Basic Concepts - Mundus: My first shot at game development +'def desc A deep dive into a small GTK-based game I developed -'define expected-reading 5 min -'define created 21 July 2020 -'define edited 25 November 2020 -[$pagenav] +# {title} -'define start_link ./ -'define prev_link ./user-interface.html User Interface -[$pagination_end] +{pagenav 5 min;21 July 2020;25 November 2020} -[$due_for_rework] +{pagination ./;User Interface;./user-interface.html} + +{due_for_rework} \n .contents .numbered -1. [url #tiles Tiles] -2. [url #layers-and-superlayers Layers and superlayers] -3. [url #inventory Inventory] -4. [url #crafting Crafting] -5. [url #event-logs Event logs] +1. {uhref Tiles} +2. {uhref Layers and superlayers} +3. {uhref Inventory} +4. {uhref Crafting} +5. {uhref Event logs} Even though the game is quite unfinished, there are still a fair bit of mechanics I've developed. @@ -27,7 +25,7 @@ Even though the game is quite unfinished, there are still a fair bit of mechanic The in game world (map) is composed of squares, called tiles. Everything is a type of tile. There are two main categories of tiles: items and mobs. Mobs (mobile object for short) are the creatures in the game, while items are everything else, from the tools, to the trees. -There is only one type of mob tile and that is [`MobTiles`]. All mobs, with the exception of the player, have the same functionality and properties: +There is only one type of mob tile and that is {` MobTiles}. All mobs, with the exception of the player, have the same functionality and properties: :unordered - health - if it drops to or below 0, they die @@ -72,11 +70,11 @@ The in game world (map) is composed of superlayers. Superlayers represent each e Each superlayer is composed of 3 layers: Structure, Mob and Ground. Each one of them contains a specific type of tiles, meaning structure tiles are only stored in "structure" layer, ground tiles only in "ground" layer and mob tiles only in "mob" layer. Even though, they are different layers, there are some rules for the interaction between them: :unordered -- [=Mobs cannot be on top of structures=], except if the structure is marked as "walkable" +- {b Mobs cannot be on top of structures}, except if the structure is marked as "walkable" -- [=Structures cannot be placed on top of mobs=]. "Walkable" structures can be placed below a mob. +- {b Structures cannot be placed on top of mobs}. "Walkable" structures can be placed below a mob. -- [=Structures cannot be placed on top of holes=] (empty spots in the ground layer), [=except if they are "climable"=], in which case they will be placed in the structure layer on the superlayer below. Mobs also cannot reside on top of holes (they fall to the superlayer below) +- {b Structures cannot be placed on top of holes} (empty spots in the ground layer), {b except if they are "climable"}, in which case they will be placed in the structure layer on the superlayer below. Mobs also cannot reside on top of holes (they fall to the superlayer below) ## Inventory diff --git a/src/blog/mundus-first-shot-at-gamedev/index.du b/src/blog/mundus-first-shot-at-gamedev/index.du index 9c1cabf..f5656fc 100644 --- a/src/blog/mundus-first-shot-at-gamedev/index.du +++ b/src/blog/mundus-first-shot-at-gamedev/index.du @@ -1,48 +1,47 @@ -# Introduction - Mundus: My first shot at game development +'def title Introduction - Mundus: My first shot at game development +'def desc General background on Mundus -'define expected-reading 2 min -'define created 21 July 2020 -'define edited 25 November 2020 -[$pagenav] +# {title} -'define next_link ./timeline.html Timeline -[$pagination_start] +{pagenav 2 min;21 July 2020;25 November 2020} -[$due_for_rework] +{pagination ;;;Timeline;./timeline.html} + +{due_for_rework} \n :contents :numbered -1. [url ./timeline.html Timeline] -2. [url ./user-interface.html User Interface] +1. {url Timeline;./timeline.html} +2. {url User Interface;./user-interface.html} .numbered - 1. [url ./user-interface.html#main-screen Main screen] - 2. [url ./user-interface.html#create-new-game Create new game] - 3. [url ./user-interface.html#game-window Game Window] - 4. [url ./user-interface.html#map-menu Map menu] - 5. [url ./user-interface.html#inventory-menu Inventory menu] - 6. [url ./user-interface.html#crafting-menu Crafting menu] + 1. {url Main screen;./user-interface.html#main-screen} + 2. {url Create new game;./user-interface.html#create-new-game} + 3. {url Game Window;./user-interface.html#game-window} + 4. {url Map menu;./user-interface.html#map-menu} + 5. {url Inventory menu;./user-interface.html#inventory-menu} + 6. {url Crafting menu;./user-interface.html#crafting-menu} -3. [url ./basic-concepts.html Basic Concepts] +3. {url Basic Concepts;./basic-concepts.html} .numbered - 1. [url ./basic-concepts.html#tiles Tiles] - 2. [url ./basic-concepts.html#layers-and-superlayers Layers and superlayers] - 3. [url ./basic-concepts.html#inventory Inventory] - 4. [url ./basic-concepts.html#crafting Crafting] - 5. [url ./basic-concepts.html#event-logs Event logs] + 1. {url Tiles;./basic-concepts.html#tiles} + 2. {url Layers and superlayers;./basic-concepts.html#layers-and-superlayers} + 3. {url Inventory;./basic-concepts.html#inventory} + 4. {url Crafting;./basic-concepts.html#crafting} + 5. {url Event logs;./basic-concepts.html#event-logs} -I have been toying with the idea of making a game ever since my first exposure to programming. The [url https://gitlab.com/Syndamia/Shower/-/tree/master/ARK%20(2015 earliest piece of code]) I ever wrote was about replicating a computer boot up sequence from the video game [url https://store.steampowered.com/app/282140/SOMA/ SOMA]. I developed it in 2015, solid 3 years before my first proper introduction to software development. +I have been toying with the idea of making a game ever since my first exposure to programming. The {url earliest piece of code;https://gitlab.com/Syndamia/Shower/-/tree/master/ARK%20(2015}) I ever wrote was about replicating a computer boot up sequence from the video game {url SOMA;https://store.steampowered.com/app/282140/SOMA/}. I developed it in 2015, solid 3 years before my first proper introduction to software development. Five years later, in early 2020, I had to make a project for an exam. I (initially) had about a month to complete it and the only requirements were technical: utilize a database with at least x tables, employ a specific design pattern, etc. Fairly quickly I decided upon making a "minecraftian" game: 2D sandbox where you could fight, craft, build, eat and explore. -I called it [url https://gitlab.com/Syndamia/Mundus Mundus] and it took me around 3 months to complete and consisted of more than 2000 lines of code. Although these metrics aren't very impressive in the real world, they were a monumental achievement for me. In the beginning I planned on developing it into a fully fledged game, but that never happened. +I called it {url Mundus;https://gitlab.com/Syndamia/Mundus} and it took me around 3 months to complete and consisted of more than 2000 lines of code. Although these metrics aren't very impressive in the real world, they were a monumental achievement for me. In the beginning I planned on developing it into a fully fledged game, but that never happened. Nevertheless, this journey was very important to me, hence writing this multi-page article. -[=Link to the source code=]: [url https://gitlab.com/Syndamia/Mundus GitLab] +{b Link to the source code}: {url GitLab;https://gitlab.com/Syndamia/Mundus} ## Screenshots @@ -52,4 +51,4 @@ Nevertheless, this journey was very important to me, hence writing this multi-pa <img src="./img/inventory-menu.png" style="height: 100%; flex: 1;"> </div> -[*Screenshots are made on Linux Mint Cinnamon with the Mint-Y theme*] +{i Screenshots are made on Linux Mint Cinnamon with the Mint-Y theme} diff --git a/src/blog/mundus-first-shot-at-gamedev/introduction.du b/src/blog/mundus-first-shot-at-gamedev/introduction.du index 9c1cabf..f5656fc 100644 --- a/src/blog/mundus-first-shot-at-gamedev/introduction.du +++ b/src/blog/mundus-first-shot-at-gamedev/introduction.du @@ -1,48 +1,47 @@ -# Introduction - Mundus: My first shot at game development +'def title Introduction - Mundus: My first shot at game development +'def desc General background on Mundus -'define expected-reading 2 min -'define created 21 July 2020 -'define edited 25 November 2020 -[$pagenav] +# {title} -'define next_link ./timeline.html Timeline -[$pagination_start] +{pagenav 2 min;21 July 2020;25 November 2020} -[$due_for_rework] +{pagination ;;;Timeline;./timeline.html} + +{due_for_rework} \n :contents :numbered -1. [url ./timeline.html Timeline] -2. [url ./user-interface.html User Interface] +1. {url Timeline;./timeline.html} +2. {url User Interface;./user-interface.html} .numbered - 1. [url ./user-interface.html#main-screen Main screen] - 2. [url ./user-interface.html#create-new-game Create new game] - 3. [url ./user-interface.html#game-window Game Window] - 4. [url ./user-interface.html#map-menu Map menu] - 5. [url ./user-interface.html#inventory-menu Inventory menu] - 6. [url ./user-interface.html#crafting-menu Crafting menu] + 1. {url Main screen;./user-interface.html#main-screen} + 2. {url Create new game;./user-interface.html#create-new-game} + 3. {url Game Window;./user-interface.html#game-window} + 4. {url Map menu;./user-interface.html#map-menu} + 5. {url Inventory menu;./user-interface.html#inventory-menu} + 6. {url Crafting menu;./user-interface.html#crafting-menu} -3. [url ./basic-concepts.html Basic Concepts] +3. {url Basic Concepts;./basic-concepts.html} .numbered - 1. [url ./basic-concepts.html#tiles Tiles] - 2. [url ./basic-concepts.html#layers-and-superlayers Layers and superlayers] - 3. [url ./basic-concepts.html#inventory Inventory] - 4. [url ./basic-concepts.html#crafting Crafting] - 5. [url ./basic-concepts.html#event-logs Event logs] + 1. {url Tiles;./basic-concepts.html#tiles} + 2. {url Layers and superlayers;./basic-concepts.html#layers-and-superlayers} + 3. {url Inventory;./basic-concepts.html#inventory} + 4. {url Crafting;./basic-concepts.html#crafting} + 5. {url Event logs;./basic-concepts.html#event-logs} -I have been toying with the idea of making a game ever since my first exposure to programming. The [url https://gitlab.com/Syndamia/Shower/-/tree/master/ARK%20(2015 earliest piece of code]) I ever wrote was about replicating a computer boot up sequence from the video game [url https://store.steampowered.com/app/282140/SOMA/ SOMA]. I developed it in 2015, solid 3 years before my first proper introduction to software development. +I have been toying with the idea of making a game ever since my first exposure to programming. The {url earliest piece of code;https://gitlab.com/Syndamia/Shower/-/tree/master/ARK%20(2015}) I ever wrote was about replicating a computer boot up sequence from the video game {url SOMA;https://store.steampowered.com/app/282140/SOMA/}. I developed it in 2015, solid 3 years before my first proper introduction to software development. Five years later, in early 2020, I had to make a project for an exam. I (initially) had about a month to complete it and the only requirements were technical: utilize a database with at least x tables, employ a specific design pattern, etc. Fairly quickly I decided upon making a "minecraftian" game: 2D sandbox where you could fight, craft, build, eat and explore. -I called it [url https://gitlab.com/Syndamia/Mundus Mundus] and it took me around 3 months to complete and consisted of more than 2000 lines of code. Although these metrics aren't very impressive in the real world, they were a monumental achievement for me. In the beginning I planned on developing it into a fully fledged game, but that never happened. +I called it {url Mundus;https://gitlab.com/Syndamia/Mundus} and it took me around 3 months to complete and consisted of more than 2000 lines of code. Although these metrics aren't very impressive in the real world, they were a monumental achievement for me. In the beginning I planned on developing it into a fully fledged game, but that never happened. Nevertheless, this journey was very important to me, hence writing this multi-page article. -[=Link to the source code=]: [url https://gitlab.com/Syndamia/Mundus GitLab] +{b Link to the source code}: {url GitLab;https://gitlab.com/Syndamia/Mundus} ## Screenshots @@ -52,4 +51,4 @@ Nevertheless, this journey was very important to me, hence writing this multi-pa <img src="./img/inventory-menu.png" style="height: 100%; flex: 1;"> </div> -[*Screenshots are made on Linux Mint Cinnamon with the Mint-Y theme*] +{i Screenshots are made on Linux Mint Cinnamon with the Mint-Y theme} diff --git a/src/blog/mundus-first-shot-at-gamedev/timeline.du b/src/blog/mundus-first-shot-at-gamedev/timeline.du index 504fe9d..2d4466e 100644 --- a/src/blog/mundus-first-shot-at-gamedev/timeline.du +++ b/src/blog/mundus-first-shot-at-gamedev/timeline.du @@ -1,65 +1,63 @@ -# Timeline - Mundus: My first shot at game development +'def title Timeline - Mundus: My first shot at game development +'def desc Development timeline of Mundus -'define expected-reading 6 min -'define created 21 July 2020 -'define edited 25 November 2020 -[$pagenav] +# {title} -'define prev_link ./ Introduction -'define next_link ./user-interface.html User Interface -[$pagination_second] +{pagenav 6 min;21 July 2020;25 November 2020} -[$due_for_rework] +{pagination ;Introduction;./;User Interface;./user-interface.html} -\n +{due_for_rework} + +<br/> As mentioned, I had big plans for Mundus, so I wanted to make sure it would be well planned. But at the same time, the project took too much energy and I often had holes of no development time. This is an overview of the development "cycle" I went through. -.quote [*[=08.02.2020=]*] Day 0, Hour 0 +.quote {i {b 08.02.2020}} Day 0, Hour 0 At this point of time, I was still studying software development in a national program. On this exact day, we had the first lecture of a new module, where it was announced we would have to make a project for the exam. Up until this point of time, our exams constituted of predefined programming exercises for which we would be given a couple of hours to complete and would be checked by an online platform. I immediately began brainstorming and by the end of the day, I had decided upon the project I would be developing. -.quote [*[=12.02.2020=]*] Day 4 +.quote {i {b 12.02.2020}} Day 4 Before Mundus I had experimented with making games, but mostly in the command line. This time was going to be different. Up until this day, I was only researching and trying out different technologies to make my game with. -Initially I spent a lot of time with Unity, but the original time constraints and my lack of knowledge with the game engine discouraged me from continuing with it. Subsequently, I got discouraged from using any game engine and settled for [`GtkSharp 2.0`]. Now, this is widget toolkit, not even close to a game engine, but hey, it was much better than the command line, it was simple and shipped with the IDE I was using at the time. +Initially I spent a lot of time with Unity, but the original time constraints and my lack of knowledge with the game engine discouraged me from continuing with it. Subsequently, I got discouraged from using any game engine and settled for {` GtkSharp 2.0}. Now, this is widget toolkit, not even close to a game engine, but hey, it was much better than the command line, it was simple and shipped with the IDE I was using at the time. This decision proved to have been a mistake down the road, but the clock was ticking and I had no more time to waste. Besides, I also believed that in the end, moving it to something like Unity wouldn't pose too much trouble. Finally, it was time to plan the actual game. -.quote [*[=27.02.2020=]*] Day 19 +.quote {i {b 27.02.2020}} Day 19 So far I have only done preparation but on this day, I started actual programming. The UI and most of the mechanics were completely sketched. -Around a week later I also drew the first proper textures for the game world: a [url https://gitlab.com/Syndamia/IT-kariera/-/blob/a100f71372496ba89e26fedc520edcefd2442848/Year%202/Software%20development/Mundus/Mundus/Icons/Land/Ground/grass.png tile of grass] <img src="./img/grass-tile.png" class="pixelated-render"> and a [url https://gitlab.com/Syndamia/IT-kariera/-/blob/a100f71372496ba89e26fedc520edcefd2442848/Year%202/Software%20development/Mundus/Mundus/Icons/Land/Ground/boulder.png tile of grass with a boulder on top] <img src="./img/boulder-tile.png" class="pixelated-render">. These replaced the [url https://gitlab.com/Syndamia/IT-kariera/-/blob/7b2c8cbc1d6adb874ca6a41f2871ea1950866d70/Year%202/Software%20development/Project/Mundus/Mundus/Views/Icons/Land/Ground/grass.jpg grass] <img src="./img/placeholder-grass-tile.jpg" class="pixelated-render"> and [url https://gitlab.com/Syndamia/IT-kariera/-/blob/7b2c8cbc1d6adb874ca6a41f2871ea1950866d70/Year%202/Software%20development/Project/Mundus/Mundus/Views/Icons/Land/Ground/rock.jpg rock] <img src="./img/placeholder-rock-tile.jpg" class="pixelated-render"> placeholder textures I made on the 29th. +Around a week later I also drew the first proper textures for the game world: a {url tile of grass;https://gitlab.com/Syndamia/IT-kariera/-/blob/a100f71372496ba89e26fedc520edcefd2442848/Year%202/Software%20development/Mundus/Mundus/Icons/Land/Ground/grass.png} <img src="./img/grass-tile.png" class="pixelated-render"> and a {url tile of grass with a boulder on top;https://gitlab.com/Syndamia/IT-kariera/-/blob/a100f71372496ba89e26fedc520edcefd2442848/Year%202/Software%20development/Mundus/Mundus/Icons/Land/Ground/boulder.png} <img src="./img/boulder-tile.png" class="pixelated-render">. These replaced the {url grass;https://gitlab.com/Syndamia/IT-kariera/-/blob/7b2c8cbc1d6adb874ca6a41f2871ea1950866d70/Year%202/Software%20development/Project/Mundus/Mundus/Views/Icons/Land/Ground/grass.jpg} <img src="./img/placeholder-grass-tile.jpg" class="pixelated-render"> and {url rock;https://gitlab.com/Syndamia/IT-kariera/-/blob/7b2c8cbc1d6adb874ca6a41f2871ea1950866d70/Year%202/Software%20development/Project/Mundus/Mundus/Views/Icons/Land/Ground/rock.jpg} <img src="./img/placeholder-rock-tile.jpg" class="pixelated-render"> placeholder textures I made on the 29th. Concerning the temporary textures, I just drew them in half an hour in GIMP, so I could test out some of the code. The proper textures, I believe, turned out fairly well, given that I've never been good at drawing and this is my very first time trying to draw pixel art. There is no magic behind the process, after scouring the internet for pixel art that looked kinda close to what I imagined, I tried to utilize and mix whatever I found fitting and then just messed around for hours. As you can imagine, this wasn't a very efficient process, and it took me around 1-2 days for both textures. -.quote [*[=28.03.2020=]*] Day 49 +.quote {i {b 28.03.2020}} Day 49 Slowly and steadily I had been making fine progress, but a lot of issues started to surface. As it turns out, I hadn't thought everything completely through, so I mostly went back to the drawing board. -But at the very least, I had some important systems in place, like breaking and placing stuff, proper movement through the map and using items. Also, I had drawn my favorite texture from the whole projects: [url https://gitlab.com/Syndamia/Mundus/-/blob/c47a34847e52ef76361394dba2c4f524a56d1b92/Mundus/Icons/Land/Items/tree.png the tree] <img src="./img/tree-tile.png" class="pixelated-render">. +But at the very least, I had some important systems in place, like breaking and placing stuff, proper movement through the map and using items. Also, I had drawn my favorite texture from the whole projects: {url the tree;https://gitlab.com/Syndamia/Mundus/-/blob/c47a34847e52ef76361394dba2c4f524a56d1b92/Mundus/Icons/Land/Items/tree.png} <img src="./img/tree-tile.png" class="pixelated-render">. -.quote [*[=06.04.2020=]*] Day 58 +.quote {i {b 06.04.2020}} Day 58 Things started to take a turn for the better, I had planned everything I needed to plan and spring break had began. A solid week of no high-school made me more productive than ever. Some days I coded for 8 or even 10 hours straight, from morning to evening. Tools, multiple layers and climbing between them, new items and many bug improvements. And then, they extended the break for one more week, the productivity boost could've continued even further, but, alas, I was burned out. The productivity boost, as good as it was, it tired me out very fast. There were still a couple of days with progress, but this time I actually took a break. -\n +<br/> However, remember how they extended the spring break by a week? Well, this was caused by the emergence of the COVID-19 pandemic in Europe and Bulgaria. Subsequently, after the break, we didn't go back to school. Due to the emergent situation, development on Mundus became increasingly sporadic and progress slowed down drastically. At least the exam got pushed back by a month/month and a half. -\n +<br/> -.quote [*[=23.05.2020=]*] Day 105 +.quote {i {b 23.05.2020}} Day 105 Finally, after so much time, and relative amount of hiccups, Mundus was finished. Or at least, finished enough so I could present it on the exam. And this happened just in the nick of time too, the exam date was in 8 days, on the 31st. diff --git a/src/blog/mundus-first-shot-at-gamedev/user-interface.du b/src/blog/mundus-first-shot-at-gamedev/user-interface.du index 380c136..9fe7f33 100644 --- a/src/blog/mundus-first-shot-at-gamedev/user-interface.du +++ b/src/blog/mundus-first-shot-at-gamedev/user-interface.du @@ -1,61 +1,58 @@ -# User Interface - Mundus: My first shot at game development +'def title User Interface - Mundus: My first shot at game development +'def desc Showing and explaining the user interface -'define expected-reading 4 min -'define created 21 July 2020 -'define edited 25 November 2020 -[$pagenav] +# {title} -'define start_link ./ -'define prev_link ./timeline.html Timeline -'define next_link ./basic-concepts.html Basic Concepts -[$pagination_middle] +{pagenav 4 min;21 July 2020;25 November 2020} -[$due_for_rework] +{pagination ./;Timeline;./timeline.html;Basic Concepts;./basic-concepts.html} + +{due_for_rework} \n .contents .numbered -1. [url #main-screen Main screen] -2. [url #create-new-game Create new game] -3. [url #game-window Game Window] -4. [url #map-menu Map menu] -5. [url #inventory-menu Inventory menu] -6. [url #crafting-menu Crafting menu] +1. {uhref Main screen} +2. {uhref Create new game} +3. {uhref Game Window} +4. {uhref Map menu} +5. {uhref Inventory menu} +6. {uhref Crafting menu} The user interface shows how unfinished the whole thing is, you can find many unimplemented options and features. Even then, there is a lot you can do. -A lot of the topics covered are explained in more detail in [url ./basic-concepts.html Basic Concepts]. +A lot of the topics covered are explained in more detail in {url Basic Concepts;./basic-concepts.html}. -[=Note:=] all screenshots are made in Linux Mint Cinnamon with Mint-Y theme. +{b Note:} all screenshots are made in Linux Mint Cinnamon with Mint-Y theme. ## Main screen -[image ./img/main-screen.png] +{img ./img/main-screen.png} We start off with the main screen. -Only the [`Create a new game`] button is implemented, although the [`Settings`] one does open a blank window. +Only the {` Create a new game} button is implemented, although the {` Settings} one does open a blank window. ## Create new game -[image ./img/create-new-game.png] +{img ./img/create-new-game.png} Creating a game gives you a couple of options: -[`Game Mode`] - Survival is the only implemented option, where you start with almost no items and have to gather food and materials. Creative was supposed to be the opposite, giving you access to all items and making you invincible. +{` Game Mode} - Survival is the only implemented option, where you start with almost no items and have to gather food and materials. Creative was supposed to be the opposite, giving you access to all items and making you invincible. -[`Difficulty`] - Higher the difficulty, the more your energy gets depleted and the less trees, boulders and mobs there are. +{` Difficulty} - Higher the difficulty, the more your energy gets depleted and the less trees, boulders and mobs there are. -[`Screen & Inventory size`] - The screen is where you navigate the in game world. The way the user interface works, both are linked. +{` Screen & Inventory size} - The screen is where you navigate the in game world. The way the user interface works, both are linked. -[`Map size`] - Map size (in survival mode) is determined by the Screen & Inventory size, the higher the size, the smaller the map. +{` Map size} - Map size (in survival mode) is determined by the Screen & Inventory size, the higher the size, the smaller the map. -[=Note:=] all game window screenshots are made with the [`Small Game Window`]. +{b Note:} all game window screenshots are made with the {` Small Game Window}. ## Game Window -[image ./img/small-game-window.png] +{img ./img/small-game-window.png} After the world is generated, the game window opens. @@ -67,26 +64,26 @@ Then you have your health. It represents how much life you have. If it drops to Underneath that, there is your hotbar. It is a part of your inventory. -After that, you have the [`Event log`] button and some of the most recent events. Clicking the button opens a window from which you can checkout everything that has happened. On the sides, you can find the [`Map`] and [`Inv`] toggle buttons and the [`Pause`] and [`Music`] menu buttons. The [`Music`] menu can only play and stop WAV files. +After that, you have the {` Event log} button and some of the most recent events. Clicking the button opens a window from which you can checkout everything that has happened. On the sides, you can find the {` Map} and {` Inv} toggle buttons and the {` Pause} and {` Music} menu buttons. The {` Music} menu can only play and stop WAV files. ## Map menu -[image ./img/map-menu.png] +{img ./img/map-menu.png} The Map menu is an extension (to the left) of the normal game window. It cannot be opened at the same time as the inventory menu. -At the top, you can see the ground layer tiles. Below it you can find the name of the superlayer you're currently in and your coordinates. At the bottom there are the structure layer tiles and [`There is a hole above player`] field, where you can check whether you are able to ascent a superlayer. +At the top, you can see the ground layer tiles. Below it you can find the name of the superlayer you're currently in and your coordinates. At the bottom there are the structure layer tiles and {` There is a hole above player} field, where you can check whether you are able to ascent a superlayer. ## Inventory menu -[image ./img/inventory-menu.png] +{img ./img/inventory-menu.png} The Inventory menu is an extension (to the right) of the normal game window. From here you can store your items, organize them, craft and see information about a given item. ## Crafting window -[image ./img/crafting-window.png] +{img ./img/crafting-window.png} Every time you open the crafting menu, it automatically finds all items that you can craft using the items in your "Items inventory". -At the top it shows you what items and how much of them you need to craft the currently selected item. Below that it shows the item that you can craft and the [`Prev`] and [`Next`] buttons for navigating available items to craft. Finally, there is the [`Craft`] button. Clicking it removes the required items and adds the crafted item to your inventory. +At the top it shows you what items and how much of them you need to craft the currently selected item. Below that it shows the item that you can craft and the {` Prev} and {` Next} buttons for navigating available items to craft. Finally, there is the {` Craft} button. Clicking it removes the required items and adds the crafted item to your inventory. diff --git a/src/blog/plan9-in-linux-mouse-menus/index.du b/src/blog/plan9-in-linux-mouse-menus/index.du index e558f6b..79f391e 100644 --- a/src/blog/plan9-in-linux-mouse-menus/index.du +++ b/src/blog/plan9-in-linux-mouse-menus/index.du @@ -1,38 +1,31 @@ -# Plan 9 in Linux: Mouse menus +'def title Plan 9 in Linux: Mouse menus +'def desc Writing a scripts which implements the Plan 9 mouse menus functionality -'define expected-reading 17 min -'define created 10 January 2023 -'define edited 28 March 2023 -[$pagenav] +# {title} + +{pagenav 17 min;10 January 2023;28 March 2023} .contents .numbered -1. [url #usefulness-in-linux Usefulness in Linux] -2. [url #going-about-it Going about it] +1. {uhref Usefulness in Linux} +2. {uhref Going about it} .bulleted - - [url #1 \#1] - - [url #2 \#2] - - [url #3 \#3] - - [url #4 \#4] + - {uhref #1} + - {uhref #2} + - {uhref #3} + - {uhref #4} .bulleted - - [url #open-files Open files] - - [url #send Send] - - [url #window-management Window management] - -'footnote plan9-vs-rio When I say "Plan 9" in the context of graphical stuff, I usually refer to the default window system [url https://9p.io/magic/man2html/1/rio rio]. Similarly to most UNIX-like OSs, it can be changed, but there doesn't seem to be any others out there[*[^citation ^needed]*]. + - {uhref Open files} + - {uhref Send} + - {uhref Window management} -Let's begin with an introduction to Plan 9 (from Bell Labs): it is an old UNIX-like operating system from the 90s, where[$plan9-vs-rio] everything is pretty much either text, image or some sort of rectangular box. +Let's begin with an introduction to Plan 9 (from Bell Labs): it is an old UNIX-like operating system from the 90s, where{fn I say "Plan 9" in the context of graphical stuff, I usually refer to the default window system {url rio;https://9p.io/magic/man2html/1/rio}. Similarly to most UNIX-like OSs, it can be changed, but there doesn't seem to be any others out there{i {^ citation needed}}.} everything is pretty much either text, image or some sort of rectangular box. There are no fancy graphical menus of any kind, no title bars, no file managers and nothing utilizes icons, but the window manager is still stacked. -'footnote acme acme actually changes how the three mouse buttons work. Paraphrasing the [url https://9p.io/wiki/plan9/Using_acme/index.html official page], button 2 "executes things" and button 3 gets or searches for things. - Everything is done with text, actions in a window can be done by "clicking" any text inside that corresponds to an available action. -For example, in the main text editor "acme", you open a file by just pressing[$acme] on a string "New", which for convenience is always available up top: +For example, in the main text editor "acme", you open a file by just pressing{fn acme actually changes how the three mouse buttons work. Paraphrasing the {url official page;https://9p.io/wiki/plan9/Using_acme/index.html}, button 2 "executes things" and button 3 gets or searches for things.} on a string "New", which for convenience is always available up top: -<video width="376" height="194" controls> - <source src="./vid/acme-demo.mp4" type="video/mp4"> -Your browser doesn't support the video tag -</video> +{vid ./vid/acme-demo.mp4} How you manage windows and differentiate between selecting some text and "executing" it is done entirely via a three-button mouse. Each button corresponds to some sort of action, and different application can configure how every button works, which is why I'll only work with the "default" options in the desktop and terminal windows. @@ -42,30 +35,23 @@ The left mouse button (button 1), works as expected: you use it to select text. Pressing and holding down the right mouse button (button 3), shows all possible window options: -[image ./img/plan9-mouse3-menu.png] +{img ./img/plan9-mouse3-menu.png} For example, if you release it while hovering "New", you cursor will change, and after holding it down again, dragging out will result in a grey rectangle representing the dimensions (and position) of a new terminal window (releasing the button creates that new window). -<video width="376" height="194" controls> - <source src="./vid/new-window.mp4" type="video/mp4"> -Your browser doesn't support the video tag -</video> +{vid ./vid/new-window.mp4} -"Opening" an application is always done via a command in the terminal, where the program will [url https://9p.io/wiki/plan9/Using_rio/index.html "take over the window"]. +"Opening" an application is always done via a command in the terminal, where the program will {url "take over the window";https://9p.io/wiki/plan9/Using_rio/index.html}. Finally, the middle mouse button (button 2), shows text-control options, which can be executed on selected text: -[image ./img/plan9-mouse2-menu.png] - -'footnote snarf It's hard to deduce why exactly it was named like this, but the most probable explanation comes from [url https://unix.stackexchange.com/questions/308943/why-does-plan-9-use-snarf-instead-of-copy/309350 unix.stackexchange]: copying might've been seen as a two step action, obtain the contents you want to copy and paste them somewhere. So to copy something you need a duplicate of itself to be created, and either putting it in the "clipboard" isn't considered duplicating, or an optimization makes "the clipboard" store some sort of reference to what you snarfed, but not the exact thing itself. \n On an unrelated note, this might have played a part in the reasoning behind vim using the word "yank" for copy. - -'footnote plumber-in-apps Technically, a plumber just passes messages between applications, so you can configure it to not open a URL but do something else with it in a certain application. However, the aforementioned way is how it works most of the time. +{img ./img/plan9-mouse2-menu.png} -You'll recognise [`cut`], [`paste`] and [`snarf`] [$snarf], the latter being just another word for copy. +You'll recognise {` cut}, {` paste} and {` snarf} {fn It's hard to deduce why exactly it was named like this, but the most probable explanation comes from {url unix.stackexchange;https://unix.stackexchange.com/questions/308943/why-does-plan-9-use-snarf-instead-of-copy/309350}: copying might've been seen as a two step action, obtain the contents you want to copy and paste them somewhere. So to copy something you need a duplicate of itself to be created, and either putting it in the "clipboard" isn't considered duplicating, or an optimization makes "the clipboard" store some sort of reference to what you snarfed, but not the exact thing itself. \n On an unrelated note, this might have played a part in the reasoning behind vim using the word "yank" for copy.}, the latter being just another word for copy. Since every modern window manager supports those in some form, I'll concentrate on the others.\n -[`plumb`] is the most interesting: it sends the selection to a "plumber" application, which practically[$plumber-in-apps] tries to open or execute it. +{` plumb} is the most interesting: it sends the selection to a "plumber" application, which practically{fn Technically, a plumber just passes messages between applications, so you can configure it to not open a URL but do something else with it in a certain application. However, the aforementioned way is how it works most of the time.} tries to open or execute it. For example, a selected URL will open in the browser, but a selected image file will open in an image viewer.\n -[`send`] enters the selected text as a command in the current shell. +{` send} enters the selected text as a command in the current shell. ### Usefulness in Linux @@ -91,11 +77,11 @@ Most importantly, this works in any application, any time, any where, as long as ### Going about it -This could all be done with a C program, but writing the code would take way too much time (if you do it like that, [url /about tell me about it]), so everything should be contained in a couple of shell scripts. +This could all be done with a C program, but writing the code would take way too much time (if you do it like that, {url tell me about it;/about}), so everything should be contained in a couple of shell scripts. Another "constraint" is that I use openbox, an X11 window manager, so my solution will be oriented around tools that work with it. The result should be simple enough that adapting it to your window manager shouldn't take too much effort. -Looking around, you would first find a video by Luke Smith, where he creates a small plumber in bash ([url https://www.youtube.com/watch?v=RlMxbQmMz_4 YouTube link], [url https://odysee.com/@Luke:7/plumbing-in-linux-la-plan-9-from-bell:e Odysee link]) and an [url https://tatsumoto-ren.github.io/blog/plumbing-for-language-learners.html expansion of it] by Ren Tatsumoto (surprisingly enough from around 3 months before I started). +Looking around, you would first find a video by Luke Smith, where he creates a small plumber in bash ({url YouTube link;https://www.youtube.com/watch?v=RlMxbQmMz_4}, {url Odysee link;https://odysee.com/@Luke:7/plumbing-in-linux-la-plan-9-from-bell:e}) and an {url expansion of it;https://tatsumoto-ren.github.io/blog/plumbing-for-language-learners.html} by Ren Tatsumoto (surprisingly enough from around 3 months before I started). These posts served as a good base and inspiration. Following their steps, everything will be done via one shell script that does something on the text selection, effectively allowing the menus, plumber and all other possible actions to be managed by that script. @@ -112,27 +98,28 @@ The overall life cycle is split into four parts: Since we're emulating Plan 9, I wanted the script to be ran with the mouse, with potentially different parameters depending on button. Ideally, if you quickly press and release a button (button 2 or 3), the click should be sent to the application below the cursor, but if you hold it, the script should be ran. -A tool that allows that (mentioned in Ren Tatsumoto's [url https://tatsumoto-ren.github.io/blog/plumbing-for-language-learners.html blog post]) is [url https://github.com/baskerville/sxhkd sxhkd]. -Sparing you the details, unfortunately sxhkd cannot pass the mouse press to the application below, if you want something to also happen on key-down ([url https://github.com/baskerville/sxhkd/issues/198 Issue 198], and the workaround in didn't work). +A tool that allows that (mentioned in Ren Tatsumoto's {url blog post;https://tatsumoto-ren.github.io/blog/plumbing-for-language-learners.html}) is {url sxhkd;https://github.com/baskerville/sxhkd}. +Sparing you the details, unfortunately sxhkd cannot pass the mouse press to the application below, if you want something to also happen on key-down ({url Issue 198;https://github.com/baskerville/sxhkd/issues/198}, and the workaround in didn't work). This means that the original idea isn't really feasible, but I couldn't really find any other good tool that does what I wanted. Plan B: execute the plumbing script on KeyboardKey + Button, but what key should I choose, especially when we're binding the right click? Ctrl + Button3 is used for opening links, Alt + Button3 is reserved for resizing the current window and binding with the Super (Windows) key causes issues with opening of my application menu. -After a lot of research, I found out there is actually a fourth modifier key, called [`Hyper`], which X11 still supports. -It's inception come from 1978 with the [url https://en.wikipedia.org/wiki/Space-cadet_keyboard Space-cadet keyboard], but thanks to the popularity of the [url https://en.wikipedia.org/wiki/Model_M_keyboard Model M], modern keyboards don't include it. +After a lot of research, I found out there is actually a fourth modifier key, called {` Hyper}, which X11 still supports. +It's inception come from 1978 with the {url Space-cadet keyboard;https://en.wikipedia.org/wiki/Space-cadet_keyboard}, but thanks to the popularity of the {url Model M;https://en.wikipedia.org/wiki/Model_M_keyboard}, modern keyboards don't include it. -All that was left was to assign [`Hyper`] to some key that I don't use, and what better than Caps Lock! -There are [url https://en.jveweb.net/archives/2010/11/making-better-use-of-the-caps-lock-key-in-linux.html many ways to do it], but I prefer using [url https://gitlab.freedesktop.org/xorg/app/setxkbmap setxkbmap]: +All that was left was to assign {` Hyper} to some key that I don't use, and what better than Caps Lock! +There are {url many ways to do it;https://en.jveweb.net/archives/2010/11/making-better-use-of-the-caps-lock-key-in-linux.html}, but I prefer using {url setxkbmap;https://gitlab.freedesktop.org/xorg/app/setxkbmap}: ``` setxkbmap -option "caps:hyper" -This line is needs to be ran at start of openbox, so it's placed inside [`~/.config/openbox/autostart`]. +This line is needs to be ran at start of openbox, so it's placed inside {` ~/.config/openbox/autostart}. -Now, finally, our sxhkd config looks something like this (I named the script [`plumb.sh`]): +Now, finally, our sxhkd config looks something like this (I named the script {` plumb.sh}): -:code +``` +'emplace # Hyper_L + Middle mouse button mod4 + button2 $HOME/.a/plumb.sh 1 @@ -140,9 +127,9 @@ mod4 + button2 # Hyper_L + Right mouse button mod4 + button3 $HOME/.a/plumb.sh +'endemplace - -For details about these options, refer to the [url https://github.com/baskerville/sxhkd/blob/master/doc/sxhkd.1.asciidoc manpage]. +For details about these options, refer to the {url manpage;https://github.com/baskerville/sxhkd/blob/master/doc/sxhkd.1.asciidoc}. What you might notice is that on middle mouse button, "1" is passed to the script. Since the window options aren't very useful, I've configured the script to execute a "default" action on Hyper\_L+Button2, but show me a list of all possible on Hyper\_L+Button3. @@ -151,9 +138,9 @@ Feel free to change this behaviour. #### #2 Getting the current selection turns out to be easy, X11's selections (clipboard) is split into a primary, secondary and a clipboard, where the primary is the current selection you've done with your mouse, the secondary isn't used, and the clipboard is what you know and love. -[url https://www.uninformativ.de/ uninformativ.de] has a great blog post about [url https://www.uninformativ.de/blog/postings/2017-04-02/0/POSTING-en.html X11's "clipboard"], I recommend it, even though it dives more into C than one would like. +{url uninformativ.de;https://www.uninformativ.de/} has a great blog post about {url X11's "clipboard";https://www.uninformativ.de/blog/postings/2017-04-02/0/POSTING-en.html}, I recommend it, even though it dives more into C than one would like. -As for getting it inside our script, [url https://github.com/astrand/xclip xclip] is a perfect choice. +As for getting it inside our script, {url xclip;https://github.com/astrand/xclip} is a perfect choice. In the very beginning, we'll just store the selection in a variable and work from there: ```bash @@ -162,10 +149,10 @@ selection="$(xclip -o)" #### #3 With that out of the way, all we now need is an actual menu to appear. -Luke Smith and Ren Tatsumoto both used [url https://tools.suckless.org/dmenu/ dmenu], which is keyboard driven. -As for a mouse-oriented standalone menu, that could be easily configured, all I could find was my current application menu: [url https://jgmenu.github.io/ jgmenu]. +Luke Smith and Ren Tatsumoto both used {url dmenu;https://tools.suckless.org/dmenu/}, which is keyboard driven. +As for a mouse-oriented standalone menu, that could be easily configured, all I could find was my current application menu: {url jgmenu;https://jgmenu.github.io/}. -Generally it is meant to serve as an application menu, but with [`--simple`] you can directly echo and pipe to it all menu option and what they do. +Generally it is meant to serve as an application menu, but with {` --simple} you can directly echo and pipe to it all menu option and what they do. Menu options are formatted as comma-separated (CSV) text, where each option is on a new line, the first item being the name, and the second, the executed command upon press: ``` @@ -176,65 +163,71 @@ Move,echo 3 In this case I'm echo-ing a number, rather than doing an action, for readability and formatting sake. The number is parsed by a switch statement, so all actions are in a single place and can be more easily formatted than if they were inlined in the string. -Via [`--at-pointer`] the menu can spawn right under the pointer. +Via {` --at-pointer} the menu can spawn right under the pointer. Unfortunately it always spawns in such a way that the pointer is at the top-left corner, I couldn't find a way to make it appear in a way that the first option is below the pointer. Finally, since I use it as an application menu too, I specify a config file which makes it look more like Plan 9's menu (though I've personally omitted the color scheme, since it doesn't fit my normal theme): ``` -'include ./jgmenurc +'snippet 1 $ ./jgmenurc -More info on these options can be found in the [url https://jgmenu.github.io/jgmenu.1.html manpage]. +More info on these options can be found in the {url manpage;https://jgmenu.github.io/jgmenu.1.html}. Putting it all together, it looks something like this: -```bash +````bash 'snippet 54 54 ./plumb.sh 'snippet 58 59 ./plumb.sh 1) ... ;; 2) ... ;; - ... -\ + \... + *) ... ;; -'snippet 81 $ ./plumb.sh +'snippet 81 $ ./plumb.sh + + An important aspect of our menu options is that they can change depending on context. For example, if we have a URL we might want the options "Open it in browser" and "Download", which we wouldn't want in case of a .docx file. Or we might want it "ship" it with a lot of possible menu options and let the user decide which ones they need. This is very simple to do, and can be done in many ways. -My preferred way is to have a variable [`menu`] to which different options are appended depending on a regular expression or "flag" (variable). +My preferred way is to have a variable {` menu} to which different options are appended depending on a regular expression or "flag" (variable). To work with regular expressions more easily, I've made a function which returns a status code depending on matching. All in all, it would look something like this: -```bash +````bash 'snippet 26 26 ./plumb.sh 'snippet 28 38 ./plumb.sh 'snippet 45 46 ./plumb.sh -\ + 'snippet 54 54 ./plumb.sh 'snippet 58 59 ./plumb.sh - ... -'snippet 81 $ ./plumb.sh + \... +'snippet 81 $ ./plumb.sh + + #### #4 -Finally, we need to execute a selected option, aka put commands in each case of [`\$action`]. +Finally, we need to execute a selected option, aka put commands in each case of {` \$action}. ##### Open files -Opening a file is very simple, [`xdg-open`] handles opening files by name, with the default program for that file extension. +Opening a file is very simple, {` xdg-open} handles opening files by name, with the default program for that file extension. However, the script is ran completely independently from the current program, so when we're given only a part of the file path, we need to figure out the rest. -This problem was solved somewhat by Luke Smith, he figured out a way to find (and [`cd`] into) the current directory of the active window ([`pid1`] should be [`pid`], but you'll see later why I did that change): +This problem was solved somewhat by Luke Smith, he figured out a way to find (and {` cd} into) the current directory of the active window ({` pid1} should be {` pid}, but you'll see later why I did that change): ```bash +'emplace pid=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3) -pid1=$(pstree -lpA "$pid" | tail -n 1 | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g') +pid1=$(pstree -lpA "$pid" | tail -n 1 | awk -F'---' '{print $NF}' | sed -re 's/{^ 0-9]//g') cd "$(readlink /proc/"$pid1"/cwd)" +'endemplace Still, one important situation where this doesn't work is tabs, but those are handled differently from application to application. I figured out tabs only for terminal emulators, since that's where text actions can be the most useful. @@ -244,24 +237,20 @@ We only get the active window, but there is no way to get the active/currently " Additionally, pretty much all terminal emulators have different shell, not terminal, processes for the different tabs. Terminal plugins/extensions and special application were considered, but they would take too much effort and/or couldn't work. -'footnote shell-cwd You could make a proper mechanism, which waits for the file to get updated ([url https://github.com/inotify-tools/inotify-tools inotify-wait]), or for there to be a lockfile, but the overall way it works is the same. I couldn't think of anything better, mostly because the plumber script is a completely separate process from the shell you're in. Maybe there is a way for them to communicate between each other, a bit like microservices? - In the end, I settled on a hack: the shell would do the heavy lifting. -My right-click menu combination would be passed to the terminal (and therefore to the shell), and the shell will simultaneously store it's working directory in a file inside [`/tmp`], which could then be parse by the script. -This isn't ideal, since if the shell is being slow, the script might not wait long enough for the file to get updated, but I couldn't think of anything much better[$shell-cwd] and it does the job. - -'footnote escape-sequences The terminal emulator passes keyboard presses to the shell via [url https://en.wikipedia.org/wiki/ANSI_escape_code ANSI escape sequences], which don't support [`Hyper`] bindings. I settled for the next best thing, which is create a different key combination that isn't in use, and make our script "press" that combination upon running. +My right-click menu combination would be passed to the terminal (and therefore to the shell), and the shell will simultaneously store it's working directory in a file inside {` /tmp}, which could then be parse by the script. +This isn't ideal, since if the shell is being slow, the script might not wait long enough for the file to get updated, but I couldn't think of anything much better{fn You could make a proper mechanism, which waits for the file to get updated ({url inotify-wait;https://github.com/inotify-tools/inotify-tools}), or for there to be a lockfile, but the overall way it works is the same. I couldn't think of anything better, mostly because the plumber script is a completely separate process from the shell you're in. Maybe there is a way for them to communicate between each other, a bit like microservices?} and it does the job. I use zsh, so I implemented it by creating a zsh widget: certain functionality that can be ran by the shell itself and (usually) doesn't need to be executed like a normal program. Examples include key binds, completion, navigation through history, undo and redo. -User-defined widgets are just zsh functions, so we create a function that stores the current directory, add it as a widget and bind it to our keyboard combination[$escape-sequences]: +User-defined widgets are just zsh functions, so we create a function that stores the current directory, add it as a widget and bind it to our keyboard combination{fn The terminal emulator passes keyboard presses to the shell via {url ANSI escape sequences;https://en.wikipedia.org/wiki/ANSI_escape_code}, which don't support {` Hyper} bindings. I settled for the next best thing, which is create a different key combination that isn't in use, and make our script "press" that combination upon running.}: ```bash plumb-store-cwd () { pwd > /tmp/plumb-cwd } zle -N plumb-store-cwd -bindkey "[^[5;7~" plumb-store-cwd # Ctrl+Alt+Page_Up +bindkey "{^ [5;7~" plumb-store-cwd # Ctrl+Alt+Page_Up Finally, in our script, we want to read that file, only if we're inside a terminal: @@ -273,12 +262,12 @@ if [ $wname == "TERMINAL" ]; then # Replace with your terminal emulator name cd "$(cat /tmp/plumb-cwd)" fi -For the uninitiated, [url https://github.com/jordansissel/xdotool xdotool] is a general X11 tool, which allows (amongst other things) to "execute" key presses via commands. +For the uninitiated, {url xdotool;https://github.com/jordansissel/xdotool} is a general X11 tool, which allows (amongst other things) to "execute" key presses via commands. ##### Send Sending the command to the current shell is by far the simplest action. -[`xdotool`] supports "typing out" text, so I'll give it the selection and let it do it's thing: +{` xdotool} supports "typing out" text, so I'll give it the selection and let it do it's thing: ```bash xdotool type --delay 0 "$selection" @@ -297,12 +286,14 @@ xdotool mousedown 3 xdotool keyup Alt After this is executed, moving the mouse will cause the screen to be resized, the same way if I did the original combination. -Pressing and releasing the mouse button will stop resizing (that's why [`keyup Alt`] is done, because otherwise you would need to also press Alt). +Pressing and releasing the mouse button will stop resizing (that's why {` keyup Alt} is done, because otherwise you would need to also press Alt). Though it work, it's kind of clunky and the normal Alt+RightClick is arguably simpler and easier to work with. -\n +<br/> With this our script if finished. -You can find the whole thing (including some personal modifications) in my [url https://gitlab.com/Syndamia/dotfiles/-/blob/main/.a/plumb.sh dotfiles]. +You can find the whole thing (including some personal modifications) in my {url dotfiles;https://gitlab.com/Syndamia/dotfiles/-/blob/main/.a/plumb.sh}. I'll try to use it as much as I can and I might create a blog post or an appendix on how I feel about it. + +{footnotes} diff --git a/src/blog/remove-weather-widget/index.du b/src/blog/remove-weather-widget/index.du index 5e2aa28..efa5096 100644 --- a/src/blog/remove-weather-widget/index.du +++ b/src/blog/remove-weather-widget/index.du @@ -1,19 +1,19 @@ -# How to remove Windows Weather Widget +'def title How to remove Windows Weather Widget +'def desc From June 2021 Microsoft introduced the Weather Widget on Windows 10. It takes up space on the taskbar and is a huge mess. -'define expected-reading 1 min -'define created 26 October 2021 -'define edited 26 October 2021 -[$pagenav] +# {title} -From June 2021 Microsoft introduced the [`Weather Widget`] on Windows 10. Given that it takes up space on the taskbar [url https://www.howtogeek.com/734461/windows-10s-weather-widget-is-a-mess.-is-windows-11-next/ and is a huge mess], you might want to remove it. +{pagenav 1 min;26 October 2021;26 October 2021} + +From June 2021 Microsoft introduced the {` Weather Widget} on Windows 10. Given that it takes up space on the taskbar {url and is a huge mess;https://www.howtogeek.com/734461/windows-10s-weather-widget-is-a-mess.-is-windows-11-next/}, you might want to remove it. This is how: :ordered 1. Right-click on an empty spot in the taskbar - [image ./img/windows10-taskbar.png] + {img ./img/windows10-taskbar.png} -2. Go up to [*News and interests*], and then click [*Turn off*] in the popped up window +2. Go up to {i News and interests}, and then click {i Turn off} in the popped up window - [image ./img/remove-newsweather-windows10.png] + {img ./img/remove-newsweather-windows10.png} diff --git a/src/blog/sane-explanation-of-compilers/index.du b/src/blog/sane-explanation-of-compilers/index.du index 9c05e81..99b34fd 100644 --- a/src/blog/sane-explanation-of-compilers/index.du +++ b/src/blog/sane-explanation-of-compilers/index.du @@ -1,12 +1,12 @@ -# Sane explanation of compilers +'def title Sane explanation of compilers +'def desc A series of blog posts, explaining compilers in a simple manner -'define expected-reading 48 min -'define created 30 March 2023 -'define edited 24 April 2023 -[$pagenav] +# {title} + +{pagenav 48 min;30 March 2023;24 April 2023} This is a series on compilers, with the goal of explaining all topics as simply as possible. More information is available in the first part. .bulleted -- [url ./part-1 Part 1]: Introduction and The frontend (aka How do we understand code) +- {url Part 1;./part-1}: Introduction and The frontend (aka How do we understand code) diff --git a/src/blog/sane-explanation-of-compilers/part-1/index.du b/src/blog/sane-explanation-of-compilers/part-1/index.du index e06bad4..125c778 100644 --- a/src/blog/sane-explanation-of-compilers/part-1/index.du +++ b/src/blog/sane-explanation-of-compilers/part-1/index.du @@ -1,42 +1,42 @@ -# Sane explanation of compilers: Part 1 +'def title Sane explanation of compilers: Part 1 +'def desc An introduction to regular expressions, grammars, lexers and parsers for use in compilers with some lex and yacc implementations -'define expected-reading 48 min -'define created 30 March 2023 -'define edited 24 April 2023 -[$pagenav] +# {title} + +{pagenav 48 min;30 March 2023;24 April 2023} :contents :numbered -1. [url #preface Preface] -2. [url #i.-how-do-we-understand-code I. How do we understand code?] +1. {uhref Preface} +2. {uhref I. How do we understand code?} :numbered - 1. [url #math Math] + 1. {uhref Math} .numbered - 1. [url #regular-expressions Regular expressions] - 2. [url #grammars Grammars] + 1. {uhref Regular expressions} + 2. {uhref Grammars} - 2. [url #lexers-and-parsers Lexers and parsers] + 2. {uhref Lexers and parsers} :numbered - 1. [url #implementational-difficulties-with-grammars Implementational difficulties with grammars] - 2. [url #practical-usage Practical usage] - 3. [url #parsing-algorithms Parsing algorithms] + 1. {uhref Implementational difficulties with grammars} + 2. {uhref Practical usage} + 3. {uhref Parsing algorithms} .numbered - 1. [url #ll LL] - 2. [url #lr LR] - 3. [url #lrs-family LR's family] - 4. [url #more-info More info] + 1. {uhref LL} + 2. {uhref LR} + 3. {uhref LR's family} + 4. {uhref More info} - 4. [url #abstract-syntax-tree Abstract syntax tree] + 4. {uhref Abstract syntax tree} - 3. [url #implementing-a-front-end Implementing a front-end] + 3. {uhref Implementing a front-end} .numbered - 1. [url #lex lex] - 2. [url #yacc yacc] - 3. [url #doing-it-properly Doing it properly] + 1. {uhref lex} + 2. {uhref yacc} + 3. {uhref Doing it properly} -3. [url #appendix Appendinx] +3. {uhref Appendinx} @@ -50,11 +50,9 @@ Processors work with numbers, every action (instruction) a processor can do is d However, writing code only with numbers is tedious, error-prone and simple stuff sometimes take ages to implement. That is why, over time, programmers have tried to abstract sets of instructions into words and text constructions that are easier to work with. -'footnote how-did-we-get-here Though it's obvious, I would like to point out that modern compilers are most often written in languages that are themselves compiled. You might ask yourself "where did the first compiler come from?" The answer is simple: it was written with "numbers", with direct instructions to the processor, from the time when computers were simple enough that [*all*] programming was done with CPU instructions. - Thanks to abstraction, programmers have been able to create more and more complicated projects with less and less work, that is more portable and compatible with different machines. The trade-off is that we need to translate our nice programmer code to numbers a CPU would understand. -This job is delegated to a special type of program, called a compiler[$how-did-we-get-here], which is separated into three main layers/components: +This job is delegated to a special type of program, called a compiler{fn Though it's obvious, I would like to point out that modern compilers are most often written in languages that are themselves compiled. You might ask yourself "where did the first compiler come from?" The answer is simple: it was written with "numbers", with direct instructions to the processor, from the time when computers were simple enough that {i all} programming was done with CPU instructions.}, which is separated into three main layers/components: .numbered 1. Front-end: it understands the program, what the code is trying to do @@ -65,7 +63,7 @@ In this post, we'll be looking only at the first one. ## I. How do we understand code? -Syntax in current programming languages can be quite sophisticated and ambiguous. For example (taken from [url https://en.wikipedia.org/wiki/Most_vexing_parse wikipedia]) this C++ snippet +Syntax in current programming languages can be quite sophisticated and ambiguous. For example (taken from {url wikipedia;https://en.wikipedia.org/wiki/Most_vexing_parse}) this C++ snippet ``` void f(double d) { @@ -75,12 +73,12 @@ void f(double d) { could be interpreted either as a: .numbered -1. declaration of variable [`i`], which is initialized with the value of [`int(d)`] (which just casts [`d`] to an integer), or -2. function declaration, since superfluous parenthesis around function parameter declarations are allowed (meaning it is treated as [`int i(int d)`]) +1. declaration of variable {` i}, which is initialized with the value of {` int(d)} (which just casts {` d} to an integer), or +2. function declaration, since superfluous parenthesis around function parameter declarations are allowed (meaning it is treated as {` int i(int d)}) Note that I'm talking about syntax, the valid selection and layouts of characters, and not semantics, the underlying meaning. Compiled programming languages associate specific templates of code (text) to their "corresponding" machine instructions, there isn't anything special you need to understand in a piece of code. -In natural languages, you could construct a sentence which follows all grammatical rules, but is absolute nonsense, like [url https://en.wikipedia.org/wiki/Colorless_green_ideas_sleep_furiously "Colorless green ideas sleep furiously"]. +In natural languages, you could construct a sentence which follows all grammatical rules, but is absolute nonsense, like {url "Colorless green ideas sleep furiously";https://en.wikipedia.org/wiki/Colorless_green_ideas_sleep_furiously}. The problem of semantics is extremely difficult, however in our case we only care about syntax. And this is where math comes into play. @@ -90,7 +88,7 @@ And this is where math comes into play. A word of caution, I'll use a decent amount of fancy names, so I have a way to more easily refer to different concepts. Don't be scared and skip over them if they're confusing you. -There is a special field in mathematics that deals with syntactical analysis: [url https://en.wikipedia.org/wiki/Formal_language formal language theory]. +There is a special field in mathematics that deals with syntactical analysis: {url formal language theory;https://en.wikipedia.org/wiki/Formal_language}. Although even the basics merit a whole university course, I'll still try to roughly explain what's important, for those that haven't studied it.\n This field works primarily with strings via the help of two (relevant for our purposes) instruments: regular expressions and grammars. @@ -103,104 +101,110 @@ When a word can be "generated" from the pattern, we say the regex matches the wo At their very base, such a pattern is created with the following rules: :unordered -- [url https://en.wikipedia.org/wiki/Concatenation concatenation] - you can put characters next to each other to form strings, so a normal string like [`accent`] is also a regex.\n +- {url concatenation;https://en.wikipedia.org/wiki/Concatenation} - you can put characters next to each other to form strings, so a normal string like {` accent} is also a regex.\n With braces we can group stuff. - For example, in [`a(cc)ent`] the two "c"s are grouped together. - This is used to form more sophisticated structures later on, but currently it doesn't alter anything, like the braces in [`(1+2)+3`] and [`1+(2+3)`] don't alter the result sum. + For example, in {` a(cc)ent} the two "c"s are grouped together. + This is used to form more sophisticated structures later on, but currently it doesn't alter anything, like the braces in {` (1+2)+3} and {` 1+(2+3)} don't alter the result sum. -- [url https://en.wikipedia.org/wiki/Alternation_%28formal_language_theory%29 alternation] - allow different (alternative) strings in the same spot.\n +- {url alternation;https://en.wikipedia.org/wiki/Alternation_%28formal_language_theory%29} - allow different (alternative) strings in the same spot.\n We do so with vertical bars (which signify an "or" relationship), the group can be "replaced" with either value. - For example [`acce(n | p)t`], matches both "acce[=n=]t" or "acce[=p=]t".\n + For example {` acce(n | p)t}, matches both "acce{b n}t" or "acce{b p}t".\n There is no limit on how many alternatives you can have and what their lengths are: - ```regex + 'def LANG regex + ``` acc(ordingly | ent | urate) matches .bulleted - - "acc[=ordingly=]" - - "acc[=ent=]" and - - "acc[=urate=]". + - "acc{b ordingly}" + - "acc{b ent}" and + - "acc{b urate}". There is no limit on how many groups (with alternation) you can have: - ```regex + 'def LANG regex + ``` ac(quirem | c | hievem)en(t | ts) matches .bulleted - - "ac[=quirem=]en[=t=]" - - "ac[=quirem=]en[=ts=]" - - "ac[=c=]en[=t=] - - "ac[=c=]en[=ts=] - - "ac[=hievem=]en[=t=]" and - - "ac[=hievem=]en[=ts=]". + - "ac{b quirem}en{b t}" + - "ac{b quirem}en{b ts}" + - "ac{b c}en{b t} + - "ac{b c}en{b ts} + - "ac{b hievem}en{b t}" and + - "ac{b hievem}en{b ts}". -- [url https://en.wikipedia.org/wiki/Kleene_star Kleene star] - repeat the preceding letter or group, 0 or more times.\n - An asterisk is used to mark this operation (hence the name, "Kleene [=star=]"). +- {url Kleene star;https://en.wikipedia.org/wiki/Kleene_star} - repeat the preceding letter or group, 0 or more times.\n + An asterisk is used to mark this operation (hence the name, "Kleene {b star}"). - ```regex + 'def LANG regex + ``` accents* will match .bulleted - "accent" - - "accent[=s=] - - "accent[=ss=] - - "accent[=sss=] + - "accent{b s} + - "accent{b ss} + - "accent{b sss} - and so on Of course, the asterisk could also be in the middle of the regex, like - ```regex + 'def LANG regex + ``` ac*ent which matches .bulleted - "acent" - - "ac[=c=]ent" - - "ac[=cc=]ent" + - "ac{b c}ent" + - "ac{b cc}ent" - ... With a group we can repeat entire strings, - ```regex + 'def LANG regex + ``` acc(ent)*s matches .bulleted - "accs" - - "acc[=ent=]s" - - "acc[=entent=]s - - "acc[=ententent=]s" + - "acc{b ent}s" + - "acc{b entent}s + - "acc{b ententent}s" - ... An alternation allows any alternative to be chosen at any point, so - ```regex + 'def LANG regex + ``` acce(n | p)*t matches .bulleted - "accet" - - "acce[=n=]t - - "acce[=p=]t - - "acce[=nn=]t - - "acce[=np=]t" - - "acce[=pn=]t" - - "acce[=pp=]t" - - "acce[=nnn=]t" + - "acce{b n}t + - "acce{b p}t + - "acce{b nn}t + - "acce{b np}t" + - "acce{b pn}t" + - "acce{b pp}t" + - "acce{b nnn}t" - ... -In the modern day, regular expressions permit [url https://en.wikipedia.org/wiki/Regular_expression#Syntax additional constructions] like matching the start or end of a string, matching character groups or character classes. -There are also sometimes features which significantly increase the matching capabilities of normal regexes, like [url https://en.wikipedia.org/wiki/Regular_expression#Patterns_for_non-regular_languages lookahead and lookbehind assertions]. +In the modern day, regular expressions permit {url additional constructions;https://en.wikipedia.org/wiki/Regular_expression#Syntax} like matching the start or end of a string, matching character groups or character classes. +There are also sometimes features which significantly increase the matching capabilities of normal regexes, like {url lookahead and lookbehind assertions;https://en.wikipedia.org/wiki/Regular_expression#Patterns_for_non-regular_languages}. #### Grammars @@ -208,89 +212,89 @@ However, even then regular expressions are fairly weak, they can't match recursi Let's say you want to be able to have math expressions in your language, you can have braces inside braces as much as you like, but in a certain manner: .bulleted -- [`1+2`] is a valid expression -- [`(9-8)+2`] also is valid -- [`((3*3)-(2^3))+2`] is too -- however [`()3*3)-(2^3()+2`] isn't valid +- {` 1+2} is a valid expression +- {` (9-8)+2} also is valid +- {` ((3*3)-(2^3))+2} is too +- however {` ()3*3)-(2^3()+2} isn't valid -Such a structure is recursive, because it can contain "itself", [`1+2`] can be a standalone math expression, but it can also be contained in another expression, like [`(1+2)*3`], which itself could be inside another bigger expressions and so on. +Such a structure is recursive, because it can contain "itself", {` 1+2} can be a standalone math expression, but it can also be contained in another expression, like {` (1+2)*3}, which itself could be inside another bigger expressions and so on. For this task we have a whole separate tool: grammars. -'footnote terminals-and-nonterminals Formally, we call the rule "names" nonterminals, the idea being that all normal characters, that could appear in our string, are called terminals, since they would terminate replacement and string generation. For the purposes of this post, I won't use the formal names, with the hope that using less terminology will increase understandability. - The syntax is different from regexes: a grammar is divided into (production) rules, each rule is named and specifies an expression. -Expressions are a concatenation of strings and/or names[$terminals-and-nonterminals]. +Expressions are a concatenation of strings and/or names{fn Formally, we call the rule "names" nonterminals, the idea being that all normal characters, that could appear in our string, are called terminals, since they would terminate replacement and string generation. For the purposes of this post, I won't use the formal names, with the hope that using less terminology will increase understandability.}. Names won't appear in our matched strings, the idea is that a name will be replaced with it's expression, kind of like a placeholders. Additionally, there can be multiple rules with the same name, meaning a rule can be replaced by different stuff at any point of the string generation. -'footnote grammar-syntax This is pretty much the mathematical notation, often in CS the Backus-Naur form is used, but I find that a bit harder to read. You might also make the argument that I should use a proper unicode arrow symbol, like [`→`], but [`->`] is way more convinient. - Always one name is chosen to be the starting point, and generation continues from there. -In math literature, generally we write rules in the form [`Name -> Expression`] [$grammar-syntax], and often names are a single capital letter. -Additionally, often the starting name is called [`S`]. -Finally, in future examples, I'll use the arrow [`⇒`] to show derivations, how the generated string looks after one or two replacements of the name with one of it's expressions. +In math literature, generally we write rules in the form {` Name -> Expression} {fn This is pretty much the mathematical notation, often in CS the Backus-Naur form is used, but I find that a bit harder to read. You might also make the argument that I should use a proper unicode arrow symbol, like {` →}, but {` ->} is way more convinient.}, and often names are a single capital letter. +Additionally, often the starting name is called {` S}. +Finally, in future examples, I'll use the arrow {` ⇒} to show derivations, how the generated string looks after one or two replacements of the name with one of it's expressions. For an example, with the grammar -```grammar +'def LANG grammar +``` S -> aSb S -> cc -we can generate the string [`aaaaccbbbb`] (remember, our starting point is [`S`]): +we can generate the string {` aaaaccbbbb} (remember, our starting point is {` S}): -```grammar+ +'def LANG grammar+ +``` S ⇒ aSb ⇒ aaSbb ⇒ aaaSbbb ⇒ aaaaSbbbb ⇒ aaaaccbbbb -or [`accb`]: +or {` accb}: -```grammar+ +'def LANG grammar+ +``` S ⇒ aSb ⇒ accb where a, b and c are just English characters. -To simplify our lives, often rules with the same name are merged into one rule, separated by vertical bars ([`S -> aSb | cc`]). +To simplify our lives, often rules with the same name are merged into one rule, separated by vertical bars ({` S -> aSb | cc}). This is practically alternation but in a different context. As for our math expressions, we could create something like this: -```grammar +'def LANG grammar +``` N -> 0 | 1 | 2 | ... all possible numbers E -> N | (E) | E + E | E - E | E * E | E / E | E ^ E -which will successfully be able to match (generate) [`((3 * 3) - (2 ^ 3)) + 2`]: +which will successfully be able to match (generate) {` ((3 * 3) - (2 ^ 3)) + 2}: -```grammar+ +'def LANG grammar+ +``` E ⇒ E + E ⇒ (E) + N ⇒ (E - E) + 2 ⇒ ((E) - (E)) + 2 ⇒ ((E * E) - (E ^ E)) + 2 ⇒ ((N * N) - (N ^ N)) + 2 ⇒ ((3 * 3) - (2 ^ 3)) + 2 -but there are no expressions (rules) that allow [`()3+3()`] or [`)3(-6`] to be "matched". +but there are no expressions (rules) that allow {` ()3+3()} or {` )3(-6} to be "matched". ### Lexers and parsers -You might've noticed that for [`N`] I use three dots and the note "all possible numbers" to signify that N can be any positive whole number. +You might've noticed that for {` N} I use three dots and the note "all possible numbers" to signify that N can be any positive whole number. In practice we need formally define that grammar: -```grammar +'def LANG grammar +``` N -> 0 | 1 | 2 | ... | 9 | 0N | 1N | 2N | ... | 9N -'footnote regular-grammars Such grammars are called [url https://en.wikipedia.org/wiki/Regular_grammar regular grammars], more formally, every rule has to contain at most one name and that name must be at the start or end of the string characters. - -With this you might've realised that grammars can do anything a regular expressions can: concatenation and alternation are "built-in", and the Kleene star can be done with another rule in the form [`R -> strR | str`] [$regular-grammars]. +With this you might've realised that grammars can do anything a regular expressions can: concatenation and alternation are "built-in", and the Kleene star can be done with another rule in the form {` R -> strR | str} {fn Such grammars are called {url regular grammars;https://en.wikipedia.org/wiki/Regular_grammar}, more formally, every rule has to contain at most one name and that name must be at the start or end of the string characters.}. The reason we use both is that grammars are significantly slower and more complicated in code than regexes. #### Implementational difficulties with grammars -Implementing (very roughly) the regular expression [`acce(n | p)*t`] is quite easy: +Implementing (very roughly) the regular expression {` acce(n | p)*t} is quite easy: -```c++ -'include ./regex_parser_simple.cpp +```cpp +'snippet 1 $ ./regex_parser_simple.cpp In brief, for concatenated characters we do a simple comparison per character. -When we reach "\_", which I use to specify we're in the [`(n | p)*`] part of the regex, we do comparisons with the characters n and p as much as we can, after which we continue as normal. +When we reach "\_", which I use to specify we're in the {` (n | p)*} part of the regex, we do comparisons with the characters n and p as much as we can, after which we continue as normal. Of course, this version only supports one regular expressions, however a "proper" implementation would look conceptually similar: a couple of different loops and equality checks, with maybe an additional array or two. -The huge benefit is that that loops and arrays are stupid fast, a (simple) C++ for loop could be translated into [url https://godbolt.org/#g:!%28%28g:!%28%28g:!%28%28h:codeEditor,i:%28filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:c%2B%2B,selection:%28endColumn:16,endLineNumber:6,positionColumn:16,positionLineNumber:6,selectionStartColumn:16,selectionStartLineNumber:6,startColumn:16,startLineNumber:6%29,source:'//+Type+your+code+here,+or+load+an+example.%0Aint+f%28int+num%29+%7B%0A++++for+%28int+i+%3D+1%3B+i+%3C+100%3B+i%2B%2B%29+%7B%0A++++++++num+*%3D+100%3B%0A++++%7D%0A++++return+num%3B%0A%7D'%29,l:'5',n:'0',o:'C%2B%2B+source+%231',t:'0'%29%29,k:50,l:'4',n:'0',o:'',s:0,t:'0'%29,%28g:!%28%28h:compiler,i:%28compiler:g122,deviceViewOpen:'1',filters:%28b:'0',binary:'1',binaryObject:'1',commentOnly:'0',demangle:'0',directives:'0',execute:'1',intel:'0',libraryCode:'0',trim:'1'%29,flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:1,lang:c%2B%2B,libs:!%28%29,options:'',selection:%28endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1%29,source:1%29,l:'5',n:'0',o:'+x86-64+gcc+12.2+%28Editor+%231%29',t:'0'%29%29,k:50,l:'4',n:'0',o:'',s:0,t:'0'%29%29,l:'2',n:'0',o:'',t:'0'%29%29,version:4 a handful of processor instructions]. +The huge benefit is that that loops and arrays are stupid fast, a (simple) C++ for loop could be translated into {url a handful of processor instructions;https://godbolt.org/#g:!%28%28g:!%28%28g:!%28%28h:codeEditor,i:%28filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:c%2B%2B,selection:%28endColumn:16,endLineNumber:6,positionColumn:16,positionLineNumber:6,selectionStartColumn:16,selectionStartLineNumber:6,startColumn:16,startLineNumber:6%29,source:'//+Type+your+code+here,+or+load+an+example.%0Aint+f%28int+num%29+%7B%0A++++for+%28int+i+%3D+1%3B+i+%3C+100%3B+i%2B%2B%29+%7B%0A++++++++num+*%3D+100%3B%0A++++%7D%0A++++return+num%3B%0A%7D'%29,l:'5',n:'0',o:'C%2B%2B+source+%231',t:'0'%29%29,k:50,l:'4',n:'0',o:'',s:0,t:'0'%29,%28g:!%28%28h:compiler,i:%28compiler:g122,deviceViewOpen:'1',filters:%28b:'0',binary:'1',binaryObject:'1',commentOnly:'0',demangle:'0',directives:'0',execute:'1',intel:'0',libraryCode:'0',trim:'1'%29,flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:1,lang:c%2B%2B,libs:!%28%29,options:'',selection:%28endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1%29,source:1%29,l:'5',n:'0',o:'+x86-64+gcc+12.2+%28Editor+%231%29',t:'0'%29%29,k:50,l:'4',n:'0',o:'',s:0,t:'0'%29%29,l:'2',n:'0',o:'',t:'0'%29%29,version:4}. On the other hand, usually grammars are more complicated and resource-intensive. -Certain ones are simple enough to implement, like [`S -> aSb | cc`]: +Certain ones are simple enough to implement, like {` S -> aSb | cc}: ```cpp bool matchesp(string str) { @@ -302,37 +306,36 @@ bool matchesp(string str) { return false; } -'footnote context-free-grammars Be careful about cases that are too complicated, the grammar I'm showing is "context-free", but that topic is way beyond the scope of this post. - -However think about more complicated cases[$context-free-grammars], like [`S -> aSbSa | cc`]. -Implementing this one is quite a bit more difficult, since we don't know where [`b`] is located on the first iteration, it could either be the 4th character [`accb...a`] or the 9th [`aaccbccab...a`]. -Searching for it is also complicated, it could be the first, the last or any other [`b`] in the middle of the string. +However think about more complicated cases{fn Be careful about cases that are too complicated, the grammar I'm showing is "context-free", but that topic is way beyond the scope of this post.}, like {` S -> aSbSa | cc}. +Implementing this one is quite a bit more difficult, since we don't know where {` b} is located on the first iteration, it could either be the 4th character {` accb...a} or the 9th {` aaccbccab...a}. +Searching for it is also complicated, it could be the first, the last or any other {` b} in the middle of the string. Another difficulty with grammars is ambiguity, let's look at -```grammar +'def LANG grammar +``` E -> E + E | E * E | n -how would it generate [`n + n * n`]? +how would it generate {` n + n * n}? There are two completely valid ways to do so: -```grammar+ +'def LANG grammar+ +``` E ⇒ E + E ⇒ n + E * E ⇒ n + n * n -```grammar+ +'def LANG grammar+ +``` E ⇒ E * E ⇒ E + E * n ⇒ n + n * n How exactly we deal with these problems comes later, for now the takeaway is that we have to try and use regular expressions wherever we can, and leave grammars as a bit of a last resort. #### Practical usage -'footnote static-typing Yeah yeah, in a statically typed language you might not be able to do operations on doubles and integers at the same time, but you get the point. - Let's think a bit more about grammars: they're really good at handling structure, especially recursive structure, so it's best if we use them only for that. -Our math expression grammar (from [url #grammars here]) shouldn't really care if we're trying to sum integers or floats or chars[$static-typing], it's important how everything is laid out and that our operations are done with numbers. +Our math expression grammar (from {url here;#grammars}) shouldn't really care if we're trying to sum integers or floats or chars{fn Yeah yeah, in a statically typed language you might not be able to do operations on doubles and integers at the same time, but you get the point.}, it's important how everything is laid out and that our operations are done with numbers. -This is why we're going to separate and generalize the code into [url https://en.wikipedia.org/wiki/Lexical_analysis#Token tokens], basically into building blocks. -As a rough example, we want [`1 + (2 * 3)`] to be transformed into [`NUMBER MATHOP LBRACE NUMBER MATHOP NUMBER RBRACE`], [`int var = 13;`] into [`TYPE NAME ASSIGNMENT NUMBER`] and so on, where "TYPE", "NUMBER", "NAME", ... are tokens. +This is why we're going to separate and generalize the code into {url tokens;https://en.wikipedia.org/wiki/Lexical_analysis#Token}, basically into building blocks. +As a rough example, we want {` 1 + (2 * 3)} to be transformed into {` NUMBER MATHOP LBRACE NUMBER MATHOP NUMBER RBRACE}, {` int var = 13;} into {` TYPE NAME ASSIGNMENT NUMBER} and so on, where "TYPE", "NUMBER", "NAME", ... are tokens. Now we're reducing the amount of "objects" our grammars need to work on: from all characters to many (but significantly fewer) tokens. Also we're simplifying our work, since we're trying to figure out the overall structure, it doesn't matter if we're multiplying or summing numbers, it's important that we're doing a mathematical operation on them. Of course, each token will actually be a pair, containing it's name (NUMBER, TYPE, ...) and it's value, but our grammars will work with the names only and output the actual values at the very end. @@ -340,9 +343,9 @@ Usually we identify at least six token types: .bulleted - identifiers: variable and function names for example -- keywords: [`if`], [`while`], [`for`], [`return`], ... -- separators: braces, [`;`] -- operators: [`+`], [`-`], [`<=`] +- keywords: {` if}, {` while}, {` for}, {` return}, ... +- separators: braces, {` ;} +- operators: {` +}, {` -}, {` <=} - literals: numbers, strings, characters - comments @@ -358,8 +361,8 @@ Proper algorithms that "implement" grammars are kind of complicated, and most ca Generally we categorize them into: .bulleted -- [url https://en.wikipedia.org/wiki/Top-down_parsing top-down] algorithms, which work in the way we've been talking about grammars: start with a name and replace it with it's expression, and continue replacements until we have no more names -- [url https://en.wikipedia.org/wiki/Bottom-up_parsing bottom-up] algorithms, where we do the opposite: for each substring we find from which rule it could've come from, replace it with the corresponding name, and continue upwards like that, until we reach the starting name +- {url top-down;https://en.wikipedia.org/wiki/Top-down_parsing} algorithms, which work in the way we've been talking about grammars: start with a name and replace it with it's expression, and continue replacements until we have no more names +- {url bottom-up;https://en.wikipedia.org/wiki/Bottom-up_parsing} algorithms, where we do the opposite: for each substring we find from which rule it could've come from, replace it with the corresponding name, and continue upwards like that, until we reach the starting name Furthermore, if our algorithms allow for ambiguity (meaning we can replace a name with any one of multiple expressions), we divide them into: @@ -372,7 +375,7 @@ Looking at some of the more famous ones: ##### LL -[url https://en.wikipedia.org/wiki/LL_parser LL]: top-down left-most derivations algorithm that can parse only specific types of grammars. +{url LL;https://en.wikipedia.org/wiki/LL_parser}: top-down left-most derivations algorithm that can parse only specific types of grammars. In these grammars, every expression is uniquely identifiable by just looking at the characters (tokens) in the very beginning. The amount of token we need to look for is very important, so we usually define LL(k) as an LL grammar that needs to look at k amount of tokens. An "LL(k) grammar" is, by extension, a grammar which can be parsed with an LL(k) parser. @@ -383,57 +386,63 @@ We check the first k character of all expressions, and if anyone of them is a na :unordered - As an example, the grammar: - ```grammar + 'def LANG grammar + ``` 'snippet 1 2 ./grammar_trace_1.txt is LL(1). - Let's read the input [`(a + a)`] (the "v" points to the symbol we're looking/peeking at): + Let's read the input {` (a + a)} (the "v" points to the symbol we're looking/peeking at): - ```grammar + 'def LANG grammar + ``` 'snippet 4 8 ./grammar_trace_1.txt - we start with [`S`], we peek and get the [`(`], in our production we're looking at a name, S. + we start with {` S}, we peek and get the {` (}, in our production we're looking at a name, S. Let's check the first character of every expression of S. - In the first expression, the first "character" is [`F`], a name, so we look at every expression for [`F`]. + In the first expression, the first "character" is {` F}, a name, so we look at every expression for {` F}. There is only one, which is "a", different than "(", no dice. Now we check the second expression for S, it's first character is "(", success! We replace: - ```grammar + 'def LANG grammar + ``` 'snippet 10 14 ./grammar_trace_1.txt - Now the first symbol in our production is also [`(`], so we increment the symbols we're looking/peeking at + Now the first symbol in our production is also {` (}, so we increment the symbols we're looking/peeking at - ```grammar + 'def LANG grammar + ``` 'snippet 16 20 ./grammar_trace_1.txt - we peek and get the [`a`], in our production the second "character" is the name [`S`], [`S`] has to become [`a`]. - We do that same check from before, first expression for [`S`] is [`F`], whose first (and only) expression is [`a`], success! + we peek and get the {` a}, in our production the second "character" is the name {` S}, {` S} has to become {` a}. + We do that same check from before, first expression for {` S} is {` F}, whose first (and only) expression is {` a}, success! - ```grammar + 'def LANG grammar + ``` 'snippet 22 26 ./grammar_trace_1.txt - The middle characters " + " are matched and at the second [`F`] we check it's expressions, it has only [`a`], success, replace, end of input, we're done. + The middle characters " + " are matched and at the second {` F} we check it's expressions, it has only {` a}, success, replace, end of input, we're done. - Another LL(1) example can be found in [url http://www.cs.ecu.edu/karl/5220/spr16/Notes/Top-down/LL1.html Karl R. Abrahamson notes]. + Another LL(1) example can be found in {url Karl R. Abrahamson notes;http://www.cs.ecu.edu/karl/5220/spr16/Notes/Top-down/LL1.html}. - The grammar - ```grammar + 'def LANG grammar + ``` B -> b C -> c S -> aaB | aaC is LL(3). - For the input [`aab`], if we look at the first two "a"s, we still don't know which rule to use: [`aaB`] or [`aaC`]. - However if we look at the third symbol, "b", then we can determine that we need [`aaB`]. + For the input {` aab}, if we look at the first two "a"s, we still don't know which rule to use: {` aaB} or {` aaC}. + However if we look at the third symbol, "b", then we can determine that we need {` aaB}. -- Usually parsers that implement this procedure are called [url https://en.wikipedia.org/wiki/Recursive_descent_parser recursive descent parsers] +- Usually parsers that implement this procedure are called {url recursive descent parsers;https://en.wikipedia.org/wiki/Recursive_descent_parser} ##### LR -[url https://en.wikipedia.org/wiki/LR_parser LR]: bottom-up right-most derivations algorithm. +{url LR;https://en.wikipedia.org/wiki/LR_parser}: bottom-up right-most derivations algorithm. Conceptually, LR works in the exact opposite way to LL: for every character in the input, we find a rule that substitutes it (or that substitutes the current collection of names and character) and do so until we've reached the starting name. Figuring out an approach isn't as intuitive and easy as with LL, but it still isn't too hard. @@ -442,7 +451,8 @@ It all boils down to using a whole bunch of conditional statements and tracing w :unordered - Let's look at the first LL example: - ```grammar + 'def LANG grammar + ``` 'snippet 1 2 ./grammar_trace_2.txt We need to track the current state of the string, because imagine we've just read an "a", it could either be from the left or right handside of "a + a", and that changes what character to expect next. @@ -454,9 +464,9 @@ It all boils down to using a whole bunch of conditional statements and tracing w |: 0 |: Nothing; this is the start |: 1 - |: The name [`S`]; the final number should be this + |: The name {` S}; the final number should be this |: 2 - |: The name [`F`] + |: The name {` F} |: 3 |: The character "(" |: 4 @@ -504,7 +514,7 @@ It all boils down to using a whole bunch of conditional statements and tracing w 'snippet 16 17 ./grammar_trace_2.txt We have a different state for "(S", because if we didn't, we would've gone to state 1, and could've ended the algorithm then and there, without reading the rest of the input. - Otherwise, we continue as normal, we read the [`+`] and the spaces around it, going to state 6. + Otherwise, we continue as normal, we read the {` +} and the spaces around it, going to state 6. ``` 'snippet 19 20 ./grammar_trace_2.txt @@ -577,7 +587,7 @@ It all boils down to using a whole bunch of conditional statements and tracing w - You're probably wondering why the table works so weird, like why on state 3 we don't directly replace "a" with "S" and change to state 5 for example. The reason is that the way I showed the algorithm isn't exactly how it normally works. - Rather than tracing the current state in a variable, we trace it with a [url https://en.wikipedia.org/wiki/Stack_%28abstract_data_type%29 stack]. + Rather than tracing the current state in a variable, we trace it with a {url stack;https://en.wikipedia.org/wiki/Stack_%28abstract_data_type%29}. When you read a character and have to go to another state, the state is added to the stack (this operation is called "shift"). When we have to change characters from String (without reading anything), with a string (expression) of length j, we remove the last j added states and do a normal shift from the last state and character in String (this operation is called "reduce"). @@ -615,27 +625,27 @@ It all boils down to using a whole bunch of conditional statements and tracing w This way we avoid doing different things on different states and we don't need to store the whole string, only the last few characters. Additionally, in the real world nobody makes this table by hand, it is generated by a program, and this method makes table generation easier. -- As for the complete table, you can view it on the [url https://smlweb.cpsc.ucalgary.ca/lr0.php?grammar=S+-%3E+F+%7C+%28+S+%2B+F+%29.%0AF+-%3E+a.&substs= Context Free Grammar Checker],\n - or with a more pretty styling on [url https://mdaines.github.io/grammophone/?s=UyAtPiBGIHwgIigiIFMgIisiIEYgIikiLgpGIC0+IGEu#/ Grammophone], opening "Parsing table" on the row "LR(0)". +- As for the complete table, you can view it on the {url Context Free Grammar Checker;https://smlweb.cpsc.ucalgary.ca/lr0.php?grammar=S+-%3E+F+%7C+%28+S+%2B+F+%29.%0AF+-%3E+a.&substs=},\n + or with a more pretty styling on {url Grammophone;https://mdaines.github.io/grammophone/?s=UyAtPiBGIHwgIigiIFMgIisiIEYgIikiLgpGIC0+IGEu#/}, opening "Parsing table" on the row "LR(0)". To read the table, remember that: .bulleted - on every row you have each state - on every column you have each possible value in the string and "$" which signifies the end of the string - - with [`sr`] or [`shift`] (or just with a number) you go to another state - - with [`r`] or [`reduce`] you make the substitution in the current string and go back one state - - [`acc`] or [`accept`] means you've reached the end and the string is valid + - with {` sr} or {` shift} (or just with a number) you go to another state + - with {` r} or {` reduce} you make the substitution in the current string and go back one state + - {` acc} or {` accept} means you've reached the end and the string is valid ##### LR's family LR is more of a family of algorithms, because there are multiple different ways to generate the table, each with it's own benefits and drawbacks. This subject is a really big can of beans, which I'm not knowledgeable enough to talk about. -What you need to know is that there are 3 often used types: [url https://en.wikipedia.org/wiki/Canonical_LR_parser CLR], [url https://en.wikipedia.org/wiki/Simple_LR_parser SLR] and [url https://en.wikipedia.org/wiki/LALR_parser LALR]. +What you need to know is that there are 3 often used types: {url CLR;https://en.wikipedia.org/wiki/Canonical_LR_parser}, {url SLR;https://en.wikipedia.org/wiki/Simple_LR_parser} and {url LALR;https://en.wikipedia.org/wiki/LALR_parser}. .bulleted -- CLR is an LR parser with 1 character lookahead (LR(1)), following [url TODO Knuth]'s original theory. +- CLR is an LR parser with 1 character lookahead (LR(1)), following {url Knuth;TODO}'s original theory. It requires a lot of memory for table generation, so Frank DeRemer created two simplifications: - the SLR and LALR, which use significantly less memory but work with a bit less grammars @@ -646,28 +656,26 @@ LALR is the most commonly used LR parser, however most compilers are custom-tail If you want to learn more, I would highly suggest: .bulleted -- [url https://blog.reverberate.org/2013/07/ll-and-lr-parsing-demystified.html LL and LR Parsing Demystified] and [url https://blog.reverberate.org/2013/09/ll-and-lr-in-context-why-parsing-tools.html LL and LR in Context: Why Parsing Tools Are Hard] by [url https://blog.reverberate.org/about/ Josh Haberman] -- [url http://jeffreykegler.github.io/Ocean-of-Awareness-blog/individual/2014/11/ll.html Parsing: Top-down versus bottom-up] by [url https://jeffreykegler.github.io/personal/ Jeffrey Kegler] -- [url https://tratt.net/laurie/blog/2020/which_parsing_approach.html Which Parsing Approach?] by [url https://tratt.net/laurie/ Laurence Tratt] -- [url https://tomassetti.me/guide-parsing-algorithms-terminology/ A Guide to Parsing: Algorithms and Terminology] by [url https://inre.me/ Gabriele Tomassetti] -- [url http://www.cs.ecu.edu/karl/5220/spr16/Notes/Parsing/index.html Parsing], [url http://www.cs.ecu.edu/karl/5220/spr16/Notes/Top-down/index.html Top-Down Parsers] and [url http://www.cs.ecu.edu/karl/5220/spr16/Notes/Bottom-up/index.html Bottom-Up Parsers] from [url http://www.cs.ecu.edu/karl/5220/spr16/Notes/Bottom-up/index.html Karl R. Abrahamson]'s notes -- [url https://serokell.io/blog/how-to-implement-lr1-parser How to Impement an LR(1) Parser] by Kirill Andreev +- {url LL and LR Parsing Demystified;https://blog.reverberate.org/2013/07/ll-and-lr-parsing-demystified.html} and {url LL and LR in Context: Why Parsing Tools Are Hard;https://blog.reverberate.org/2013/09/ll-and-lr-in-context-why-parsing-tools.html} by {url Josh Haberman;https://blog.reverberate.org/about/} +- {url Parsing: Top-down versus bottom-up;http://jeffreykegler.github.io/Ocean-of-Awareness-blog/individual/2014/11/ll.html} by {url Jeffrey Kegler;https://jeffreykegler.github.io/personal/} +- {url Which Parsing Approach?;https://tratt.net/laurie/blog/2020/which_parsing_approach.html} by {url Laurence Tratt;https://tratt.net/laurie/} +- {url A Guide to Parsing: Algorithms and Terminology;https://tomassetti.me/guide-parsing-algorithms-terminology/} by {url Gabriele Tomassetti;https://inre.me/} +- {url Parsing;http://www.cs.ecu.edu/karl/5220/spr16/Notes/Parsing/index.html}, {url Top-Down Parsers;http://www.cs.ecu.edu/karl/5220/spr16/Notes/Top-down/index.html} and {url Bottom-Up Parsers;http://www.cs.ecu.edu/karl/5220/spr16/Notes/Bottom-up/index.html} from {url Karl R. Abrahamson;http://www.cs.ecu.edu/karl/5220/spr16/Notes/Bottom-up/index.html}'s notes +- {url How to Impement an LR(1) Parser;https://serokell.io/blog/how-to-implement-lr1-parser} by Kirill Andreev #### Abstract syntax tree We already decided that the lexer will output tokens (and characters) to the parser, but we didn't talk about what the parser is supposed to output. -It definitely has to be some sort of structural representation of the overall code, for example, for [`3 + 1 * 2`] we have to be able to easily find out what the left and right handsides of the [`+`] and [`*`] are. - -'footnote nomnoml The graphics are made with [url https://nomnoml.com/ nomnoml] by [url https://github.com/skanaar Daniel Kallin] +It definitely has to be some sort of structural representation of the overall code, for example, for {` 3 + 1 * 2} we have to be able to easily find out what the left and right handsides of the {` +} and {` *} are. -Let's draw out[$nomnoml] this relationship, where the left arrow connects to the left handside and the right accordingly: +Let's draw out{fn The graphics are made with {url nomnoml;https://nomnoml.com/} by {url Daniel Kallin;https://github.com/skanaar}} this relationship, where the left arrow connects to the left handside and the right accordingly: -[image ./img/tree-simple.svg] +{img ./img/tree-simple.svg} -Hey, that looks an awful lot like a [url https://en.wikipedia.org/wiki/Tree_%28data_structure%29 tree]! -Trees are nodes, some sort of elements, where there is a connection from one element to some other elements, with the only rule being that cycles [=aren't=] allowed: +Hey, that looks an awful lot like a {url tree;https://en.wikipedia.org/wiki/Tree_%28data_structure%29}! +Trees are nodes, some sort of elements, where there is a connection from one element to some other elements, with the only rule being that cycles {b aren't} allowed: -[image ./img/tree-cycle.svg] +{img ./img/tree-cycle.svg} Great, but can we represent everything else with a tree? Why, of course, for example we can represent: @@ -680,130 +688,134 @@ else as -[image ./img/tree-if.svg] +{img ./img/tree-if.svg} You might ask how we generate the tree, and the answer is simple: on every step we add nodes to the tree, depending on the situation. Let's look at a familiar example: -```grammar +'def LANG grammar +``` N -> 1 | 2 | 3 E -> N | (E) | E + E | E * E -Let's look at the input string [`2 * (1 + 3)`], while abstracting ourselves from any particular algorithm: +Let's look at the input string {` 2 * (1 + 3)}, while abstracting ourselves from any particular algorithm: :unordered -- we read the [`2`], that is a number, we add it as a node +- we read the {` 2}, that is a number, we add it as a node - .p [image ./img/tree-building-1.svg] + .p {img ./img/tree-building-1.svg} -- then we read the [`*`], we now know our expression is in the form [`E* E`]. +- then we read the {` *}, we now know our expression is in the form {` E* E}. If you think about it, up to this point, we've basically been building a tree for the left handside. - [=If=] the topmost element in that tree is a brace, + {b If} the topmost element in that tree is a brace, - .p [image ./img/tree-building-ex1.svg] + .p {img ./img/tree-building-ex1.svg} - we connect it to the left handside of [`*`]: + we connect it to the left handside of {` *}: - .p [image ./img/tree-building-ex2.svg] + .p {img ./img/tree-building-ex2.svg} - [=Otherwise=] (when it's [`+`] or [`*`] or a number), because of precedence, we'll attach the latest number to the left handside. - However we have to be careful, if something connects to the number, we now need it to connect to the [`*`].\n - For example, let's say we had [`1 + 2 * 3`], and we've just read the [`*`]. + {b Otherwise} (when it's {` +} or {` *} or a number), because of precedence, we'll attach the latest number to the left handside. + However we have to be careful, if something connects to the number, we now need it to connect to the {` *}.\n + For example, let's say we had {` 1 + 2 * 3}, and we've just read the {` *}. The tree up to this point would look like, - .p [image ./img/tree-building-ex3.svg] + .p {img ./img/tree-building-ex3.svg} - where the latest number we've found was [`2`], but the [`+`] connects to it. - So, we need to make the [`2`] connect to the left handside of [`*`], and make [`+`] connect to [`*`] instead of [`2`] + where the latest number we've found was {` 2}, but the {` +} connects to it. + So, we need to make the {` 2} connect to the left handside of {` *}, and make {` +} connect to {` *} instead of {` 2} - .p [image ./img/tree-building-ex4.svg] + .p {img ./img/tree-building-ex4.svg} - In our original case, nothing connects to the [`2`] in [`2 * (1 + 3)`], so we can just connect it to the left handside of [`*`] + In our original case, nothing connects to the {` 2} in {` 2 * (1 + 3)}, so we can just connect it to the left handside of {` *} - .p [image ./img/tree-building-2.svg] + .p {img ./img/tree-building-2.svg} where the three dots signify there isn't anything there (but we expect there to be). Somewhere we'll store that the next element we find has to be connected to the right handside. -- now we read [`(`], we cannot have it by itself, so we directly decide we're working with [`(E)`] (in our full algorithm we would need a check for existance of matching brace). - We'll create a [`()`] node and because of the last step, we'll connect it to the right handside. +- now we read {` (}, we cannot have it by itself, so we directly decide we're working with {` (E)} (in our full algorithm we would need a check for existance of matching brace). + We'll create a {` ()} node and because of the last step, we'll connect it to the right handside. - .p [image ./img/tree-building-3.svg] + .p {img ./img/tree-building-3.svg} - Now, moving forward, we'll be creating a subtree, essentially making a second tree, and after that is done, we'll connect it's topmost element (root) to the [`()`] node. + Now, moving forward, we'll be creating a subtree, essentially making a second tree, and after that is done, we'll connect it's topmost element (root) to the {` ()} node. - and so on. The overall algorithm is to add and change nodes every time you match something with a grammar rule, and the adding and changing is done, depending on the language, the current structure and so on. -When discussing the middle and back-end layers, we'll talk about how to work with a generated AST, but for now your clue is the [url https://en.wikipedia.org/wiki/Visitor_pattern visitor pattern]. +When discussing the middle and back-end layers, we'll talk about how to work with a generated AST, but for now your clue is the {url visitor pattern;https://en.wikipedia.org/wiki/Visitor_pattern}. ### Implementing a front-end If you want, you could implement your own lexer and parser manually, but as a start, it's worthwhile to try and use already created stuff. -[url https://en.wikipedia.org/wiki/Compiler-compiler Compiler-compilers] are tools that create parsers (and more) from their normal formal definition. +{url Compiler-compilers;https://en.wikipedia.org/wiki/Compiler-compiler} are tools that create parsers (and more) from their normal formal definition. The two popular ones from the old days are lex and yacc. lex is a lexer generator and yacc is a LALR parser generator, both of which generate a corresponding C implementation of the given regular expressions and grammars. #### lex -Lex is the original program, from 1975, in the modern day it's successor/implementation is the open-source [url https://github.com/westes/flex flex]. +Lex is the original program, from 1975, in the modern day it's successor/implementation is the open-source {url flex;https://github.com/westes/flex}. A lex source file is divided into three parts: -```lex -'include ./template.l +'def LANG lex +``` +'snippet 1 $ ./template.l -where [`%{%}`] is used for includes and declarations, the rules are your regular expressions and the C code is the general logic of the lexer. -Usually you wouldn't write anything in the C code section, the defaults are fine, but you'll probably need to do one or two includes in the [`%{%}`] section. +where {` %{%}} is used for includes and declarations, the rules are your regular expressions and the C code is the general logic of the lexer. +Usually you wouldn't write anything in the C code section, the defaults are fine, but you'll probably need to do one or two includes in the {` %{%}} section. -Rules are in the form [`regex { C_code }`]. +Rules are in the form {` regex { C_code }}. To simplify your life, you can write only the regex or a part of it inside the "definitions" part of the file, and give it a name to use later. Referencing those names in later regexes is done by surrounding them in curly braces. -Usually the [`C_code`] in the regex would be a return (more commonly called "emit") of a token, which will be available in a header file, but more on that later. +Usually the {` C_code} in the regex would be a return (more commonly called "emit") of a token, which will be available in a header file, but more on that later. Let's look at a very simple example program: every whole number is printed as "NUMBER", while everything else is printed as-is: -```lex -'include ./example_lex/lexer.l +'def LANG lex +``` +'snippet 1 $ ./example_lex/lexer.l -The syntax [`[0-9]`] is the same as [`(0 | 1 | ... | 9)`], it works for any letters and is available in all modern regexes. -Note that inside every regex's "body" you have an assortment of variables already set, one of them being [`yytext`] which is just the whole match. -Additionally lex matches the longest possible match, so if we had a rule [`[0-z]`], only it will be matched. +The syntax {` [0-9]} is the same as {` (0 | 1 | ... | 9)}, it works for any letters and is available in all modern regexes. +Note that inside every regex's "body" you have an assortment of variables already set, one of them being {` yytext} which is just the whole match. +Additionally lex matches the longest possible match, so if we had a rule {` [0-z]}, only it will be matched. -If this file is located in [`lexer.l`], we can transform it into a C file with: +If this file is located in {` lexer.l}, we can transform it into a C file with: ```bash flex lexer.l -Usually the result file is always named [`lex.yy.c`]. +Usually the result file is always named {` lex.yy.c}. Afterwards, we can compile the C code into a working compiler: ```bash gcc lex.yy.c -lfl -Without the [`-lfl`] flag, we would get a linking error, because of the [`main`] and [`yywrap`] function, which are required but aren't defined in our generated code. +Without the {` -lfl} flag, we would get a linking error, because of the {` main} and {` yywrap} function, which are required but aren't defined in our generated code. There are three ways to fix this problem: :numbered -1. The one I've opted for, use the [`-lfl`] flag to compile our C code with a (flex) library which provides both functions. - Usually the lexer isn't meant to be ran by itself, so for the current time being, [`-lfl`] is the best option, the other two are fine when we get to [`yacc`]. +1. The one I've opted for, use the {` -lfl} flag to compile our C code with a (flex) library which provides both functions. + Usually the lexer isn't meant to be ran by itself, so for the current time being, {` -lfl} is the best option, the other two are fine when we get to {` yacc}. -2. Put [`%option noyywrap`] in the definitions section, which means the lexer will only read one file. +2. Put {` %option noyywrap} in the definitions section, which means the lexer will only read one file. 3. Define it ourselves. It should return 0 if our lexer should continue with the next given file, after finishing with the current one, or 1 if it should stop execution. The function could be written in either "C code" section, but I personally prefer the last one. - ```lex + 'def LANG lex + ``` int yywrap() { return 0; } Of course, you can use your lex implementation or C compiler of choice, and there this might not be a problem. -Now, if you run [`./a.out`] you would get a prompt, every line you write will be lexically analyzed and in our case, everything will be printed out. +Now, if you run {` ./a.out} you would get a prompt, every line you write will be lexically analyzed and in our case, everything will be printed out. Entering ``` @@ -827,8 +839,9 @@ and strings: We'll define numbers as both whole digits and floating point numbers (with sign) and strings can be surrounded in either single or double quotes. -```lex -'include ./example_lex/numbers_html.l +'def LANG lex +``` +'snippet 1 $ ./example_lex/numbers_html.l With the input @@ -841,45 +854,50 @@ we'll get John said <span class="num">10</span> times <span class="str">"2 + 2 = 5"</span> but <span class="str">'2 + 2 = 4'</span>! You've probably already noticed that the number inside the strings aren't matched, because the string rule results in a longer match. -In certain programming languages, that don't have [url https://en.wikipedia.org/wiki/String_interpolation string interpolation] this is fine, but for others our regexes have to be a lot more complicated. +In certain programming languages, that don't have {url string interpolation;https://en.wikipedia.org/wiki/String_interpolation} this is fine, but for others our regexes have to be a lot more complicated. #### yacc -Similarly to lex, yacc originates from 1975, and it's modern replacement is [url https://www.gnu.org/software/bison/ GNU Bison]. +Similarly to lex, yacc originates from 1975, and it's modern replacement is {url GNU Bison;https://www.gnu.org/software/bison/}. A yacc file looks very similarly to a lex one: -```yacc -'include ./template.y +'def LANG yacc +``` +'snippet 1 $ ./template.y however rather than definitions you have declarations, and the rules are in a completely different format (because they're grammars). -Token names are defined in [`declarations`], in the format +Token names are defined in {` declarations}, in the format -```yacc +'def LANG yacc +``` %token NAME1 NAME2 ... -You can also define precedence with [`%left`] and [`%right`]. -There are also other options you can set, like the start name with [`%start`]. +You can also define precedence with {` %left} and {` %right}. +There are also other options you can set, like the start name with {` %start}. Grammars are in the form -```yacc +'def LANG yacc +``` name : TOKEN1 TOKEN2 ... ; where alternation is defined like -```yacc +'def LANG yacc +``` name : TOKEN1 | TOKEN2 | TOKEN3 ; -and it always must end with a [`;`]. +and it always must end with a {` ;}. On each alternation, you can (should) specify a body, which will contain C code to be executed, if this rule is reached -```yacc +'def LANG yacc +``` name : TOKEN1 { C code here } | TOKEN2 | TOKEN3 { C code here } @@ -887,38 +905,40 @@ name : TOKEN1 { C code here } Another difference is that, since the parser needs a list of tokens, you cannot run it by itself, you'll also need to setup a lexer. -'footnote shift-reduce-conflicts You might be tempted to try and make one for the grammar inside the [url #abstract-syntax-tree AST] section, but that one is ever so slightly problematic, because it's ambiguous (I showed why at the end of [url #implementational-difficulties-with-grammars Implementational difficulties with grammars]). Bison [url https://www.gnu.org/software/bison/manual/html_node/Shift_002fReduce.html can handle ambiguity by always choosing to shift], but I didn't want to complicate things. +Let's implement a parser for the grammar{fn You might be tempted to try and make one for the grammar inside the {url AST;#abstract-syntax-tree} section, but that one is ever so slightly problematic, because it's ambiguous (I showed why at the end of {url Implementational difficulties with grammars;#implementational-difficulties-with-grammars}). Bison {url can handle ambiguity by always choosing to shift;https://www.gnu.org/software/bison/manual/html_node/Shift_002fReduce.html}, but I didn't want to complicate things.}: -Let's implement a parser for the grammar[$shift-reduce-conflicts]: - -```grammar +'def LANG grammar +``` N -> 1 | 2 | 3 S -> N | (S + S) | (S * S) First, our tokens, we want to replace all characters with a token. -For 1, 2 and 3, let's use the token name "NUMBER", for "(" and ")", LBRACE and RBRACE accordingly, and since there is no precedence with this grammar, we don't actually care if we have [`(S + S)`] or [`(S * S)`], so we can assign both [`+`] and [`*`] to the token MATHOP. +For 1, 2 and 3, let's use the token name "NUMBER", for "(" and ")", LBRACE and RBRACE accordingly, and since there is no precedence with this grammar, we don't actually care if we have {` (S + S)} or {` (S * S)}, so we can assign both {` +} and {` *} to the token MATHOP. Meaning, our grammar would behave more like this: -```grammar +'def LANG grammar +``` N -> 1 | 2 | 3 M -> + | * S -> N | (S M S) -First, we need to make our [`lexer.l`], it is going to be very simple: +First, we need to make our {` lexer.l}, it is going to be very simple: -```lex -'include ./example_yacc/lexer.l +'def LANG lex +``` +'snippet 1 $ ./example_yacc/lexer.l Now, tokens (names) are defined inside grammars, however our lexer needs to emit (return) them. -That's why, when running bison on our [`parser.y`], we'll also create a C header file, which contains those names already defined, so they're accessible inside [`lexer.l`]. -This file is in the format [`FILENAME.tab.h`], where [`FILENAME.y`] is our source yacc file. +That's why, when running bison on our {` parser.y}, we'll also create a C header file, which contains those names already defined, so they're accessible inside {` lexer.l}. +This file is in the format {` FILENAME.tab.h}, where {` FILENAME.y} is our source yacc file. -Second, we need to make our [`parser.y`]: +Second, we need to make our {` parser.y}: -```yacc -'include ./example_yacc/parser.y +'def LANG yacc +``` +'snippet 1 $ ./example_yacc/parser.y -A quirk with GNU Bison is that you need to declare the function [`yylex`] and [`yyerror`] beforehand, manually define [`yyerror`] and run [`yyparse`] in the main function. +A quirk with GNU Bison is that you need to declare the function {` yylex} and {` yyerror} beforehand, manually define {` yyerror} and run {` yyparse} in the main function. These are precisely the first 5 and the last 8 lines of code, but for now you don't need to think about them. Let's get to compiling. @@ -932,13 +952,13 @@ then our parser: ```bash bison -d parser.y -where the [`-d`] option means we'll also output the [`parser.tab.h`] header file. +where the {` -d} option means we'll also output the {` parser.tab.h} header file. Finally, we compile both of them together into one executable: ```bash gcc lex.yy.c parse.tab.c -lfl -Now when you run [`./a.out`], if you enter a valid string, you'll see a blank line, but if it isn't valid, you'll get "Error: syntax error". +Now when you run {` ./a.out}, if you enter a valid string, you'll see a blank line, but if it isn't valid, you'll get "Error: syntax error". #### Doing it properly @@ -946,23 +966,25 @@ The way we created that lexer and parser worked, but it wasn't very useful and h :ordered 1. When entering a string that isn't matched at all, it gets printed back like nothing happened. - For example, if we enter the letter [`a`] or any string which doesn't have [`(`], [`)`], [`1`], [`2`], [`3`], [`+`] or [`-`] characters, it will just get printed back. - Ideally, we want to raise an error, so we're going to add one rule which catches any (non-special) character and throws an error with the built-in [`yy_fatal_error`]: + For example, if we enter the letter {` a} or any string which doesn't have {` (}, {` )}, {` 1}, {` 2}, {` 3}, {` +} or {` -} characters, it will just get printed back. + Ideally, we want to raise an error, so we're going to add one rule which catches any (non-special) character and throws an error with the built-in {` yy_fatal_error}: - ```lex + 'def LANG lex + ``` . { yy_fatal_error("Bad character"); } This rule must be the last rule, since we don't want it to be matched, if there is another rule that matches. Remember that lex matches the longest possible string and if there are multiple rules which match the same amount of characters, only the first one is matched. 2. For every token name, returned by the lexer, we also need to have it's actual value. - We could make a [`struct`], which holds both a token name and it's value, but there is another [url https://www.gnu.org/software/bison/manual/html_node/Token-Values.html "built-in" mechanism] for that in yacc/Bison. - We would set the global variable [`yylval`] to the token value, and it will be changed for every token. + We could make a {` struct}, which holds both a token name and it's value, but there is another {url "built-in" mechanism;https://www.gnu.org/software/bison/manual/html_node/Token-Values.html} for that in yacc/Bison. + We would set the global variable {` yylval} to the token value, and it will be changed for every token. - By default it's type is [`int`] (in Bison), but usually you would want it to be a [url https://en.wikipedia.org/wiki/Union_type#C/C++ union]. + By default it's type is {` int} (in Bison), but usually you would want it to be a {url union;https://en.wikipedia.org/wiki/Union_type#C/C++}. Let's make it a union of int and char, though the first part is kind of useless, since we're only working with single digit numbers. \n - ```yacc + 'def LANG yacc + ``` %union { int num; char chr; @@ -970,73 +992,80 @@ The way we created that lexer and parser worked, but it wasn't very useful and h Now, inside our lexer, rules would look like: - ```yacc + 'def LANG yacc + ``` RULE1 { yylval.num = 129; return TOKEN; } RULE2 { yylval.chr = 'a'; return TOKEN; } - Inside C blocks for grammar rules we can reference the token values with [`\$i`], where [`i`] is the i'th "token" in the expression. - For example, in this rule, [`\$1`] would be [`(`], [`\$3`] would be value of token [`B`] and [`\$5`] would be the value of the rule name: + Inside C blocks for grammar rules we can reference the token values with {` \$i}, where {` i} is the i'th "token" in the expression. + For example, in this rule, {` \$1} would be {` (}, {` \$3} would be value of token {` B} and {` \$5} would be the value of the rule name: - ```yacc + 'def LANG yacc + ``` rule : ( A B ) rule ; - You can set rule "return" values by setting the variable [`\$$`]: + You can set rule "return" values by setting the variable {` \$$}: - ```yacc + 'def LANG yacc + ``` rule : LBRACE rule RBRACE { $$ = 10; } The way you set it's type is discussed later. - However, [`\$i`] isn't of type union, we cannot do something like [`\$i.num`], it is the precise value that was set for the token. - Therefore, we also need to define which value from the union every token will set, which is done by adding [`<PROPERTY>`] before every defined token (and [`PROPERTY`] is a property name inside the union): + However, {` \$i} isn't of type union, we cannot do something like {` \$i.num}, it is the precise value that was set for the token. + Therefore, we also need to define which value from the union every token will set, which is done by adding {` <PROPERTY>} before every defined token (and {` PROPERTY} is a property name inside the union): - ```yacc + 'def LANG yacc + ``` %token <num> NUMBER <chr> MATHOP <chr> LBRACE <chr> RBRACE - 'footnote better-bison-errors You can add [`%define parse.error verbose`] inside definitions of your yacc file, and it will tell you what character was expected and what character was read. - -3. If we enter one valid math expression, we'll get no error, but when we enter another, we'll get a "syntax error"[$better-bison-errors]. +3. If we enter one valid math expression, we'll get no error, but when we enter another, we'll get a "syntax error"{fn You can add {` %define parse.error verbose} inside definitions of your yacc file, and it will tell you what character was expected and what character was read.}. That is because we try to match only one expression, after it is matched our parser is waiting for an end of file character. Let's make it so we would try to match an expression on every line: - ```yacc + 'def LANG yacc + ``` start : expr | expr start ; - A rule like [`expr : expr expr`] will produce shift/reduce conflicts. - Another option is duplicating our [`expr`] rules and adding [`expr`] in the beginning or end, but that is cumbersome if we want to make changes. + A rule like {` expr : expr expr} will produce shift/reduce conflicts. + Another option is duplicating our {` expr} rules and adding {` expr} in the beginning or end, but that is cumbersome if we want to make changes. 4. We're getting input from the user, but our source text (code) will be in a file. - First, our [`main`] function needs to take program parameters: + First, our {` main} function needs to take program parameters: - ```yacc + 'def LANG yacc + ``` int main(int argc, char* argv[]) Then we need to take the first argument, and open a file. Additionally, we have to check if the file was successfully opened, and print an error and stop execution if so: - ```yacc + 'def LANG yacc + ``` FILE* input = fopen(argv[1], "r"); if (input == NULL) { yyerror("cannot read input file!"); return 1; } - Now for the clever bit, actual parsing in generated code is done on the file [`yyin`], which by default is the standard user input. + Now for the clever bit, actual parsing in generated code is done on the file {` yyin}, which by default is the standard user input. To read a file, all we need to do is change the value of that variable. Also, that variable is defined externally, so first we need to add to (the top) C section: - ```yacc + 'def LANG yacc + ``` extern FILE* yyin; - and then put in our [`main`]: + and then put in our {` main}: - ```yacc + 'def LANG yacc + ``` yyin = input; - On \*NIX systems (Linux, MacOS, OpenBSD, ...) you can still use user input by passing the file [`/dev/stdin`]. - If you want your front-end to support multiple files, you would just need to wrap the whole body of main in a [`for`] loop, iterating over the whole [`argv`] array (remember that [`argc`] is the length of the array). + On \*NIX systems (Linux, MacOS, OpenBSD, ...) you can still use user input by passing the file {` /dev/stdin}. + If you want your front-end to support multiple files, you would just need to wrap the whole body of main in a {` for} loop, iterating over the whole {` argv} array (remember that {` argc} is the length of the array). 5. We need to construct an AST. Since the exact tree structure depends on your needs, I'll make the simplest possible tree in pure C that works for this grammar. @@ -1047,47 +1076,49 @@ yyin = input; #include <stdio.h> 'snippet 2 $ ./proper/tree.c - However, all of this is quite a lot, and it would take a lot of space in [`parser.y`], so let's separate it into [`tree.c`] and add a header file [`tree.h`] which contains the definitions: + However, all of this is quite a lot, and it would take a lot of space in {` parser.y}, so let's separate it into {` tree.c} and add a header file {` tree.h} which contains the definitions: ```c 'snippet 4 15 ./proper/tree.h Of course, we should add some ifndef-def precompiler code, but that isn't relevant for now. - The way we're going to use trees in our grammar is as follows: for the [`NUMBER`] expression of [`expr`], we'll create a node with the (char) value of the number and "return" it. - For the expression of [`expr`] we'll "return" a node with the value of the math operator and left and right will be the returned values. - Inside start, after we've parsed an [`expr`], we'll print out the "returned" tree and free it's memory. + The way we're going to use trees in our grammar is as follows: for the {` NUMBER} expression of {` expr}, we'll create a node with the (char) value of the number and "return" it. + For the expression of {` expr} we'll "return" a node with the value of the math operator and left and right will be the returned values. + Inside start, after we've parsed an {` expr}, we'll print out the "returned" tree and free it's memory. - I'm putting returned in quotes, because (as mentioned), we'll just be setting the value of [`\$$`]. - [`\$$`]'s type is set with the [`%type`] option, which works exactly like [`%token`], but with grammar rule names. - However, this means that [`node`] must be available in [`%union`], which is unfortunate but isn't a problem, we'll just add it. + I'm putting returned in quotes, because (as mentioned), we'll just be setting the value of {` \$$}. + {` \$$}'s type is set with the {` %type} option, which works exactly like {` %token}, but with grammar rule names. + However, this means that {` node} must be available in {` %union}, which is unfortunate but isn't a problem, we'll just add it. - Now, finally, it's time to include our [`tree.h`] in [`parser.y`], but we'll also need to include it in [`lexer.l`]. - The reason is that the [`%union`] appears in [`parser.tab.h`], which means our node structure is referenced in [`parser.tab.h`], but [`tree.h`] isn't included there. + Now, finally, it's time to include our {` tree.h} in {` parser.y}, but we'll also need to include it in {` lexer.l}. + The reason is that the {` %union} appears in {` parser.tab.h}, which means our node structure is referenced in {` parser.tab.h}, but {` tree.h} isn't included there. All in all, we'll have 4 source files for our simple front-end: :unordered -- [`lexer.l`] +- {` lexer.l} - ```lex - 'include ./proper/lexer.l + 'def LANG lex + ``` + 'snippet 1 $ ./proper/lexer.l -- [`parser.y`] +- {` parser.y} - ```yacc - 'include ./proper/parser.y + 'def LANG yacc + ``` + 'snippet 1 $ ./proper/parser.y -- [`tree.h`] +- {` tree.h} ```c - 'include ./proper/tree.h + 'snippet 1 $ ./proper/tree.h -- [`tree.c`] +- {` tree.c} ```c - 'include ./proper/tree.c + 'snippet 1 $ ./proper/tree.c We compile everything: @@ -1095,20 +1126,20 @@ We compile everything: ```bash flex lexer.l && bison -d parser.y && gcc lex.yy.c parser.tab.c tree.c -Now, let's create the file [`test.txt`]: +Now, let's create the file {` test.txt}: ``` -'include proper/test.txt +'snippet 1 $ proper/test.txt and run our front-end on it: ```bash -./a.out test.txt +\./a.out test.txt Our output will be: ``` -'include proper/test_output.txt +'snippet 1 $ proper/test_output.txt Perfect, we have a good looking tree! @@ -1118,4 +1149,6 @@ Originally I planned to put everything in one blog post, but writing the front-e Additionally, while doing research, I found out the course actually skipped over a lot of important topics, which I'll first need to research. Future parts will be linked right below the title at the very top, but it will probably be quite a while until I write them. -Many thanks to [url https://github.com/dtagarev Dimitar Tagarev] for his help with reviewing this post. +Many thanks to {url Dimitar Tagarev;https://github.com/dtagarev} for his help with reviewing this post. + +{footnotes} diff --git a/src/blog/switchut-izgorq/index.du b/src/blog/switchut-izgorq/index.du index 1f23862..b9e5ee3 100644 --- a/src/blog/switchut-izgorq/index.du +++ b/src/blog/switchut-izgorq/index.du @@ -1,9 +1,9 @@ -# Суичът изгоря! +'def title Суичът изгоря! +'def desc Как човек си изкарва безплатен суич заради слабите умения на мрежари -'define expected-reading 2 min -'define created 18 November 2024 -'define edited 18 November 2024 -[$pagenav] +# {title} + +{pagenav 2 min;18 November 2024;18 November 2024} Преди няколко месеца, интернетът у-нас спря. Все още ползваме интернет "по медна свързаност", така че проблемът почти винаги се свежда до мрежовия шкаф на улицата, който всички компании оставят в безразбор. @@ -11,22 +11,22 @@ Обаче, тъкмо като интернетът се върна и мрежарят беше готов да си тръгне, услугата взе че спря отново. Вече доста изнервен, след като провери шкафът още един път, влезе в сградата, изтръгна старият суич (комутатор, но аз съм отраснал с английските наименования), замени го с нов и всичко тръгна. -Неговият отговор, разбира се, беше че "Суичът е изгорял", заедно с един [*любезен*] коментар как "Тази инсталация вече е стара, трябва да си купите оптичен интернет, за да не ви горят суичовете и да не трябва да идвам аз!" +Неговият отговор, разбира се, беше че "Суичът е изгорял", заедно с един {i любезен} коментар как "Тази инсталация вече е стара, трябва да си купите оптичен интернет, за да не ви горят суичовете и да не трябва да идвам аз!" Предвидимо, самият суич ни го беше оставил и си тръгна по пътя. -Та по-късно през деня седнах с един [url https://www.globalsources.com/AC-DC-adapter/plug-in-AC-DC-Adapter-1188075760p.htm стар AC/DC адаптер] и какво намирам: устройството си работи перфектно. +Та по-късно през деня седнах с един {url стар AC/DC адаптер;https://www.globalsources.com/AC-DC-adapter/plug-in-AC-DC-Adapter-1188075760p.htm} и какво намирам: устройството си работи перфектно. -[image ./img/switch-on.JPG "Разбира се, тествах и самите портове дали пускат данни"] +{img "Разбира се, тествах и самите портове дали пускат данни";./img/switch-on.JPG} Отдолу си има етикет на който пише, че приема 12V на 0.5A, единствено не пише дали центърът е положителен или отрицателен. След малко бърникане с мултицедът, лесно се вижда че първото е вярно. -[image ./img/switch-back.JPG "Хартиеното тиксо с полярността е моя добавка"] +{img "Хартиеното тиксо с полярността е моя добавка";./img/switch-back.JPG} -Благодарение на етикетът, бързо се намира и оригиналната [url https://networkpartner.eu/product/8-port-gb-switch/ уебстраница на която NetworkPartner са го продавали]. +Благодарение на етикетът, бързо се намира и оригиналната {url уебстраница на която NetworkPartner са го продавали;https://networkpartner.eu/product/8-port-gb-switch/}. Единственият въпрос който остава, е какво е накарало интернетът да спре втория път? -Оригиналната инсталация идва от М-Тел, и техния [*талант*] е решил да остави суичът да си виси във въздуха, държан само от кабелите, които се свързват към него, включително кабела за захранване. +Оригиналната инсталация идва от М-Тел, и техния {i талант} е решил да остави суичът да си виси във въздуха, държан само от кабелите, които се свързват към него, включително кабела за захранване. Моето предположение е, че захранването просто се е изплъзнало с малко от буксата докато са го оглеждали. diff --git a/src/blog/taming-the-fun-too/index.du b/src/blog/taming-the-fun-too/index.du index 07e7b63..018f6ae 100644 --- a/src/blog/taming-the-fun-too/index.du +++ b/src/blog/taming-the-fun-too/index.du @@ -1,55 +1,51 @@ -# Taming the Fun-too +'def title Taming the Fun-too +'def desc Stories of my troubles (and eventual triumph) with Funtoo -'define expected-reading 7 min -'define created 04 December 2022 -'define edited 04 December 2022 -[$pagenav] +# {title} -Let's set the scene: it's October of last year and I just began my first year as a university student. For the first time in my life, I was able to meet people who were significantly [~nerdier~] cooler than me. -One particular dude I met introduced me to [url https://funtoo.org Funtoo], a boutique fork of [url https://gentoo.org Gentoo]. +{pagenav 7 min;04 December 2022;04 December 2022} + +Let's set the scene: it's October of last year and I just began my first year as a university student. For the first time in my life, I was able to meet people who were significantly {s nerdier} cooler than me. +One particular dude I met introduced me to {url Funtoo;https://funtoo.org}, a boutique fork of {url Gentoo;https://gentoo.org}. Now, I'm not a very big fan of distro hopping, it takes too much time and you often find yourself not liking the finished product, resulting in further distro hopping. -However, at that time I was a bit softened by my growing pains with Fedora, the sweat promises of improved efficiency and usability, and the fact that fun is in the name! [*What could go wrong*] :) +However, at that time I was a bit softened by my growing pains with Fedora, the sweat promises of improved efficiency and usability, and the fact that fun is in the name! {i What could go wrong} :) -So, about a month later I bit the bullet, and installed it on my main computer. It has now been a tad more than a year later and I can comfortably say: [*a lot could go wrong...*] +So, about a month later I bit the bullet, and installed it on my main computer. It has now been a tad more than a year later and I can comfortably say: {i a lot could go wrong...} -\n +<br/> In the same way that a distro is made to solve a certain problem, every distro introduces a fundamental flaw in it's design. Ubuntu solves the "it's too complicated" problem, but introduces issues with performance. Arch solves "my packages are too old and what I need isn't there" issue, but introduces "my packages are too new and something just broke". -'footnote ebuilds Files with instructions and settings for the package manager (portage) on how to build a specific package - -Then there's Funtoo. You might reason, since it's a fork of Gentoo, it's big flaw is the fact that you need to compile every package, with the prize being unparalleled efficiency. So did I, but as it turns out there is another, much larger flaw: [=packages=]. -The distribution is a lot smaller than it's big brother so a lot of stuff, understandably, cannot be tested. However, the real kicker is that package ebuilds[$ebuilds] are generated in a different way from Gentoo. +Then there's Funtoo. You might reason, since it's a fork of Gentoo, it's big flaw is the fact that you need to compile every package, with the prize being unparalleled efficiency. So did I, but as it turns out there is another, much larger flaw: {b packages}. +The distribution is a lot smaller than it's big brother so a lot of stuff, understandably, cannot be tested. However, the real kicker is that package ebuilds{fn Files with instructions and settings for the package manager (portage) on how to build a specific package} are generated in a different way from Gentoo. This often means that using a Gentoo ebuild will make the problem even worse, but sometimes it does work out. -\n +<br/> The first such problem child was QtWebEngine. As the name suggests, it gives the ability for graphical applications, made with the Qt framework, to render webpages. -I don't [*need*] it for my setup, but there are a couple of useful programs that required it. +I don't {i need} it for my setup, but there are a couple of useful programs that required it. -What would happen is, after about 3 hours of compiling, the compilation would just stop, without any errors, anywhere. To add insult to injury, because I hadn't set up [url https://ccache.dev/ ccache] at the time, everything would have to be compiled [*all over again*]. +What would happen is, after about 3 hours of compiling, the compilation would just stop, without any errors, anywhere. To add insult to injury, because I hadn't set up {url ccache;https://ccache.dev/} at the time, everything would have to be compiled {i all over again}. A fairly deep dive into different forums led me to the wondrous conclusion that I needed to remove a certain build flag, which wasn't enabled in the first place... -After [*much*] tweaking and trying, I found out there just wasn't enough memory, the package needed at least 32 GiB (including swap) of memory for a successful compilation... D'oh! -And here comes the really bad part: I had setup a swapfile of adequate size! However, as it turned out, in the configuration I tried loading it before loading the drive it was stored in... [=Double D'OH!!=] +After {i much} tweaking and trying, I found out there just wasn't enough memory, the package needed at least 32 GiB (including swap) of memory for a successful compilation... D'oh! +And here comes the really bad part: I had setup a swapfile of adequate size! However, as it turned out, in the configuration I tried loading it before loading the drive it was stored in... {b Double D'OH!!} -\n +<br/> Then came the big boss: python. Now, I wasn't planning on doing any software development with it, but as it turned out, other people had, so certain packages had building issues. And what was the exact issue you might ask? -Well, to put it simply, Funtoo had official ebuilds for python 3.7, but a lot of packages needed at least version 3.8. This time however, I had a [*brilliant*] idea: I would copy Gentoo's python 3.8 ebuilds! - -'footnote circular-dependency To build package A you'll need to have package B installed. But to build package B, you'll need package A installed. +Well, to put it simply, Funtoo had official ebuilds for python 3.7, but a lot of packages needed at least version 3.8. This time however, I had a {i brilliant} idea: I would copy Gentoo's python 3.8 ebuilds! What I didn't realize, was that I had unknowingly opened Pandora's box. -Over time I needed to install more and more python packages from Gentoo, until one day I created an [*unsolvable*] circular dependency[^circular-dependency]. -Usually there are solutions to such situations, but I kid you not, I had tried [=everything=] and [=nothing worked=]. +Over time I needed to install more and more python packages from Gentoo, until one day I created an {i unsolvable} circular dependency{fn To build package A you'll need to have package B installed. But to build package B, you'll need package A installed.}. +Usually there are solutions to such situations, but I kid you not, I had tried {b everything} and {b nothing worked}. This time, there isn't even a solution, I just made sure to never upgrade these packages again. Which proved problematic, since these packages were important and over time other stuff broke, but that wouldn't be relevant for long. -\n +<br/> Not too soon after, armageddon struck: glibc, GNU's C library. All I wanted to do was try out Ungoogled Chromium, but not as a flatpak. The only thing standing in the way was the requirement of "glibc 3.4.29", while all I had was 2.70.0. @@ -64,17 +60,17 @@ Aborting to save your system. "Umm what?" was my reaction too. For reasons not completely clear to me, this turns out to be yet another roadblock. Did I mention a couple applications also stopped working after the upgrade? Unfortunately my believes and ego were firmly set in stone, "Yeah, but I know what I'm doing, I'm downgrading from a non-Funtoo glibc, it will be fine!" -A sanity check override and a package downgrade later, [*it wasn't...*] +A sanity check override and a package downgrade later, {i it wasn't...} Yes, my system was broken. Very broken. So broken in fact, portage wasn't working, so un-downgrading was not an option. And, of course, booting successfully my machine up ever again wasn't an option either... -Thank goodness for [url https://github.com/linuxmint/timeshift Timeshift]'s system restore functionality or I would've had to rebuild my whole system. +Thank goodness for {url Timeshift;https://github.com/linuxmint/timeshift}'s system restore functionality or I would've had to rebuild my whole system. -\n +<br/> -There are [=a lot=] of other situations in which Funtoo's package difficulties and my sheer incompetence have led to wasted time and broken stuff, but these are the main ones that stand out in my mind (or more accurately, the ones that I still remember). Nowadays I use the distro in a much smarter fashion, with a much tighter grip. +There are {b a lot} of other situations in which Funtoo's package difficulties and my sheer incompetence have led to wasted time and broken stuff, but these are the main ones that stand out in my mind (or more accurately, the ones that I still remember). Nowadays I use the distro in a much smarter fashion, with a much tighter grip. -'footnote mask All ebuilds that are "masked", will not be used (therefore, corresponding package will not be compiled and installed/upgraded) - -Although I still need Gentoo packages, I install them from Funtoo's portage Gentoo kit.\n -Although I still have issues with packages not being able to be built, I just mask[$mask] them until I have adequate time/energy (or until someone fixes it).\n +Although I still need Gentoo packages, I install them from Funtoo's portage Gentoo kit.<br/> +Although I still have issues with packages not being able to be built, I just mask{fn All ebuilds that are "masked", will not be used (therefore, corresponding package will not be compiled and installed/upgraded)} them until I have adequate time/energy (or until someone fixes it).<br/> Although everything that has happened, for now, I'm still sticking with Funtoo. + +{footnotes} diff --git a/src/blog/the-physics-behind-a-black-hole-shader/index.du b/src/blog/the-physics-behind-a-black-hole-shader/index.du index 35c0450..fdb6589 100644 --- a/src/blog/the-physics-behind-a-black-hole-shader/index.du +++ b/src/blog/the-physics-behind-a-black-hole-shader/index.du @@ -1,27 +1,27 @@ -# The physics behind a black hole shader +'def title The physics behind a black hole shader +'def desc A deep dive into some of the physics (and mathematics) required for implementing a black hole shader -'define expected-reading 22 min -'define created 12 December 2023 -'define edited 06 October 2024 -[$pagenav] +# {title} + +{pagenav 22 min;12 December 2023;06 October 2024} :contents :numbered -1. [url #what-do-the-physics-say What do the physics say?] +1. {uhref What do the physics say?} .numbered - 1. [url #what-is-gravity What is gravity?] - 2. [url #what-does-it-mean-to-bend-space What does it mean to bend space?] - 3. [url #how-to-handle-the-EFEs How to handle the EFEs?] - 4. [url #what-is-a-black-hole What is a black hole?] - 5. [url #what-about-speed-and-time What about speed and time?] + 1. {uhref What is gravity?} + 2. {uhref What does it mean to bend space?} + 3. {uhref How to handle the EFEs?} + 4. {uhref What is a black hole?} + 5. {uhref What about speed and time?} -2. [url #finding-a-formula Finding a formula] -3. [url #applying-the-formula-to-bend-lights-path Applying the formula to “bend” light’s path] +2. {uhref Finding a formula} +3. {uhref Applying the formula to “bend” light’s path} .numbered - 1. [url #properties-of-a-black-hole Properties of a black hole] + 1. {uhref Properties of a black hole} -4. [url #light-bending-algorithm Light-bending algorithm] -5. [url #appendix Appendix] +4. {uhref Light-bending algorithm} +5. {uhref Appendix} @@ -30,9 +30,9 @@ I chose to create an interactive and animated black hole demo. The primary idea was to show how the gravitational pull of black holes "bends" light and how the result looks from different points of view. Then in the December of that same year, I sat down and started writing a blog post (as you may notice from the "Created" date), explaining how some of the more complicated parts were made. -Funnily enough, I started finding errors... a [*lot*] of errors. +Funnily enough, I started finding errors... a {i lot} of errors. -As it turned out, my implementation was completely wrong, but somehow I fudged the formulas around in just the right way to make it [*look*] correct. +As it turned out, my implementation was completely wrong, but somehow I fudged the formulas around in just the right way to make it {i look} correct. So the post got delayed and sparsely rejuvenated over the following months. For this reason I chose to take up two related electives this year: one on general relativity and one on ray tracing, with the hopes of gaining enough understanding of the material to rework the original solution into something proper. @@ -47,13 +47,13 @@ I'll assume you don't know much about physics, but are familiar with mathematics The "big words" version of what we're going to explore is: -'define EFE https://en.wikipedia.org/wiki/Einstein_field_equations +'def EFE https://en.wikipedia.org/wiki/Einstein_field_equations -Using [url [$EFE] Einstein's field equations], we can precisely calculate the curvatures in space(time) at every point around a black hole. -Obviously we're going to use [url https://en.wikipedia.org/wiki/Schwarzschild_metric Schwarzschild metric] on a (Schwarzschild) black hole. -To further simplify our calculations, we can make approximations using [url https://en.wikipedia.org/wiki/Celestial_mechanics celestial mechanics]. +Using {url Einstein's field equations;{EFE}}, we can precisely calculate the curvatures in space(time) at every point around a black hole. +Obviously we're going to use {url Schwarzschild metric;https://en.wikipedia.org/wiki/Schwarzschild_metric} on a (Schwarzschild) black hole. +To further simplify our calculations, we can make approximations using {url celestial mechanics;https://en.wikipedia.org/wiki/Celestial_mechanics}. -This is not [*necessary*] to understand, but it will make our goal [=much=] clearer. +This is not {i necessary} to understand, but it will make our goal {b much} clearer. Now, let's try and unravel everything. @@ -62,70 +62,62 @@ Now, let's try and unravel everything. Everything with mass applies a "pulling" force to everything else with mass. It's easy to see this is true, but we get into trouble when trying to find a formula which predicts/calculates that force. -Newton gave it a good shot, with his [url https://en.wikipedia.org/wiki/Newton%27s_laws_of_motion 3 laws of motion], which proved to be correct for about a century and a half. +Newton gave it a good shot, with his {url 3 laws of motion;https://en.wikipedia.org/wiki/Newton%27s_laws_of_motion}, which proved to be correct for about a century and a half. They even helped the discovery of Neptune, since measurements showed that the orbit of Uranus didn't meet expectations if there wasn't another planet meddling with things. -The real crux of the issue came when the same problem occurred with [url https://en.wikipedia.org/wiki/Mercury_%28planet%29#Advance_of_perihelion Mercury's orbit], but no new planet was found. +The real crux of the issue came when the same problem occurred with {url Mercury's orbit;https://en.wikipedia.org/wiki/Mercury_%28planet%29#Advance_of_perihelion}, but no new planet was found. -As it turned out, Newton's formulae had only been approximations, they worked when light (and therefore [url https://www.youtube.com/watch?v=msVuCEs8Ydo causality, or the speed at which changes propagate]) had infinite speed. +As it turned out, Newton's formulae had only been approximations, they worked when light (and therefore {url causality, or the speed at which changes propagate;https://www.youtube.com/watch?v=msVuCEs8Ydo}) had infinite speed. -Albert Einstein's general theory of relativity showed that gravity wasn't a "force which pulled", it was actually an effect which [=bent=] space. -And that only happened because the ([=constant=]) speed of light wasn't infinite. +Albert Einstein's general theory of relativity showed that gravity wasn't a "force which pulled", it was actually an effect which {b bent} space. +And that only happened because the ({b constant}) speed of light wasn't infinite. ### What does it mean to bend space? -'footnote line-definition This is the mathematical definition of a line, obviously in conversation we refer to a line segment as a line. But this distinction will be useful. - Think of a flat surface, like a table. What is the shortest distance between two points? Obviously, that's a straight line segment. -If you then extend that segment, so it has an infinite length, it becomes a line[$line-definition]. +If you then extend that segment, so it has an infinite length, it becomes a line{fn This is the mathematical definition of a line, obviously in conversation we refer to a line segment as a line. But this distinction will be useful.}. However, what if our surface isn't flat? Imagine two points on a sphere, what is the shortest distance between them? -Obviously, it's an arc of a circle and extending it to it's maximum possible length, we get a [url https://en.wikipedia.org/wiki/Great_circle great circle]. +Obviously, it's an arc of a circle and extending it to it's maximum possible length, we get a {url great circle;https://en.wikipedia.org/wiki/Great_circle}. -[image ./img/Illustration_of_great-circle_distance.svg.png]\n -[*Image by CheCheDaWaff on [url https://commons.wikimedia.org/w/index.php?curid=48187293 Wikipedia]*] +{img ./img/Illustration_of_great-circle_distance.svg.png}<br/> +{i Image by CheCheDaWaff on {url Wikipedia;https://commons.wikimedia.org/w/index.php?curid=48187293}} Now, what does it mean to go "forwards"? On a flat surface, we can define it as "following a (straight) line segment", on our sphere we can say "following an arc of a great circle". -'footnote geodesics-are-local This actually isn't completely true, a geodesic is the "locally shortest distance", I've skipped the details since they aren't really that important for our purposes. More info can be found on [url https://en.wikipedia.org/wiki/Geodesic#Introduction Wikipedia]. - -Better yet, in geometry there are [url https://en.wikipedia.org/wiki/Geodesic geodesics], the general term for a curve on any surface which is the shortest[$geodesics-are-local] path between any two points. +Better yet, in geometry there are {url geodesics;https://en.wikipedia.org/wiki/Geodesic}, the general term for a curve on any surface which is the shortest{fn This actually isn't completely true, a geodesic is the "locally shortest distance", I've skipped the details since they aren't really that important for our purposes. More info can be found on {url Wikipedia;https://en.wikipedia.org/wiki/Geodesic#Introduction}.} path between any two points. So now we can say "going forwards means going along a geodesic". -'footnote parallels-of-latitude You might think about the latitudinal lines on a globe, they are indeed parallel (equidistant), but if you take any two points on the same such line, the distance between them won't be the smallest. - It's important to note that an arbitrary geodesic doesn't have most properties you might be used to. -For example, on a flat surface, we can have parallel lines, but on our sphere, great circles will always intersect[$parallels-of-latitude]. +For example, on a flat surface, we can have parallel lines, but on our sphere, great circles will always intersect{fn You might think about the latitudinal lines on a globe, they are indeed parallel (equidistant), but if you take any two points on the same such line, the distance between them won't be the smallest.}. -This is what gravity does, it doesn't pull or push, it [*bends*], and more precisely, it [=bends geodesics=]. -Furthermore, we live in three spacial dimensions, so we can move in three [*different directions*]. +This is what gravity does, it doesn't pull or push, it {i bends}, and more precisely, it {b bends geodesics}. +Furthermore, we live in three spacial dimensions, so we can move in three {i different directions}. The resultant effect is that if you travel perfectly forwards in a spaceship and pass by an object with mass (like a planet) from a close enough distance, your path will be curved, without you steering your ship. -Although not yet mentioned, you need to know that [=photons=] (light) [=don't have mass=]! +Although not yet mentioned, you need to know that {b photons} (light) {b don't have mass}! In effect, in a universe where there is only light bouncing around, Newton's equations still work. -On that note, the point that light [=doesn't=] travel at an infinite speed is significant. +On that note, the point that light {b doesn't} travel at an infinite speed is significant. When the opposite is true, General Theory of Relativity collapses into the Newtonian equations! -Going back on track, Einstein gives us the necessary equations for those geodesics, the [url [$EFE] Einstein Field Equations]. +Going back on track, Einstein gives us the necessary equations for those geodesics, the {url Einstein Field Equations;{EFE}}. ### How to handle the EFEs? Although they're called equations the result/output we get from solving them isn't a number! -It's a function, which [*more or less*] takes the parameters of objects in the universe and returns [*how*] they will all behave. -To be more precise, the output isn't [*really*] a function, it's a "metric", which is a distinctly different mathematical object. - -'footnote schwm-assumptions He also assumed the body didn't have an electric charge and the [url https://en.wikipedia.org/wiki/Cosmological_constant cosmological constant] is zero. +It's a function, which {i more or less} takes the parameters of objects in the universe and returns {i how} they will all behave. +To be more precise, the output isn't {i really} a function, it's a "metric", which is a distinctly different mathematical object. -In the 1910s Schwarzschild solved the equations for a universe where there is only one non-rotating[$schwm-assumptions] particle with mass, then in the 1960s the equations were solved when that particle could rotate, that's it. +In the 1910s Schwarzschild solved the equations for a universe where there is only one non-rotating{fn He also assumed the body didn't have an electric charge and the {url cosmological constant;https://en.wikipedia.org/wiki/Cosmological_constant} is zero.} particle with mass, then in the 1960s the equations were solved when that particle could rotate, that's it. There are plenty of other mathematical solutions, but we have been able to relate the "real" world to only those two. This may sound unsatisfactory, but in practice, it's quite enough. -In the solar system, [url https://en.wikipedia.org/wiki/Solar_System >99.86% of mass is in the Sun], so assuming all other objects are massless, we get enough precision to explain Mercury's orbit. +In the solar system, {url >99.86% of mass is in the Sun;https://en.wikipedia.org/wiki/Solar_System}, so assuming all other objects are massless, we get enough precision to explain Mercury's orbit. We can apply the same idea to our simulation, leaving all objects which aren't our black hole without mass. Schwarzschild's metric and accompanying black hole properties are the simplest possible solution, so we'll use that. @@ -134,8 +126,8 @@ Schwarzschild's metric and accompanying black hole properties are the simplest p Let's imagine atoms as a set of glass marbles, scattered on a table: -[image https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Marbles_from_Indonesia.jpg/1280px-Marbles_from_Indonesia.jpg]\n -[*Image from By Okkisafire on [url https://commons.wikimedia.org/w/index.php?curid=30338734 Wikipedia]*] +{img https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Marbles_from_Indonesia.jpg/1280px-Marbles_from_Indonesia.jpg}<br/> +{i Image from By Okkisafire on {url Wikipedia;https://commons.wikimedia.org/w/index.php?curid=30338734}} Now, start pushing from all sides of the table to it's center. In the beginning, you'll mostly roll them, until they all get in contact with each other. @@ -145,37 +137,35 @@ By increasing the force with which you push on them, after a certain threshold, Those shards will still have some fight in them, so after increasing your force by another level, you'll turn all of those shards into tiny glass granules. A similar occurrence happens with atoms. -Normally atoms are spread apart, by pushing them together, at a certain point (ignoring the orbiting electrons) all nuclei will be "touching" and the [url https://en.wikipedia.org/wiki/Nuclear_force nuclear force] will keep them together. +Normally atoms are spread apart, by pushing them together, at a certain point (ignoring the orbiting electrons) all nuclei will be "touching" and the {url nuclear force;https://en.wikipedia.org/wiki/Nuclear_force} will keep them together. By further increasing your pushing force you can overwhelm the nuclear force and "shatter" the nuclei into their subatomic particles. -'footnote matter-together Technically, it's more accurate to say "matter apart", since after the collapse matter is as close together as physically possible, and the nuclear forces keep everything in order but also separated. However, considering the intuitive approach I'm striving for, "matter together" is simpler to understand. - -Assuming an enormous explosion doesn't happen, and you can keep increasing your force, it's also possible to overwhelm the "subatomic forces" that keep those subatomic particles "together"[$matter-together]. -However, those subatomic particles are more commonly referred to as [url https://en.wikipedia.org/wiki/Elementary_particle elementary particles], meaning there are no "granules" into which the elementary particles can break down. +Assuming an enormous explosion doesn't happen, and you can keep increasing your force, it's also possible to overwhelm the "subatomic forces" that keep those subatomic particles "together"{fn Technically, it's more accurate to say "matter apart", since after the collapse matter is as close together as physically possible, and the nuclear forces keep everything in order but also separated. However, considering the intuitive approach I'm striving for, "matter together" is simpler to understand.}. +However, those subatomic particles are more commonly referred to as {url elementary particles;https://en.wikipedia.org/wiki/Elementary_particle}, meaning there are no "granules" into which the elementary particles can break down. It's not possible for those particle to be completely unbreakable, since that would mean they could theoretically sustain infinite amounts of force. Such an assumption is unthinkable. Then that leaves us with only one solution: laws of matter "break". If nothing can keep the elementary particles "together", so keep matter "together", then the result is a sort of "collapse", all of that matter just "deflates" into a single, infinitely small point (but the amount of mass isn't infinite, it's the sum of mass from the particles that collapsed). -That point is called a [=black hole=]. +That point is called a {b black hole}. This object is very bizarre, generally it doesn't have too much properties, but the ones it has are really unique. In our case, the only important part is it's effect on gravity, and more precisely, light. -Since a black hole is a single infinitely small point, then all of it's mass is concentrated on that point, making it alter the geodesics in a relatively small area of space [=a lot=]. +Since a black hole is a single infinitely small point, then all of it's mass is concentrated on that point, making it alter the geodesics in a relatively small area of space {b a lot}. So much so, if you get too close, you will not be able to overwhelm gravity and "merge" into that infinitesimal point: -[image https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/CNX_UPhysics_13_07_spacetime.png/800px-CNX_UPhysics_13_07_spacetime.png?20171124170318]\n -[*The white lines are our geodesics*]\n -[*Image by OpenStax University Physics on [url https://commons.wikimedia.org/w/index.php?curid=64307901 Wikipedia]*] +{img https://upload.wikimedia.org/wikipedia/commons/9/91/CNX_UPhysics_13_07_spacetime.png?utm_source=commons.wikimedia.org&utm_campaign=index&utm_content=original}<br/> +{i The white lines are our geodesics}<br/> +{i Image by OpenStax University Physics on {url Wikipedia;https://commons.wikimedia.org/w/index.php?curid=64307901}} A fascinating realization is that light always travels along geodesics ("forwards"), therefore this extreme bending allows us to view otherwise obstructed objects. -We call that effect [url https://en.wikipedia.org/wiki/Gravitational_lens gravitational lensing]. +We call that effect {url gravitational lensing;https://en.wikipedia.org/wiki/Gravitational_lens}. Though not unique to black holes, that's when the effect is strongest: -[image https://upload.wikimedia.org/wikipedia/commons/0/02/Gravitational_lens-full.jpg]\n -[*Notice how the gray arrows show the path light travels from a galaxy that is behind (obstructed by) the black hole*] +{img https://upload.wikimedia.org/wikipedia/commons/0/02/Gravitational_lens-full.jpg}<br/> +{i Notice how the gray arrows show the path light travels from a galaxy that is behind (obstructed by) the black hole} I'll abstain from explaining the specifics of light, but you may think of it as a small particle, "similar" to an electron, travelling through space. In fact, Newton understood light to be just that, and called the underlying particle a "corpuscle". @@ -187,29 +177,29 @@ Two of the most significant things Einstein's theory shows, which I've left out Which also signifies that our geodesics are actually four dimensional, or in other words, gravity also bends the observed passage of time! This is relevant for light, since it's speed is constant and it always travels along a geodesic, but to an outside observer it doesn't look that way. -However, in our simulation, we [=only=] care about how thing look, so it will make our live much simpler if we try to ignore reality wherever we can. +However, in our simulation, we {b only} care about how thing look, so it will make our live much simpler if we try to ignore reality wherever we can. Therefore, to calculate by how much light will move and change, we'll start with the EFEs and then simplify and approximate until we get something useable. ## Finding a formula -Let's get down to business, our starting point, the [url https://en.wikipedia.org/wiki/Schwarzschild_metric Schwarzschild metric], in Schwarzschild coordinates, looks like this: +Let's get down to business, our starting point, the {url Schwarzschild metric;https://en.wikipedia.org/wiki/Schwarzschild_metric}, in Schwarzschild coordinates, looks like this: -[image ./img/Schwarzschild-metric-in-Schwarzschild-coordinates-wikipedia.png] +{img ./img/Schwarzschild-metric-in-Schwarzschild-coordinates-wikipedia.png} -[=YOUCH!=] +{b YOUCH!} -The variables themselves aren't that bad: [`c`] is the speed of light, <code>τ</code> is time, <code>Ω</code>, [`t`] and [`r`] are Schwarzschild coordinates. +The variables themselves aren't that bad: {` c} is the speed of light, <code>τ</code> is time, <code>Ω</code>, {` t} and {` r} are Schwarzschild coordinates. -However, as you can see, there are two big problems: we have to calculate derivatives (that's what the [`d`] signifies) and convert from Schwarzschild coordinates to normal (euclidean) coordinates, that the computer understands "natively". -This would be [=too slow=] to render in real time. +However, as you can see, there are two big problems: we have to calculate derivatives (that's what the {` d} signifies) and convert from Schwarzschild coordinates to normal (euclidean) coordinates, that the computer understands "natively". +This would be {b too slow} to render in real time. -Thankfully [url https://github.com/rantonels Riccardo Antonelli] was able to do all of our coordinate conversions and use Newton's ideas to simplify the living crap out of that monster, turning it into something digestible: +Thankfully {url Riccardo Antonelli;https://github.com/rantonels} was able to do all of our coordinate conversions and use Newton's ideas to simplify the living crap out of that monster, turning it into something digestible: -[image ./img/riccardo-antonelli-schwarzschild-black-hole-force-field-formula.png] +{img ./img/riccardo-antonelli-schwarzschild-black-hole-force-field-formula.png} Explaining his steps and the formula is way beyond the scope of my understanding and this post. -He explains it in more mathematical detail [url http://spiro.fisica.unipd.it/~antonell/schwarzschild/ here]. +He explains it in more mathematical detail {url here;http://spiro.fisica.unipd.it/~antonell/schwarzschild/}. But now, finally, we can get a plan for our simulation: @@ -219,7 +209,7 @@ But now, finally, we can get a plan for our simulation: - rinse and repeat until the light hits something Question now is: what do all of those letters represent? -This turned out to be a much harder problem than it should have, I actually had to refer [url https://github.com/rantonels/starless/blob/7a0c3c4efdc0666f53dcfa48d310fb2164be2d1a/tracer.py Ricardo Antonelli's] and [url https://dmitrybrant.com/2018/12/11/ray-tracing-black-holes Dmitry Brant's] implementation in their projects, alongside copious articles on Wikipedia to fully grasp how to put it to work. +This turned out to be a much harder problem than it should have, I actually had to refer {url Ricardo Antonelli's;https://github.com/rantonels/starless/blob/7a0c3c4efdc0666f53dcfa48d310fb2164be2d1a/tracer.py} and {url Dmitry Brant's;https://dmitrybrant.com/2018/12/11/ray-tracing-black-holes} implementation in their projects, alongside copious articles on Wikipedia to fully grasp how to put it to work. ## Applying the formula to "bend" light's path @@ -227,20 +217,20 @@ The direction, alongside the amount by which the particle moves, can be represen Referring to the formula again: -[image ./img/riccardo-antonelli-schwarzschild-black-hole-force-field-formula.png] +{img ./img/riccardo-antonelli-schwarzschild-black-hole-force-field-formula.png} -[`F[^→^]`] returns a force vector ([`F`] for "force" and [`[^→^]`] for "vector"): any force acting on an object has a strength (magnitude) and a direction. +{` F{^ &rarr\;}} returns a force vector ({` F} for "force" and {` {^ &rarr\;}} for "vector"): any force acting on an object has a strength (magnitude) and a direction. Imagine you are pushing a box: you are applying some force to it in a "forward" direction. If you pull the box, you'll apply some force in a "backward" direction. This force vector conveys how much and in what direction exactly the black hole is "pulling" on the corpuscle. -Although the function takes in only one argument, [`r`], that doesn't mean that [`h`] or [`r[^^^]`] aren't also arguments: +Although the function takes in only one argument, {` r}, that doesn't mean that {` h} or {` r{^ ^}} aren't also arguments: :unordered -- [`r`] is the distance from the center of the black hole (the singularity) to the [=current=] position of the corpuscle. +- {` r} is the distance from the center of the black hole (the singularity) to the {b current} position of the corpuscle. -- [`h`] is the magnitude of the [url https://en.wikipedia.org/wiki/Specific_angular_momentum "specific angular momentum"] of the light "particle". +- {` h} is the magnitude of the {url "specific angular momentum";https://en.wikipedia.org/wiki/Specific_angular_momentum} of the light "particle". .p "Normal" linear momentum specifies how much "force" at what speed it takes to stop (or change) the speed and direction of an object in linear motion (that's why it's in kg\*m/s). @@ -248,14 +238,12 @@ Although the function takes in only one argument, [`r`], that doesn't mean that How do you forcefully stop it? .p - You can put a [*really*] heavy barrier on the tracks, in front of the train. + You can put a {i really} heavy barrier on the tracks, in front of the train. Since the train is moving at a really great speed, this barrier will have to be much much heavier (with much more mass) than the train itself. - 'footnote hitting-trains Of course, I'm assuming the trains are strong enough they won't break upon the collision. - .p Alternatively, you can "launch" something against the train, meaning you can put a second train, moving in the opposite direction of the first train, so they hit head-on. - Since the second train would also be moving, if it's travelling at the same speed and has the same mass as the first train, upon collision they would both stop[$hitting-trains]. + Since the second train would also be moving, if it's travelling at the same speed and has the same mass as the first train, upon collision they would both stop{fn Of course, I'm assuming the trains are strong enough they won't break upon the collision.}. If the second travels at twice the speed, then it can have half of the mass of the first to produce the same effect. .p @@ -268,41 +256,38 @@ Although the function takes in only one argument, [`r`], that doesn't mean that .p The specific angular momentum is the angular momentum of an object, divided by it's mass. It's magnitude kind of tells us which property is more prevalent in the momentum, the mass or the speed. - For the same angular momentum, a long (big magnitude) [*specific*] angular momentum means our object is small and moves fast, while for a short (small magnitude) [*specific*] angular momentum out object is large and moves slowly. - - 'footnote angular-momentum Angular momentum is actually [url https://en.wikipedia.org/wiki/Specific_angular_momentum#Definition defined using the cross product] - 'footnote light-has-no-mass As mentioned, light has no mass, so this version of the formula wouldn't work. + For the same angular momentum, a long (big magnitude) {i specific} angular momentum means our object is small and moves fast, while for a short (small magnitude) {i specific} angular momentum out object is large and moves slowly. .p - Another simplification we need to is [=make our black hole stationary=]! - Then, rather than finding the angular momentum[$angular-momentum] and dividing by the mass[$light-has-no-mass], we'll use another formula: + Another simplification we need to is {b make our black hole stationary}! + Then, rather than finding the angular momentum{fn Angular momentum is actually {url defined using the cross product;https://en.wikipedia.org/wiki/Specific_angular_momentum#Definition}} and dividing by the mass{fn As mentioned, light has no mass, so this version of the formula wouldn't work.}, we'll use another formula: - .p [image ./img/specific-angular-momentum-wikipedia.png] + .p {img ./img/specific-angular-momentum-wikipedia.png} .p - where [=in this specific formula only=] [`r`] is the vector from the singularity to the corpuscle and [`v`] is light's velocity. + where {b in this specific formula only} {` r} is the vector from the singularity to the corpuscle and {` v} is light's velocity. .p The cross product returns a vector, so we'll need to take the magnitude of the result and plug that into the formula. - It's also important that [=we calculate it only once, in the beginning=]. + It's also important that {b we calculate it only once, in the beginning}. So, we shouldn't be calculating the magnitude of the specific angular momentum every time the light "particle" is moved, rather we calculate it once, after it gets close enough to be affected by the black hole. .p You might think that makes no sense, since we cannot divide by zero, so the specific angular momentum shouldn't exist, but then with the cross product we find a value for it. You would be correct: Antonelli does some funky approximations, combining Newtonian physics with General theory of relativity, to make the formula that simple. -- [`r[^^^]`] is the normalized ([url https://en.wikipedia.org/wiki/Unit_vector unit], hence the [`^`] on top) vector from the center of the black hole to the light particle: +- {` r{^ ^}} is the normalized ({url unit;https://en.wikipedia.org/wiki/Unit_vector}, hence the {` ^} on top) vector from the center of the black hole to the light particle: - .p [image ./img/normalize-vector-wikipedia.png] + .p {img ./img/normalize-vector-wikipedia.png} Finally, putting all needed variables together in one proper function, we get: -[image ./img/variables-expanded.png Refer to "Antonelli’s formula - explained" in the Appendix] +{img Refer to "Antonelli’s formula - explained" in the Appendix;./img/variables-expanded.png} -As you may notice, this can be simplified, if we substitute [`r[^^^]`]: +As you may notice, this can be simplified, if we substitute {` r{^ ^}}: -[image ./img/antonelli-formula-expanded.png Refer to "Antonelli’s formula - simplified" in the Appendix] +{img Refer to "Antonelli’s formula - simplified" in the Appendix;./img/antonelli-formula-expanded.png} In effect, we pass the distance from the black hole to the corpuscle and the function returns how light's velocity changes. @@ -312,39 +297,35 @@ For that we'll need to get even more familiar with black holes. ### Properties of a black hole -'footnote no-hair-theorem The [url https://en.wikipedia.org/wiki/No-hair_theorem no-hair theorem] states that stationary black holes are characterized by only their mass, angular momentum and electric charge. By definition of a Schwarzschild black hole, the last two are null. - To summarize, we're working with a stationary Schwarzschild black hole. -Meaning our black hole has only one property: mass[$no-hair-theorem]. +Meaning our black hole has only one property: mass{fn The {url no-hair theorem;https://en.wikipedia.org/wiki/No-hair_theorem} states that stationary black holes are characterized by only their mass, angular momentum and electric charge. By definition of a Schwarzschild black hole, the last two are null.}. Everything else can be derived from it. -There are three radii, which will be the backbone of our black hole: the event horizon, the photon sphere and [url https://en.wikipedia.org/wiki/Innermost_stable_circular_orbit ISCO]. +There are three radii, which will be the backbone of our black hole: the event horizon, the photon sphere and {url ISCO;https://en.wikipedia.org/wiki/Innermost_stable_circular_orbit}. The event horizon, also called the Schwarzschild radius, is the distance from the singularity, which once passed, nothing can return and escape. The formula for it is: -[image ./img/Schwarzschild-radius-wikipedia.png r_s = (2GM)/(c^2)] +{img r_s = (2GM)/(c^2);./img/Schwarzschild-radius-wikipedia.png} -where [`G`] is the [url https://en.wikipedia.org/wiki/Gravitational_constant gravitational constant] and [`M`] is the mass of the black hole (in kg). +where {` G} is the {url gravitational constant;https://en.wikipedia.org/wiki/Gravitational_constant} and {` M} is the mass of the black hole (in kg). The photon sphere is the distance from the singularity, in which photons start orbiting the black hole (and can either escape or pass the event horizon). Formula: -[image ./img/photon-sphere-wikipedia.png r = r_s * 3/2] +{img r = r_s * 3/2;./img/photon-sphere-wikipedia.png} -where [`G`] and [`M`] are the same as before, [`c`] is the speed of light in vacuum and [`r[^s^]`] is the aforementioned Schwarzschild radius. - -'footnote isco It's not really true that gravity stopps affecting spacetime after the ISCO, even though things can orbit Earth that doesn't mean that Earth doesn't bend spacetime. However, for the purposes of a simple shader, this assumption produces perfectly useable results. +where {` G} and {` M} are the same as before, {` c} is the speed of light in vacuum and {` r{^ s}} is the aforementioned Schwarzschild radius. Finally, the innermost stable circular orbit (ISCO), formally it's the distance, before which you can orbit the black hole, but once passed, you'll get sucked in and either get shot out or be forever lost past the event horizon. -For our purposes, it's fine to approximate it as the maximum radius after which space-time isn't bent[$isco] and objects aren't affected. +For our purposes, it's fine to approximate it as the maximum radius after which space-time isn't bent{fn It's not really true that gravity stopps affecting spacetime after the ISCO, even though things can orbit Earth that doesn't mean that Earth doesn't bend spacetime. However, for the purposes of a simple shader, this assumption produces perfectly useable results.} and objects aren't affected. Formula: -[image ./img/isco-wikipedia.png] +{img ./img/isco-wikipedia.png} Putting them all together, we should expect light to travel like this: -[image https://upload.wikimedia.org/wikipedia/commons/2/27/Black_Hole_Shadow.gif] -[*Animation by Hugo Spinelli on [url https://commons.wikimedia.org/w/index.php?curid=138168679 Wikipedia]*] +{img https://upload.wikimedia.org/wikipedia/commons/2/27/Black_Hole_Shadow.gif} +{i Animation by Hugo Spinelli on {url Wikipedia;https://commons.wikimedia.org/w/index.php?curid=138168679}} ## Light-bending algorithm @@ -366,13 +347,13 @@ The simplest way to "track" this is just to limit how many times we can move the An algorithm doing this would look a bit like this (in pseudocode, inspired by Python): -[image ./img/algorithm.png Refer to "Algorithm" section of the Appendix] +{img Refer to "Algorithm" section of the Appendix;./img/algorithm.png} -as a reminder, here is the definition of [`F[^→^]`]: +as a reminder, here is the definition of {` F{^ →}}: -[image ./img/antonelli-formula-expanded.png] +{img ./img/antonelli-formula-expanded.png} -\n +<br/> That's it! We have all of our theoretical background, formulae and algorithm to start work on our actual program. @@ -383,19 +364,21 @@ To Be Continued! ### LaTeX source for equations -The images for my custom LaTeX equations were created on [url https://latexeditor.lagrida.com/ latexeditor.lagrida.com], by using Firefox's built-in ability to screenshot HTML nodes, in particular the [url https://www.mathjax.org/ MathJax] node with the equation. +The images for my custom LaTeX equations were created on {url latexeditor.lagrida.com;https://latexeditor.lagrida.com/}, by using Firefox's built-in ability to screenshot HTML nodes, in particular the {url MathJax;https://www.mathjax.org/} node with the equation. #### Antonelli's formula - explained -```latex -'include ./antonelli_formula.tex +```tex +'snippet 1 $ ./antonelli_formula.tex #### Antonelli's formula - simplified -```latex -'include ./antonelli_formula_simplified.tex +```tex +'snippet 1 $ ./antonelli_formula_simplified.tex #### Algorithm -```latex -'include ./algorithm.tex +```tex +'snippet 1 $ ./algorithm.tex + +{footnotes} diff --git a/src/blog/thinkpad-x270-my-favorite-machine/index.du b/src/blog/thinkpad-x270-my-favorite-machine/index.du index f52d54d..6aad001 100644 --- a/src/blog/thinkpad-x270-my-favorite-machine/index.du +++ b/src/blog/thinkpad-x270-my-favorite-machine/index.du @@ -1,41 +1,41 @@ -# ThinkPad X270 - my favorite machine +'def title ThinkPad X270 - my favorite machine +'def desc Review of the laptop -'define expected-reading 17 min -'define created 30 August 2023 -'define edited 30 August 2023 -[$pagenav] +# {title} + +{pagenav 17 min;30 August 2023;30 August 2023} :contents :numbered -1. [url #context Context] -2. [url #what-i-think What I Think] +1. {uhref Context} +2. {uhref What I Think} .numbered - 1. [url #display Display] - 2. [url #cpu-and-ram CPU and RAM] - 3. [url #hardware-support-and-chassis Hardware support and chassis] - 4. [url #ports Ports] - 5. [url #batteries Batteries] - 6. [url #keyboard-and-power-button Keyboard and power button] - 7. [url #trackpoint-and-mouse-pad Trackpoint and mouse pad] - 8. [url #repairability Repairability] - 9. [url #cooling Cooling] - 10. [url #pricing Pricing] + 1. {uhref Display} + 2. {uhref CPU and RAM} + 3. {uhref Hardware support and chassis} + 4. {uhref Ports} + 5. {uhref Batteries} + 6. {uhref Keyboard and power button} + 7. {uhref Trackpoint and mouse pad} + 8. {uhref Repairability} + 9. {uhref Cooling} + 9. {uhref Pricing} -3. [url #conclusion Conclusion] +3. {uhref Conclusion} ThinkPad laptops are generally well liked, a lot of people I know use them and every one that I've touched has been a pleasure to work with. -Suffice to say, I've wanted to get one for quite a while now, so back in the middle of May I bit the bullet and spontaneously bought a second hand [url https://www.thinkwiki.org/wiki/X270_Detailed_Hardware_Information Thinkpad X270]. +Suffice to say, I've wanted to get one for quite a while now, so back in the middle of May I bit the bullet and spontaneously bought a second hand {url Thinkpad X270;https://www.thinkwiki.org/wiki/X270_Detailed_Hardware_Information}. I've used it for the past 3 months, and in all honesty, it's not without it's drawback, but the X270 has easily become my favorite computer. -[*Note: this whole review was written on the aforementioned Thinkpad X270, without external devices (like keyboard or monitor) attached.*] +{i Note: this whole review was written on the aforementioned Thinkpad X270, without external devices (like keyboard or monitor) attached.} ## Context -My main computer is a pre built (without only major upgrades) desktop tower with an [url https://www.intel.com/content/www/us/en/products/sku/77488/intel-core-i34160-processor-3m-cache-3-60-ghz/specifications.html i3-4160], scoring [url https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i3-4160+%40+3.60GHz&id=2317 3510 on CPU mark], paired with 16 gigs (for the past 9 months, otherwise I had 8 GB) of 1600 MHz memory, and a 1080p IPS monitor. -I also own a laptop, the [url https://www.lenovo.com/gb/en/p/laptops/yoga/yoga-slim-series/yoga-s730/88ygs701077 Lenovo Yoga S730] with an [url https://ark.intel.com/content/www/us/en/ark/products/149091/intel-core-i78565u-processor-8m-cache-up-to-4-60-ghz.html i7-8565U], scoring [url https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i7-8565U+%40+1.80GHz&id=3308 6152], 16 GB of 2133 MHz RAM and 1080p IPS monitor. +My main computer is a pre built (without only major upgrades) desktop tower with an {url i3-4160;https://www.intel.com/content/www/us/en/products/sku/77488/intel-core-i34160-processor-3m-cache-3-60-ghz/specifications.html}, scoring {url 3510 on CPU mark;https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i3-4160+%40+3.60GHz&id=2317}, paired with 16 gigs (for the past 9 months, otherwise I had 8 GB) of 1600 MHz memory, and a 1080p IPS monitor. +I also own a laptop, the {url Lenovo Yoga S730;https://www.lenovo.com/gb/en/p/laptops/yoga/yoga-slim-series/yoga-s730/88ygs701077} with an {url i7-8565U;https://ark.intel.com/content/www/us/en/ark/products/149091/intel-core-i78565u-processor-8m-cache-up-to-4-60-ghz.html}, scoring {url 6152;https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i7-8565U+%40+1.80GHz&id=3308}, 16 GB of 2133 MHz RAM and 1080p IPS monitor. Understanding my relationship with those machines is relevant to how I view the X270. I got the desktop tower in 2015, and even at the time, it's specs were in the middle range. @@ -44,21 +44,21 @@ Anyway, in all honesty, the only time when I wish for more power is in video gam Summarising, 99% of the time it's hardware is more than sufficient. The Yoga S730 was an "investment" into my future, since at the time I was going to programming lessons (which gave me a lot of the skills I have today) with my dad's laptop. -With this new machine I could go to the lectures and write code freely on a [=very=] fast (considering I was doing C# programming in Visual Studio on Windows 10, speed was always needed) and physically light machine, without being slowed down by the cheap, 4 years old, 16 inch behemoth. -From this point on, I was hooked on the 13 inch size, which as we all know is [url https://youtu.be/Za_Ul08dtj8?t=1208 the perfect size] and [url https://youtu.be/Q0h8wWlBxY0?t=1672 they should even make laptops that are any bigger]. +With this new machine I could go to the lectures and write code freely on a {b very} fast (considering I was doing C# programming in Visual Studio on Windows 10, speed was always needed) and physically light machine, without being slowed down by the cheap, 4 years old, 16 inch behemoth. +From this point on, I was hooked on the 13 inch size, which as we all know is {url the perfect size;https://youtu.be/Za_Ul08dtj8?t=1208} and {url they should even make laptops that are any bigger;https://youtu.be/Q0h8wWlBxY0?t=1672}. However, very quickly I found the ultrabook fashion of only including USB-C ports, very annoying to deal with, especially if you don't pay for an all-in-one dongle (which I didn't do for years). -Additionally, the screen had [*no*] anti-gloss coating, so most of the time I was looking at my own reflection, rather than the actual screen contents. +Additionally, the screen had {i no} anti-gloss coating, so most of the time I was looking at my own reflection, rather than the actual screen contents. Final thought, in the beginning battery life wasn't that much of a problem, but nowadays the battery barely holds for 3-4 hours, and I think a cell inside is failing. ## What I Think -My dream laptop was a "fat" Yoga S730 - 13 inches diagonally (an absolute [=MUST=]) with USB type A ports, a non-glossy display and better battery life. +My dream laptop was a "fat" Yoga S730 - 13 inches diagonally (an absolute {b MUST}) with USB type A ports, a non-glossy display and better battery life. Let's now consider the Thinkpad in question: .bulleted - 13 inches in size diagonally, -- [*two*] USB type A ports and more +- {i two} USB type A ports and more - display with an anti-gloss coating - both an external and internal battery (we'll talk about them later), allegedly being able to last 6-8 hours @@ -66,17 +66,18 @@ Absolutely perfect... well, almost. ### Display -By default, the laptop comes with a [=horrible=] 720p TFT display, with [=horrid=] color contrast, brightness and viewing angles. -Surprisingly enough, online there were 1080p IPS drop-in replacements, and they weren't too expensive: the [url https://www.amazon.de/dp/B07RZQ5LPW/ref=pe_27091401_487024491_TE_item one I got from amazon.de cost me 115 euro] (including the 25 euro international shipping). +By default, the laptop comes with a {b horrible} 720p TFT display, with {b horrid} color contrast, brightness and viewing angles. +Surprisingly enough, online there were 1080p IPS drop-in replacements, and they weren't too expensive: the {url one I got from amazon.de cost me 115 euro;https://www.amazon.de/dp/B07RZQ5LPW/ref=pe_27091401_487024491_TE_item} (including the 25 euro international shipping). The laptop itself did cost me ~170 euro, so the screen itself was 2/3 of the laptop price, but at 285 euro total, the deal was still a steal, at least considering where I live at. -[url https://www.youtube.com/watch?v=hzI3U3up5xY Replacing the display itself was dead easy]: pop-open the bezel, disconnect the old, reconnect the new, put the bezel back on, boom! +{url Replacing the display itself was dead easy;https://www.youtube.com/watch?v=hzI3U3up5xY}: pop-open the bezel, disconnect the old, reconnect the new, put the bezel back on, boom! The only negative is that, since it's 1080p, my battery life decreased by 30-60 minutes. Oddly enough though, if I set the refresh rate at 58.86 (or something else that's lower than 60.00, but this is the lowest I was able to go) the display seemed to use less power and I got that battery life back. Here are the exact Linux commands I used (make sure you don't have any external displays connected): ```bash +'emplace # find your display name, mine was eDP-1; I got this from StackExchange somewhere I think displayname="$(xrandr | grep connected | grep -v disconnected | cut -f 1 -d ' ')" # get the exact needed display parameters for 1920x1080 resolution at 58.90 hertz refresh rate @@ -87,24 +88,25 @@ modename=$(echo $displayparams | cut -f 1 -d ' ') xrandr --newmode $displayparams xrandr --addmode $displayname $modename xrandr --output $displayname --mode $modename +'endemplace From now on, my opinion will refer to the X270 with the upgraded display. ### CPU and RAM -The processor is underwhelming to say the least, my machine came with the [url https://www.intel.com/content/www/us/en/products/sku/88190/intel-core-i56300u-processor-3m-cache-up-to-3-00-ghz/specifications.html Intel Core i5-6300U], which has two cores at a base frequency of 2.50 GHz. -It's [url https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i5-6300U+%40+2.40GHz&id=2609 CPU Mark is about 3240], but if you were following, it scores a little bit worse than the [url https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i3-4160+%40+3.60GHz&id=2317 CPU on my desktop], so I'm used to it. +The processor is underwhelming to say the least, my machine came with the {url Intel Core i5-6300U;https://www.intel.com/content/www/us/en/products/sku/88190/intel-core-i56300u-processor-3m-cache-up-to-3-00-ghz/specifications.html}, which has two cores at a base frequency of 2.50 GHz. +It's {url CPU Mark is about 3240;https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i5-6300U+%40+2.40GHz&id=2609}, but if you were following, it scores a little bit worse than the {url CPU on my desktop;https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i3-4160+%40+3.60GHz&id=2317}, so I'm used to it. But I can understand that being a deal breaker for a lot of people. The RAM wasn't too bad actually, I got 16 GB of DDR4 memory at 2133 MHz. My desktop runs 16 GB of DDR3 memory at 1600 MHz, so in practice, even though the CPU is slightly slower, the overall machine always performs noticeably better than my desktop. I must mention, on some devices there seems to be an issue, where the RAM module would very slightly move in it's slot when the laptop is held in a certain way, which will cause the computer to freeze. -[url https://old.reddit.com/r/thinkpad/comments/jq53yt/freezing_x270x260x250_official_fix_a_bit_lmao/ The solution is to put something beneath it, as a standoff], but I haven't had to do this yet. +{url The solution is to put something beneath it, as a standoff;https://old.reddit.com/r/thinkpad/comments/jq53yt/freezing_x270x260x250_official_fix_a_bit_lmao/}, but I haven't had to do this yet. ### Hardware support and chassis -ThinkPad laptops generally have [url https://www.thinkwiki.org/wiki/Drivers Linux drivers for just about anything], you can freely control the different lights on the laptop or the precise fan speed. +ThinkPad laptops generally have {url Linux drivers for just about anything;https://www.thinkwiki.org/wiki/Drivers}, you can freely control the different lights on the laptop or the precise fan speed. Since this was my first machine in the line, I found this out after getting it, which is a huge advantage to be sure. Also, ThinkPad laptops are usually made with a thick high quality plastic and the X270 is no exception. @@ -122,7 +124,7 @@ But this is in no way a deal-breaker, and the connector is much beefier than nor ### Batteries -Something absolutely amazing is that the X270 comes with two, count them, [=TWO=] batteries - one internal and one (removable) external. +Something absolutely amazing is that the X270 comes with two, count them, {b TWO} batteries - one internal and one (removable) external. The last time I saw a removable battery was on the old family laptop from 2011, and this one has an additional internal one. Do I even need to explain why this is awesome? @@ -135,7 +137,7 @@ The trade-off is that the 52 Wh battery is much thicker, so it's not flush with ### Keyboard and power button -Speaking of the devil, unfortunately, the X270 doesn't have the fantastic old keyboards on older ThinkPad models (though, if you are determined, [url https://www.youtube.com/watch?v=Fzmm87oVQ6c you could probably put an old one in the laptop]). +Speaking of the devil, unfortunately, the X270 doesn't have the fantastic old keyboards on older ThinkPad models (though, if you are determined, {url you could probably put an old one in the laptop;https://www.youtube.com/watch?v=Fzmm87oVQ6c}). However, comparing to other laptop keyboards, I would say this one isn't too bad, it's not anything amazing, but it better than a good amount of others. Compared to the S730, it's has a much longer key travel and the keys generally feel a lot clicker. @@ -145,7 +147,7 @@ The X270 is much more normal, though the square brackets and pipe keys are half- The Fn key is to the left of the Ctrl key, but in the BIOS you can swap them around, so that's not a problem. My only issue is with the spacebar, because the actual switch isn't in the center of the key, but to the left of it, and I mostly press the spacebar with my right hand, so when I don't absolutely slam it, the key press could just barely not register. -The only reason I'm talking about the power button at all is that, baked in the firmware, to register a press you have to [url https://bbs.archlinux.org/viewtopic.php?pid=1193137#p1193137 hold it down for 1-3 seconds], at least when shutting down. +The only reason I'm talking about the power button at all is that, baked in the firmware, to register a press you have to {url hold it down for 1-3 seconds;https://bbs.archlinux.org/viewtopic.php?pid=1193137#p1193137}, at least when shutting down. This isn't a bug, it's a feature, and it has come quite in handy, I've had friends casually press the power button on my S730 and shut it off without me being able to react. ### Trackpoint and mouse pad @@ -183,30 +185,31 @@ My only issue is that the fan curve prioritizes silence a little too much on low It's by no means outrageous, the fan kicks in at a little bit above 45-50 degrees Celsius, which is fine, but when the CPU is close to or at those temperatures, the chassis starts getting a little warm. During the summer my left hand stars sweating a little bit more, which can be quite uncomfortable. -Of course, as already mentioned, we have drivers for everything, so I installed [url https://github.com/vmatare/thinkfan thinkfan]. +Of course, as already mentioned, we have drivers for everything, so I installed {url thinkfan;https://github.com/vmatare/thinkfan}. With it, I configured the fan to spin up on those lower temperatures and left the automatic configuration intact when we start getting warmer: -```yaml -'include ./thinkfan.yaml +'def LANG yaml +``` +'snippet 1 $ ./thinkfan.yaml This may shorten the fan lifespan, since it will be running more, but for me it's worth it. ### Pricing -As I already said, I got my X270 second hand from [url https://subincho.com/index.php subincho.com], with only a few cosmetic issues; it's practically brand new. +As I already said, I got my X270 second hand from {url subincho.com;https://subincho.com/index.php}, with only a few cosmetic issues; it's practically brand new. ThinkPads are quite often favorites for businesses, so now is the time when those 6 year old machines get thrown out on the second hand market. I'll work with the final price of 340 euro, which includes the monitor upgrade and 52 Wh external battery, since that's when the machine goes from good to fantastic. I live in Bulgaria, so depending on where you live, there might be better offers, but even with a doubled price, you won't find anything brand new that is as good. -Let's look at the listings in [url https://www.jarcomputers.com/ JAR computers], since I've found their pricing and availability to be quite normal for online shops (and the physical shops almost always offer fewer devices with a much higher price). +Let's look at the listings in {url JAR computers;https://www.jarcomputers.com/}, since I've found their pricing and availability to be quite normal for online shops (and the physical shops almost always offer fewer devices with a much higher price). So, 340 * 2 = 640 euro, or roughly 1300 Bulgarian Lev. -At the time of writing, [url https://www.jarcomputers.com/Laptopi_cat_2.html?ref=all&fprop[4413\][48266=\]48266&fprop[4413\][48256=\]48256&order=-1&&fprice[price-filter-other=\]p_from-1100-p_to-1600 searching for a ~13 inch laptop at around that price range] yields only two results: a [url https://www.jarcomputers.com/microsoft-surface-laptop-go-2-8qc-00024-prod-nbmicrosoft8qc00024.html Microsoft Surface Laptop Go 2] and [url https://www.jarcomputers.com/ms-surface-laptop-go-tnv-00009-prod-nbmicrosofttnv00009.html Microsoft Surface Laptop Go], both of which are on sale (with the second's original price being ~2300 lev, around ~1100 euro, three times the price). +At the time of writing, {url searching for a ~13 inch laptop at around that price range;https://www.jarcomputers.com/Laptopi_cat_2.html?ref=all&fprop[4413\][48266=\]48266&fprop[4413\][48256=\]48256&order=-1&&fprice[price-filter-other=\]p_from-1100-p_to-1600} yields only two results: a {url Microsoft Surface Laptop Go 2;https://www.jarcomputers.com/microsoft-surface-laptop-go-2-8qc-00024-prod-nbmicrosoft8qc00024.html} and {url Microsoft Surface Laptop Go;https://www.jarcomputers.com/ms-surface-laptop-go-tnv-00009-prod-nbmicrosofttnv00009.html}, both of which are on sale (with the second's original price being ~2300 lev, around ~1100 euro, three times the price). Both have soldered on RAM with no slots, so it cannot be upgraded, both have 1536x1024 displays with no anti-glare, that are glued to the screen bezel, both miss the Ethernet and HDMI ports, and since they aren't (older) ThinkPads, you won't get the TrackPoint or mouse buttons or Linux driver support or removable battery. -Of course, they have their own positives, the display is a touchscreen and they score [url https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i5-1035G1+%40+1.00GHz&id=3558 2.3] and [url https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i5-1135G7+%40+2.40GHz&id=3830 3.0] times higher on CPU mark respectively, but still, you get so much more with the ThinkPad for half the price. +Of course, they have their own positives, the display is a touchscreen and they score {url 2.3;https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i5-1035G1+%40+1.00GHz&id=3558} and {url 3.0;https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i5-1135G7+%40+2.40GHz&id=3830} times higher on CPU mark respectively, but still, you get so much more with the ThinkPad for half the price. Now, in all fairness, this is comparing a second hand laptop to a brand new one, for double the price you could get a lot more in a second hand machine. -Looking at the same place from which I bought my X270, they currently have [url https://subincho.com/laptopi?product_id=15309 a ThinkPad L13] for ~510 euro, which only misses out on the Ethernet port and external battery, but instead provides [url https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i7-10510U+%40+1.80GHz&id=3549 double the CPU mark]. +Looking at the same place from which I bought my X270, they currently have {url a ThinkPad L13;https://subincho.com/laptopi?product_id=15309} for ~510 euro, which only misses out on the Ethernet port and external battery, but instead provides {url double the CPU mark;https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i7-10510U+%40+1.80GHz&id=3549}. And that's only one site, if you look around enough you could probably find even better deals, but the 340 euro is still a really good deal. ## Conclusion diff --git a/src/blog/thoughts-on-minecraft-design/index.du b/src/blog/thoughts-on-minecraft-design/index.du new file mode 100644 index 0000000..74962cd --- /dev/null +++ b/src/blog/thoughts-on-minecraft-design/index.du @@ -0,0 +1,331 @@ +# Thoughts on Minecraft's design + +'define expected-reading ? min +'define created 03 May 2026 +'define edited 03 May 2026 +[$pagenav] + +It seems that in recent years, Mojang has become more and more out of touch with their flagship game and community. +Updates seem to introduce more and more change which nobody asked for, while long-standing issues are left unaddressed. + +But this does bring up the question: what makes Minecraft good? +In fact, what made it so good as to become the most sold game of all time? + +Well, I can't say I'm a reputable authority on this topic, in any sense or form. +However, I still believe I've been able to reach some part of the truthful answer. + +Let's talk. + +## What does Mojang think of Minecraft? + +Let's explore what Mojang has to say. +And what better place to that with the [url https://archive.org/details/minecraftgamedesign_202308/Jeb_ENG Minecraft Game Design book from Jens Bergensten] (Jeb), the lead designer of Minecraft since 2011. + +I do not want to disect every single word he has written, so we'll only talk about some of the more relevant design principles he outlines. + +### Bad things happen... + +Here Jeb argues that most accidents that happen are completely avoidable, and the few that aren't have low impact on player's work. +This sounds reasonable, and is how Minecraft has worked for most of its life. + +By properly lighting up areas you don't allow mobs to spawn and potentially kill you, blow your buildings up or kill your villagers. +By putting up walls and iron golems around your base or village you keep your villagers safe and sound. + +However, I would like to argue this is not where Minecraft shines. +I mean, which do you remember more fondly: +.ordered +1. The 30 minutes you spent spelunking in deep winding caves and ravines, mining ores, killing enemies, having to hide to replenish your health before lunging back in. + All the while you're getting farther away from the surface and with more and more valuable loot, making your escape more difficult, more costly and more risky. +2. The 30 hours you've spent in your base, walking around, looking at your builds, transfering items or mobs around. + +I would bet it's the first. +Because at the end of the day, what makes games fun is having a challenge, taking on risk and ultimately "winning". +But by making all accidents avoidable, you make most challenges trivial, since there is no winning if there is no losing. + +Of course, there are contra-arguments: having creepers spawn on your parkour is less challenging and much more frustrating. + +My point is that certain accidents should be avoidable in certain situations, but never all and those that are left should have impact, enough to drive up risk. + +### Items should be multi-purpose + +I completely agree with this point. + +However, in the second paragraph, he contradicts himself, giving the totem of undying as an example for that principle. +He argues that it is ok for the item to have a single use since it has sufficient gameplay impact?? + +Shouldn't the principle then be "Make items more impactful"? +To me at least, this feels closer to what Mojang does in reality. + +And nobody says an item can't be both impactful and have multiple uses. +For example, what if you could give the totem of undying to other mobs? +You wouldn't be able to get it back once given, but the mob will be able to survive twice the amount of damage, exceptionally impactful for villagers or the random chicken you've grown attached to. + +So, there are two different uses: either for protecting you or protecting another creature. +These totems are fairly hard to acquire, so it opens up a dillema on who needs it more, bringing a challenge which makes it more interesting and fun. + +The principle should be followed as often as possible. + +### You are not wearing a HUD + +Jeb argues that you should have items which present in-game information, like the map, compass and clock, instead of having something like the F3 debug screen, saying how he is personally an opponent to it. + +I feel this idea is out of touch. + +### Finding things is fun. Searching for them is not. + +Again, I completely agree with this point. + +But Jeb, for a second time, contradicts himself. +As examples he lists exploration maps in woodland mansions and bubble columns in under-water ruins. + +Meanwhile, woodland mansions are the epitomy of searching for hundreds and hundreds of blocks for the one biome they spawn in, and then searching for further hundreds and hundreds of blocks to find them. +He also talks about the under-water ruins like they are hidden... they are not... if you see the bubble column you'll see them, and it could be argued that the bubble column does more to obscure your vision... +And don't get me started on trial chambers and heavy cores. + +### Real-life animals should be friendly + +I do not understand this restriction, how real-life animals could at most defend themselves but to never be truly dangerous. + +Why? +What does this achieve? +There is nothing interesting in seeing a recogniseable creature which serves as a mostly defensless looting table. + +I would argue, the opposite is more interesting. +Make a majority of animals friendly, but then add some hostile animals. +They will serve as enemies during the day, adding some challenge outside of night. +Why wouldn't it be at least interesting if you had an animal, which is instinctively dangerious (like a bear or lion) or which is a surprise, catching you off-guard? + +I feel the polar bear should've been hostile and the shouldn't have removed the killer rabbit from spawning. +That would make game interactions more interesting. + +### Hostile mobs should be unique + +I also don't understand this restriction. + +Most older mobs aren't that unique: zombies, skeletons, witches, the ender dragon (which is a dragon in itself). +The creeper famously was created when Notch screwed up the proportions for pig models. + +Although entirely speculations on my end, I would further argue the green design came from the idea that the creeper should "blend" in the forest. +The zombie pigman also probably came from that: imagine putting the pig texture on a creeper. +That does kind of look like a person, so thats how he worked on the original pigman and from there the idea of a zombified pigman was fairly straight-forward. + +The more unique hostiles still have some sort of reasoning to them: the ender man is just a tall skinny player model, ghasts look kind of like a squid, breezes are effecitvely blaze rods with a head and slimes are just a big cube. + +I feel Jeb is not giving enough credit to how familiar and recognizeable the older mobs are. +For me, the more "unique" hostiles are less interesting: guardians, phantoms, shulkers. +And from the newer additions, I like the more "relateably" shaped: wardens are similar to golems, ravagers remind me of elephants, hoglins are just big fat hogs. + +### Human characters are human beings + +Yet another fairly strange decision. + +It could be argued non-player human beings should be rare, but excluding them entirely feels baseless. +I mean, one of the most iconic things in Minecraft is Herobrine. +Imagine if they added him as a very rare hostile mob which just stands there to haunt you. + +Or if they made "mimicks", mobs which look like friendly people but aren't. +A good amount of interesting mechanics and interactions just rejected. + +### Keep it vanilla + +Here the point is that the game should be expanded in all directions. + +This actually agrees with our earlier analysis, if Minecraft is a collection of mechanics, then you should expand on all mechanics in "equal" fasion. + +### No item is truly unique + +The fourth point which baffles me. +Jeb argues that, for example, adding named weapons like a crossbow named "Heartseeker" would "add connection points between worlds that would make them feel less special". + +I believe the effect is the opposite: "Hey, I found this epic weapon in a mineshaft! It has some cool enchantments and little durability, I guess it is the weapon of an old hero". +And finding it in different world wouldn't make it less special, you could think "the hero was here too". + +My point is that named weapons would add some story to the world and could serve as a good introduction to enchantments if they're more easily available. + +### In resume + +All in all, I'm not very satisfied with many of the restrictions Jeb has emposed on the game. +Many, if lifted, would open up the game to more interesting experiences and others seem to not be followed at all, or at least not for big important features of the game. + +I believe Minecraft should be more varied, not shying away from storytelling, while also being grounded and somewhat intuitive. +More random and unexpected things should be able to happen, even if it hurts the player, since that offers challenge and risk, which makes the experience more fun. + +## What does Mojang do to Minecraft? + +As mentioned, it seems Jeb doesn't follow some of the principles he outlines. +And other make the game worse, in my opinion. + +Let's now hear about it from the horse's mouth. +We'll explore the changes in more notable updates after Notch stepped down as lead designer. + +### 1.1 - 1.5 (Redstone Update) + +For the first 1-2 years, updates were fairly inoffensive, adding beaches, bow enchantments, jungles, ocelots, iron golems, emeralds, block varieties, the wither, item frames, potatoes, carrots, anvils, zombie villagers and hoppers, droppers, comparator, quartz. + +There isn't much to say, you could argue that more food items were a mistake, since there is no real use for them. +Wheat is still easy to gather, easy to grow, easy to craft in abundance and replenishes plenty of health. + +The redstone components are very useful, like the hopper and trapped chest. +Let me remind you, before trapped chests, you couldn't place double chests next to each other. + +Quartz is also a great addition, since there aren't much white blocks. +Although I'm slightly dissapointed they didn't add quartz structures, the quartz pillars really remind you of old roman/greek buildings. +It would've been cool if you could find the large ruins of a pure white structure, on the background of the monotonous red netherack. + +### 1.6 (Horse Update) + +Horses and Donkeys were a great addition, but I dislike the breeding mechanic. +It is extremely annoying to have to find and then selectively breed them to have a horse or donkey with the highest speed and/or jump. + +I might've done the breeding work once, and it wasn't fun at all. +Quite often I skip on horses, since quite often you'll ones which are too slow or jump too low. + +They should've simplified it, for example, make horses and donkeys spawn with a random set of 3-5 predetermined speed & jump values. +When you breed them, you'll have a high chance of taking the better trait of the two parents. + +It will be easier to compare and manage horses/donkeys and breeding would be more viable. + +### 1.7 (The Update that Changed the World) + +Most changes are fine. + +However, they did replace the rose with a poppy, mostly due to pedantics, since "roses are flowering shrubs, not flowers" (from the [url https://archive.org/details/minecraftgamedesign_202308/Jeb_ENG Minecraft game design book]). +This sets a bad precedence, that game features will be determined more by the way they work in real life than is reasonable to do in the game. + +Another change is in the world generator with a lot of new biomes. +The major difference between the old generation is that before land was somewhat separated in continents by large oceans, while now the world is one large mass with huge "ocean" lakes. +This is contrary to how it works in real life, but here I would argue it's a worse decision. + +Land masses before were plenty large to begin with, you were never really missing a biome, for which you needed to visit another continent. +And it made it more interesting, an ocean was an ocean, exploring the new continent was a cool idea. + +Although I will commend the mesa biome, since it was more colorful with the different clay layers and provided a more efficient way to acquire clay, easing up some of the grinding. + +### 1.8 (Bountiful Update) + +On one hand, this update introduced the slime block. +This block is fantastic, as new interesting effects emerge: bouncing players and items around, as well as making flying machines. +It can serve many different purposes and integrates quite seemlessly with the rest of the game. + +However, on the other hand, this update introduces the ocean monument and guardians. +As mentioned, guardians have a very weird design, both being inspired from reality with their tail and also being completely unrelated to anything. + +And for fighting through them and the elder guardian, you get a sponge and some gold? +Quite underwhelming, also mining fatigue is annoying more than challenging or interesting and the guardians are the only mobs which have the laser ability. + +This sets another bad precedent for the future: structures and mobs, which are exclusive to some specific structure which you have to find. + +They should've added more mechanics around it. +For example, what if you get a guardian eye as a weapon drop, allowing you to fire the beam? +Or why not make them like large squid-like creatures, reminiscent of ghasts which fire a new projectile? + +### 1.9 (Combat Update) + +This is a very contravertial update, to this day. + +To be honest, I'm on the fence about weapon cooldown. + +The shield too + +I like the fact that they added to the end dimention, so it is not a one-off island, however they added too little. +There should've been more structures, end cities shouldn't have been so rare (especially the variants with the ship) and elytras are broken. + +Being able to fly is cool and all, but it immediately destroys all other forms of transport. +Also, remember that thing about having mobs exclusive to some specific structure? + + +### 1.10 - + + + + + + + + + +## What is Minecraft? + +No, seriously! +Everybody's first thought is "a video game", closely followed by "an open-world sandbox". +But what does that mean in reality? + +Let's think about the "sandbox" genre, about games like Garry's mod, Stardew Valley, Kerbal Space Program. +Wait, those last two aren't sandbox games, they're sims! +Or are they? + +I mean, [url https://steamdb.info/charts/?tagid=3810 SteamDB] lists them as such, so does [url https://www.thegamer.com/best-sandbox-games/ TheGamer]. +But neither [url https://en.wikipedia.org/wiki/Category:Sandbox_games Wikipedia], nor [url https://www.metacritic.com/browse/game/all/sandbox/ Metacritic] do. +We could argue which source is more reputable than the other, but what's more important is how people view them in general, not who is technically right. +And it seems many believe either side. + +However, even between the universally accepted sandbox games we find suspicious differences. +Minecraft, Terraria and Garry's mod seem much more closely related to each other, than to Subnautica or ARK: Survival Evolved. + +So, I ask again: what is Minecraft? +What game is it? +What direction is it supposed to go in? +Should it lean more on bosses like Terraria, or more on PVP like ARK, or more on story like Subnautica? + +Since we're asking all these question, what is a video game anyway? + +### What is a game? + +I mean, [url https://en.wikipedia.org/wiki/Video_game Wikipedia] defines it as: + +.quote +A video game, [...] is an electronic game that involves interaction with a user interface or input device [...] to generate visual feedback from a display device, most commonly shown in a video format [...] + +But this leaves much to be desired: wouldn't a webpage be considered a videogame too? +Or a random number generator? +I mean, even your operating system creates visual feedback from a display device via inputs, is Windows 11 just one terribly unoptimized modern day AAA title? + +The [url https://dictionary.cambridge.org/dictionary/english/video-game Cambrige Dictionary] comes a little closer: + +.quote +A game in which the player controls moving pictures on a screen by pressing buttons + +The "moving pictures" part is kind of innacurate, what about all of those challenges where people play games blindfolded? +Although technically not done, it is equivalent to removing all graphics processing in the game, while still leaving it a "video game". + +But ok, now, what is a game [url https://dictionary.cambridge.org/dictionary/english/game Cambrige]: + +.quote +An entertaining activity or sport [...] + +Ok... but what is entertainment anyway? +I would consider organizing the icons on your desktop at least a little bit entertaining. +Drawing or animating is entertaining too, is Paint.NET a video game? + +### Making a decision + +These pedantics could go on until the end of time. +At the end of the day, the only true answer is that "a video game is something which we've decided call a video game". +That deciding factor in itself rests upon some loosely-defined characteristics; games look, feel, behave, are marketed and are engaged in certain ways. + +Let's try something else. +Since we can't really define what kind of game Minecraft is, nor what constitutes a game, let us ask: + +[=Is Minecraft a game?=] + +Seriously! +Comparing with other games, it has an "ending" when you kill the Ender Dragon, but you can continue playing after that, and it is not even mandatory. +It has building mechanics, but again, they are more or less optional, you could only play PVP on servers. +It has automation mechanics with redstone, but again, they are optional, and you could argue most players only ever lightly interact in them. +It has PVP mechanics, but you could play for hundreds of hours on a peaceful single-player world. + +It seems that almost all other sandbox games have some sort of goal and some set of core mechanics which the vast majority of players will always use. +You [*can*] beat Stardew Valley without ever framing, but you wouldn't find a huge portion of players doing that. +You could also beat Terraria without attacking, but again, very few people will do so. + +All of this bring me to the following conclusion: + +[= Minecraft is a tool!=] + +More precisely, it is a collection of well-interacting game mechanics, which are used to make (or play) your own "game". +Your experience is entirely determined by the game, or maybe we should call it "subgame", which you play when playing Minecraft. + + + +The obvious impliciation from our reasoning is that you improve Minecraft by adding depth to existing game mechanics and adding new mechanics which integrate well with most other mechanics. +But is that true? diff --git a/src/blog/turn-off-notifications-windows/index.du b/src/blog/turn-off-notifications-windows/index.du index b85f811..4215d81 100644 --- a/src/blog/turn-off-notifications-windows/index.du +++ b/src/blog/turn-off-notifications-windows/index.du @@ -1,27 +1,27 @@ -# How to turn off notifications on Windows +'def title How to turn off notifications on Windows +'def desc What if you need to concentrate on some work, and you don't want to have your notifications show up while doing so? Or, what if some apps just put out notifications too often? Well, this is how to disable notifications. -'define expected-reading 1 min -'define created 01 November 2021 -'define edited 01 November 2021 -[$pagenav] +# {title} + +{pagenav 1 min;01 November 2021;01 November 2021} What if you need to concentrate on some work, and you don't want to have your notifications show up while doing so? Or, what if some apps just put out notifications too often? Well, this is how to disable notifications: :ordered -1. In the [*Search bar*] type in [=Notification=]. The [=Notification & actions settings=] option should show up, click it +1. In the {i Search bar} type in {b Notification}. The {b Notification & actions settings} option should show up, click it - [image ./img/windows-search-notifications.png] + {img ./img/windows-search-notifications.png} -2. If you want to turn off all notifications, switch the [=Get notifications from apps and other senders=] to the [*Off*] position +2. If you want to turn off all notifications, switch the {b Get notifications from apps and other senders} to the {i Off} position - [image ./img/windows-settings-notifications-off.png] + {img ./img/windows-settings-notifications-off.png} .p - [*Note: "Suggest best ways", "Welcome Experience" and "Tips and tricks" will still show up, you'll have to uncheck those individually*] + {i Note: "Suggest best ways", "Welcome Experience" and "Tips and tricks" will still show up, you'll have to uncheck those individually} .p - If you want to turn off notifications for specific apps, scroll down to the [=Get notifications from these senders=], find the applications you want to turn off notifications for and flick the switch + If you want to turn off notifications for specific apps, scroll down to the {b Get notifications from these senders}, find the applications you want to turn off notifications for and flick the switch - [image ./img/windows-settings-notifications-application.png] + {img ./img/windows-settings-notifications-application.png} 3. Finally, you can simply close the window diff --git a/src/blog/virt-manager-freeze-on-browse/index.du b/src/blog/virt-manager-freeze-on-browse/index.du index 067c86d..a5646cf 100644 --- a/src/blog/virt-manager-freeze-on-browse/index.du +++ b/src/blog/virt-manager-freeze-on-browse/index.du @@ -1,23 +1,23 @@ -# virt-manager freezing up when clicking Browse in any window +'def title virt-manager freezing up when clicking Browse in any window +'def desc This issue is caused by some sort of problem with the storage pools when it tries to load them. I was able to fix it by pretty much deleting that folder, but you really should just rename it. -'define expected-reading 1 min -'define created 01 January 2023 -'define edited 01 January 2023 -[$pagenav] +# {title} + +{pagenav 1 min;01 January 2023;01 January 2023} The title explains what the problem is. You might've also noticed that it spikes a CPU core's utilization to 100%. Furthermore everything works if you enter a file location manually in the corresponding input field, it's just that darn button. -'footnote storage-pools The storage pool is just a folder with files that store what locations can be used by virtual machines (more info [url https://libvirt.org/storage.html here]). In the case of virt-manager, pretty much every time you select any folder or file, a folder entry gets added there. +'footnote storage-pools The storage pool is just a folder with files that store what locations can be used by virtual machines (more info {url here;https://libvirt.org/storage.html}). In the case of virt-manager, pretty much every time you select any folder or file, a folder entry gets added there. -This issue is caused by some sort of problem with the storage pools[$storage-pools] when it tries to load them. +This issue is caused by some sort of problem with the storage pools{storage-pools} when it tries to load them. I was able to fix it by pretty much deleting that folder, but you really should just rename it: -```shell +```sh sudo mv /etc/libvirt/storage /etc/libvirt/storage-broken libvirt automagically regenerates the original folder, so you might need to restart it: -```shell +```sh sudo systemctl restart libvirtd diff --git a/src/blog/when-a-language-forces-simpler-thinking/index.du b/src/blog/when-a-language-forces-simpler-thinking/index.du index fcf3c7e..c99ebd0 100644 --- a/src/blog/when-a-language-forces-simpler-thinking/index.du +++ b/src/blog/when-a-language-forces-simpler-thinking/index.du @@ -1,15 +1,15 @@ -# When a language forces simpler thinking +'def title When a language forces simpler thinking +'def desc An interesting situation where changing how you think results in a better solutions than trying to adapt your original idea -'define expected-reading 5 min -'define created 13 December 2022 -'define edited 13 December 2022 -[$pagenav] +# {title} -This year I decided to join the [url https://adventofcode.com/2022 2022 Advent of Code] event. -The exercise [url https://adventofcode.com/2022/day/7 on the 7th day] involved storage of a folder structure: each folder would have a name, files, and other folders in itself. +{pagenav 5 min;13 December 2022;13 December 2022} + +This year I decided to join the {url 2022 Advent of Code;https://adventofcode.com/2022} event. +The exercise {url on the 7th day;https://adventofcode.com/2022/day/7} involved storage of a folder structure: each folder would have a name, files, and other folders in itself. For the task itself, you don't actually need to store the files, just the sum of their (and of those in subfolders) size, so a folder can be represented as a name, a number and multiple other folders. -My solutions are written purely in [url https://en.wikipedia.org/wiki/Common_Lisp#Syntax Common Lisp]: a programming language where everything is represented as a list of values. A value might be another list or a non-list value, like a number. +My solutions are written purely in {url Common Lisp;https://en.wikipedia.org/wiki/Common_Lisp#Syntax}: a programming language where everything is represented as a list of values. A value might be another list or a non-list value, like a number. So I thought I could represent each folder as a list, where the first item is it's name, second is file size sum and the rest are subfolders, something like this: ``` @@ -21,7 +21,7 @@ Name File size sum Subfolder "e" in "a" | | Subfolder "a" in "/" Subfolder "d" in "/" -Now, after parsing a file, you'll need to update the file size sum in the [=current=] folder [=and=] in the [=parent=] folder. +Now, after parsing a file, you'll need to update the file size sum in the {b current} folder {b and} in the {b parent} folder. To do such a thing, you would either need to .bulleted @@ -49,16 +49,14 @@ Name | File size sum | | | At index 0 is parent "/" Parent is "a" Parent is "/" -'footnote day7 A potential improvement would be to use CLOS to store each folder as it's own object, but this worked fine and I really wanted to spare reading on CLOS at that time. - -Now this solution worked great! With this I was able to [url https://gitlab.com/Syndamia/advent-of-code/-/tree/main/2022/Day07 solve] both tasks easily.[$day7] +Now this solution worked great! With this I was able to {url solve;https://gitlab.com/Syndamia/advent-of-code/-/tree/main/2022/Day07} both tasks easily.{fn A potential improvement would be to use CLOS to store each folder as it's own object, but this worked fine and I really wanted to spare reading on CLOS at that time.} #### Appendix In the exercise, you have commands for navigating between folders. -Going up a folder is trivial, but folders can have duplicate names if they're inside different parent folders, so going to a sub folder requires to search by it's name [*and*] parent index. +Going up a folder is trivial, but folders can have duplicate names if they're inside different parent folders, so going to a sub folder requires to search by it's name {i and} parent index. -Surprisingly enough, in my solution [url https://gitlab.com/Syndamia/advent-of-code/-/tree/main/2022/Day07/part-one.cl#L15-17 (lines 15-17)], I just search from the end to the beginning of all parsed folders for a name. +Surprisingly enough, in my solution {url (lines 15-17);https://gitlab.com/Syndamia/advent-of-code/-/tree/main/2022/Day07/part-one.cl#L15-17}, I just search from the end to the beginning of all parsed folders for a name. This works fine for this exact task and exact inputs, however in general this isn't correct. In a structure like this: ``` @@ -92,8 +90,8 @@ $ cd .. $ cd .. $ cd a -'footnote mkfile [`mkfile`] is like [`touch`], but you could specify a size and the file will be filled with that many zeroes. It seems to exist solely in [url https://docs.oracle.com/cd/E26502_01/html/E29031/mkfile-1m.html Solaris] (as a system administration command) and [url https://ss64.com/osx/mkfile.html MacOS]. I mentioned it and not [`touch`], since the latter only creates empty files, which wouldn't contribute to the total file size sum. - -The last [`\$ cd a`] actually puts you into [`/b/a/`], not [`/a/`]. +The last {` \$ cd a} actually puts you into {` /b/a/}, not {` /a/}. The main thing that saves us (me) is that you can only change directory and list structure (in current directory), so you would only ever be visiting a folder once. -If a folder's contents were [`ls`]'d more than once, or they could change (for example having an [`mkfile`] [$mkfile] command), a proper search would be required. +If a folder's contents were {` ls}'d more than once, or they could change (for example having an {` mkfile} {fn {` mkfile} is like {` touch}, but you could specify a size and the file will be filled with that many zeroes. It seems to exist solely in {url Solaris;https://docs.oracle.com/cd/E26502_01/html/E29031/mkfile-1m.html} (as a system administration command) and {url MacOS;https://ss64.com/osx/mkfile.html}. I mentioned it and not {` touch}, since the latter only creates empty files, which wouldn't contribute to the total file size sum.} command), a proper search would be required. + +{footnotes} diff --git a/src/blog/windows-run-dialog/index.du b/src/blog/windows-run-dialog/index.du index c5de7b1..5269555 100644 --- a/src/blog/windows-run-dialog/index.du +++ b/src/blog/windows-run-dialog/index.du @@ -1,172 +1,175 @@ -# Windows Run dialog +'def title Windows Run dialog +'def desc On Windows, most often you run an application by finding and double-clicking it's exe file. What a lot of people don't realise is that you can launch any application or open any file you want by typing a single command. That can be achieved inside the Run dialog. -'define expected-reading 3 min -'define created 04 October 2021 -'define edited 31 October 2021 -[$pagenav] +# {title} + +{pagenav 3 min;04 October 2021;31 October 2021} :contents :numbered -1. [url #opening-the-run-dialog Opening the Run dialog] +1. {uhref Opening the Run dialog} -2. [url #commands Commands] +2. {uhref Commands} .numbered - 1. [url #folders Folders] - 2. [url #programs Programs] - 3. [url #windows-settings Windows settings] + 1. {uhref Folders} + 2. {uhref Programs} + 3. {uhref Windows settings} -3. [url #for-more For more] +3. {uhref For more} -On Windows, most often you run an application by finding and double-clicking it's [`.exe`] file. What a lot of people don't realise is that you can launch any application or open any file you want by typing a single command. That can be achieved inside the [=Run dialog=]. +On Windows, most often you run an application by finding and double-clicking it's {` .exe} file. What a lot of people don't realise is that you can launch any application or open any file you want by typing a single command. That can be achieved inside the {b Run dialog}. ## Opening the Run dialog To open the Run dialog, you can either: -[*A)*] Press [`Win + R`] key combination +{i A)} Press {` Win + R} key combination or -[*B)*] Right click on the Windows menu, and then press [`Run`] +{i B)} Right click on the Windows menu, and then press {` Run} -[image ./img/open-run-windows-menu.png] +{img ./img/open-run-windows-menu.png} ## Commands -[image ./img/run-dialog.png] +{img ./img/run-dialog.png} ### Folders -You can open any folder by typing in it's [=full path=]. So, if you have a folder named [`Work`] inside your [`Documents`] folder, the full path will be something like [`C:\Users\John\Documents\Work\\`]. +You can open any folder by typing in it's {b full path}. So, if you have a folder named {` Work} inside your {` Documents} folder, the full path will be something like {` C:\Users\John\Documents\Work\\}. -If your desired folder is directly in your account folder, so [`Desktop`], [`Documents`], [`Pictures`], etc. you can just type in the name of the folder. For example, if you want to open your [`Pictures`] folder, just type in [`pictures`] and it will be opened. +If your desired folder is directly in your account folder, so {` Desktop}, {` Documents}, {` Pictures}, etc. you can just type in the name of the folder. For example, if you want to open your {` Pictures} folder, just type in {` pictures} and it will be opened. There are, of course, some more special location, some of which are: -.table_2 +.table +.2 |= Command |= Location -|: [`%ProgramFiles%`] +|: {` %ProgramFiles%} |: Program Files Folder -|: [`%AppData%`] +|: {` %AppData%} |: User's App Data Folder -[=Bonus=]: [`%appdata%\Microsoft\Windows\Start Menu`] will open the Start Menu folder, from which you can edit what goes inside your start menu. +{b Bonus}: {` %appdata%\Microsoft\Windows\Start Menu} will open the Start Menu folder, from which you can edit what goes inside your start menu. ### Programs -You can always run any application by typing in it's full path. So, to launch something like FireFox, you'll need to type in [`C:\Program Files\Mozilla Firefox\firefox.exe`]. +You can always run any application by typing in it's full path. So, to launch something like FireFox, you'll need to type in {` C:\Program Files\Mozilla Firefox\firefox.exe}. But, whats more important is that you can more easily launch some Windows apps, like Calculator or Control Panel. Here is a list of commands and the application they launch: -.table_2 +.table +.2 |= Command |= Application -|: [`calc`] +|: {` calc} |: Calculator -|: [`mspaint`] +|: {` mspaint} |: Microsoft Paint -|: [`snippingtool`] +|: {` snippingtool} |: Snipping Tool -|: [`notepad`] +|: {` notepad} |: Notepad -|: [`sndvol`] +|: {` sndvol} |: Volume Mixer -|: [`soundrecroder`] +|: {` soundrecroder} |: Sound Recorder -|: [`wuapp`] +|: {` wuapp} |: Windows Updates -|: [`shutdown`]\* +|: {` shutdown}\* |: Shutdown or restart computer |: |: -|: [`cmd`] +|: {` cmd} |: Command Prompt -|: [`powershell`] +|: {` powershell} |: Windows PowerShell -|: [`control`] +|: {` control} |: Control Panel -|: [`taskmgr`] +|: {` taskmgr} |: Task Manager -|: [`msinfo32`] +|: {` msinfo32} |: System Information -|: [`winver`] +|: {` winver} |: Windows Version Window -|: [`cleanmgr`] +|: {` cleanmgr} |: Disk Cleanup -|: [`dfrgui`] +|: {` dfrgui} |: Disk Cleanup (defragmentation) -|: [`mstsc`] +|: {` mstsc} |: Remote Desktop Connection |: |: -|: [`regedit`] +|: {` regedit} |: Registry Editor -|: [`msconfig`] +|: {` msconfig} |: System Configuration Settings -|: [`dcomcnfg`] +|: {` dcomcnfg} |: Component Services -|: [`sigverif`] +|: {` sigverif} |: File Signature Verification Tool -\*: The [`shutdown`] command [url https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/shutdown requires parameters]: +\*: The {` shutdown} command {url requires parameters;https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/shutdown}: .bulleted -- [`/s`] will shutdown in one minute -- [`/r`] will restart in one minute -- [`/t`] specifies after what amount of time to shutdown or restart (a number needs to be entered afterwards, so [`/t 0`] for immediate execution) -- [`/f`] forces running applications to close (might result in data loss!) +- {` /s} will shutdown in one minute +- {` /r} will restart in one minute +- {` /t} specifies after what amount of time to shutdown or restart (a number needs to be entered afterwards, so {` /t 0} for immediate execution) +- {` /f} forces running applications to close (might result in data loss!) ### Windows settings There are also many "shortcuts" to different Windows settings windows. Those include: -.table_2 +.table +.2 |= Command |= Setting -|: [`mmsys.cpl`] +|: {` mmsys.cpl} |: Sound Properties -|: [`powercfg.cpl`] +|: {` powercfg.cpl} |: Power Options -|: [`timedate.cpl`] +|: {` timedate.cpl} |: Time and Date Options -|: [`ncpa.cpl`] +|: {` ncpa.cpl} |: Network Connections |: |: -|: [`inetcpl.cpl`] +|: {` inetcpl.cpl} |: Internet Properties -|: [`compmgmt.msc`] +|: {` compmgmt.msc} |: Computer Manager -|: [`devmgmt.msc`] +|: {` devmgmt.msc} |: Device Manager -|: [`diskmgmt.msc`] +|: {` diskmgmt.msc} |: Disk Management -|: [`firewall.cpl`] +|: {` firewall.cpl} |: Windows Firewall |: |: -|: [`sysdm.cpl`] +|: {` sysdm.cpl} |: System Properties -|: [`services.msc`] +|: {` services.msc} |: Services -|: [`comexp.msc`] +|: {` comexp.msc} |: Component Services -|: [`gpedit.msc`] +|: {` gpedit.msc} |: Group Policy Editor -|: [`lusrmgr.msc`] +|: {` lusrmgr.msc} |: Local Users and Groups -|: [`certmgr.msc`] +|: {` certmgr.msc} |: Certificate Manager -|: [`taskschd.msc`] +|: {` taskschd.msc} |: Task Scheduler -|: [`fsmgmt.msc`] +|: {` fsmgmt.msc} |: Shared Folders -[=Note=]: [`cpl`] stands for [*Control Panel Item*] and [`msc`] stands for [*Microsoft System Configuration*]. +{b Note}: {` cpl} stands for {i Control Panel Item} and {` msc} stands for {i Microsoft System Configuration}. ## For more -For more commands, check out [url https://windowsruncommands.com/ windowsruncommands.com]. They have a much bigger list of commands and shortcuts you can use. +For more commands, check out {url windowsruncommands.com;https://windowsruncommands.com/}. They have a much bigger list of commands and shortcuts you can use. diff --git a/src/index.du b/src/index.du index 486b15f..38c86cb 100644 --- a/src/index.du +++ b/src/index.du @@ -13,7 +13,8 @@ Have a look around and enjoy your stay! ### Keyboard navigation (requires javascript) -:table_3 +:table +:3 |= Key |= Available |= Action diff --git a/src/license.du b/src/license.du index 77a8877..7b18b90 100644 --- a/src/license.du +++ b/src/license.du @@ -1,12 +1,15 @@ -# License +'def title License +'def desc CC BY-SA for articles, pictures, ... and GNU GPLv3 for source code + +# {title} This project uses two licenses, depending on the item. -For articles and pictures/diagrams/etc. that have been made by me, the license is [url https://creativecommons.org/licenses/by-sa/4.0/ CC BY-SA] (also found in [url https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/LICENSE-CONTENT LICENSE-CONTENT]). -Everything under [url /assets assets], unless stated otherwise, also falls in this category. +For articles and pictures/diagrams/etc. that have been made by me, the license is {url CC BY-SA;https://creativecommons.org/licenses/by-sa/4.0/} (also found in {url LICENSE-CONTENT;https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/LICENSE-CONTENT}). +Everything under {url assets;/assets}, unless stated otherwise, also falls in this category. -For source code, like all JavaScript or AWK generation scripts (those aren't on the website but are in the [url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/awk-edits repository]), the license is [url https://www.gnu.org/licenses/gpl-3.0.html GNU GPLv3] (also found in [url https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/LICENSE-CODE LICENSE-CODE]). +For source code, like all JavaScript or AWK generation scripts (those aren't on the website but are in the {url repository;https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/awk-edits}), the license is {url GNU GPLv3;https://www.gnu.org/licenses/gpl-3.0.html} (also found in {url LICENSE-CODE;https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/LICENSE-CODE}). -Content in [url /archives Archives] and [url /archived-websites Archived Web] [=isn't made by me and it's respective creator must be asked for licensing=]. This content is not saved in the [url https://gitlab.com/Syndamia/syndamiadotcom GitLab repository]. +Content in {url Archives;/archives} and {url Archived Web;/archived-websites} {b isn't made by me and it's respective creator must be asked for licensing}. This content is not saved in the {url GitLab repository;https://gitlab.com/Syndamia/syndamiadotcom}. -[*If you feel like something is infringing on your own Copyright, please contact me immediately with any listed contact channel inside [url /about /about]!*] +{i If you feel like something is infringing on your own Copyright, please contact me immediately with any listed contact channel inside {url /about;/about}!} diff --git a/src/misc.du b/src/misc.du index 3746bd8..4a641f7 100644 --- a/src/misc.du +++ b/src/misc.du @@ -1,4 +1,7 @@ -# Miscellaneous +'def title Miscellaneous +'def desc Other types of content I've made, including documents, images, videos and web demos. + +# {title} Other types of content I've made, including documents, images, videos and web demos. @@ -7,8 +10,8 @@ Other types of content I've made, including documents, images, videos and web de #### 2022 :defs -; [$ft-text] 19.09   [url /misc/universitetski-belejki Университетски бележки] +; {ft-text} 19.09   {url Университетски бележки;/misc/universitetski-belejki} : Различни материали, които съм правил през следването ми във ФМИ -; [$ft-photo] 16.07   [url /files/misc/Layout%20engines%20and%20browsers.svg Layout engines and browsers] +; {ft-photo} 16.07   {url Layout engines and browsers;/files/misc/Layout%20engines%20and%20browsers.svg} : A diagram which roughly outlines the main layout engines throughout the web's history diff --git a/src/misc/index.du b/src/misc/index.du index 3746bd8..4a641f7 100644 --- a/src/misc/index.du +++ b/src/misc/index.du @@ -1,4 +1,7 @@ -# Miscellaneous +'def title Miscellaneous +'def desc Other types of content I've made, including documents, images, videos and web demos. + +# {title} Other types of content I've made, including documents, images, videos and web demos. @@ -7,8 +10,8 @@ Other types of content I've made, including documents, images, videos and web de #### 2022 :defs -; [$ft-text] 19.09   [url /misc/universitetski-belejki Университетски бележки] +; {ft-text} 19.09   {url Университетски бележки;/misc/universitetski-belejki} : Различни материали, които съм правил през следването ми във ФМИ -; [$ft-photo] 16.07   [url /files/misc/Layout%20engines%20and%20browsers.svg Layout engines and browsers] +; {ft-photo} 16.07   {url Layout engines and browsers;/files/misc/Layout%20engines%20and%20browsers.svg} : A diagram which roughly outlines the main layout engines throughout the web's history diff --git a/src/misc/universitetski-belejki/index.du b/src/misc/universitetski-belejki/index.du index 7ba3584..668eb85 100644 --- a/src/misc/universitetski-belejki/index.du +++ b/src/misc/universitetski-belejki/index.du @@ -1,9 +1,12 @@ -# Университетски бележки +'def title Университетски бележки +'def desc Разнообразни материали, които съм правел през следването ми във ФМИ. -На тази уебстраница ще пазя връзки към разнообразни материали, които съм правел през следването ми във [url https://www.fmi.uni-sofia.bg/ ФМИ]. +# {title} -[=В тези файлове със сигурност може да има грешки/недостатъци!=] -Не гарантирам нищо, ако намерите проблеми може [url /about да ми пишете]. +На тази уебстраница ще пазя връзки към разнообразни материали, които съм правел през следването ми във {url ФМИ;https://www.fmi.uni-sofia.bg/}. + +{b В тези файлове със сигурност може да има грешки/недостатъци!} +Не гарантирам нищо, ако намерите проблеми може {url да ми пишете;/about}. @@ -14,28 +17,28 @@ ### Алгебра 1 .defs -; [$ft-text] [url /files/misc/uni-notes/algebra1/topics.pdf Разписани теми за устен изпит]   [url https://gitlab.com/Syndamia/uni-projects/-/blob/main/Year%201/Algebra/Topics/ източник \*] +; {ft-text} {url Разписани теми за устен изпит;/files/misc/uni-notes/algebra1/topics.pdf}   {url източник *;https://gitlab.com/Syndamia/uni-projects/-/blob/main/Year%201/Algebra/Topics/} : Всичките теми, които имах да разписвам за устния изпит. Нещата са взети кажи-речи директно от лекции. ### Диференциално и интегрално смятане 1 :defs -; [$ft-text] [url /files/misc/uni-notes/dis1/notes.pdf Записки върху материала]   [url https://gitlab.com/Syndamia/uni-projects/-/blob/main/Year%201/Calculus/ източник \*] +; {ft-text} {url Записки върху материала;/files/misc/uni-notes/dis1/notes.pdf}   {url източник *;https://gitlab.com/Syndamia/uni-projects/-/blob/main/Year%201/Calculus/ източник} : Главните дефиниции, формулировки на теореми и формули, които поне аз сметнах за достатъчни по ДИС 2. Обхваща материала от лекция 1 до 13 включително. -; [$ft-text] [url /files/misc/uni-notes/dis1/notes-appendix.pdf Основни доказателства]   [url https://gitlab.com/Syndamia/uni-projects/-/blob/main/Year%201/Calculus/ източник \*] +; {ft-text} {url Основни доказателства;/files/misc/uni-notes/dis1/notes-appendix.pdf}   {url източник *;https://gitlab.com/Syndamia/uni-projects/-/blob/main/Year%201/Calculus/} : По-важните доказателства от лекции, като съм се опитал да ги формулирам по по-разбираем за мен начин. Не е завършено, напълно обхваща само лекции 1 до 5 и от части лекции 6, 8 и 9. ### Дискретни структури .defs -; [$ft-text] [url /files/misc/uni-notes/dstr/notes.pdf Записки върху материала]   [url https://gitlab.com/Syndamia/uni-projects/-/blob/main/Year%201/Discrete%20math/ източник \*] +; {ft-text} {url Записки върху материала;/files/misc/uni-notes/dstr/notes.pdf}   {url източник *;https://gitlab.com/Syndamia/uni-projects/-/blob/main/Year%201/Discrete%20math/} : Съществените за мен дефиниции, формулировки на теореми и формули. Обхваща лекции 1 до 7 включително. \n -[$line] +{line} <sup id="*">*</sup>: Източници със зезда до тях са свързани с изходния LaTeX код на самите документи, обаче се намират в git хранилище, което за сега не е публично през академичната година. -Ако Ви трябва, [url /about пишете ми], няма проблем да го пратя. +Ако Ви трябва, {url пишете ми;/about}, няма проблем да го пратя. diff --git a/src/preserved-media.du b/src/preserved-media.du index a5738be..b02f6c0 100644 --- a/src/preserved-media.du +++ b/src/preserved-media.du @@ -1,14 +1,17 @@ -# Preserved media +'def title Preserved media +'def desc An assortment of documents, videos, etc. which are not made by me, but aren't archived on the internet or have the potential of permanently disappearing. -An assortment of documents, videos, etc. which are [=not=] made by me, but aren't archived on the internet or have the potential of permanently disappearing. +# {title} -If you are an owner of something listed here, [url /about contact me] and I'll remove it immediately. +An assortment of documents, videos, etc. which are {b not} made by me, but aren't archived on the internet or have the potential of permanently disappearing. + +If you are an owner of something listed here, {url contact me;/about} and I'll remove it immediately. \n :defs -; [$ft-zip] 22.09.2022   [url /files/media/BrilliantButtonMaker-LucaZappa-updated.zip Reconstructed source] of Luca Zappa's Brilliant Button Maker -: Using what archive.org had, I reconstructed most of the source code for the "Brilliant Button Maker" by [url https://www.linkedin.com/in/lucazappa/ Luca Zappa]. I also host it [url https://hob.syndamia.com/brilliant-button-maker/ here]. +; {ft-zip} 22.09.2022   {url Reconstructed source;/files/media/BrilliantButtonMaker-LucaZappa-updated.zip} of Luca Zappa's Brilliant Button Maker +: Using what archive.org had, I reconstructed most of the source code for the "Brilliant Button Maker" by {url Luca Zappa;https://www.linkedin.com/in/lucazappa/}. I also host it {url here;https://hob.syndamia.com/brilliant-button-maker/}. -; [$ft-text] 14.10.1991   [url /files/media/43208-%D0%A3/43208-%D0%A3.pdf Прибор электроизмерительный комбинированный типа 43208-У] -: A scanned manual (in Russian) for the Soviet Analog Multimeter [url http://radioamator.ru/izmereniya/multimetry-testery/221-kombinirovannyj-pribor-43208-u-osobennosti-skhemy-i-remonta 43208-У] +; {ft-text} 14.10.1991   {url Прибор электроизмерительный комбинированный типа 43208-У;/files/media/43208-%D0%A3/43208-%D0%A3.pdf} +: A scanned manual (in Russian) for the Soviet Analog Multimeter {url 43208-У;http://radioamator.ru/izmereniya/multimetry-testery/221-kombinirovannyj-pribor-43208-u-osobennosti-skhemy-i-remonta} diff --git a/src/preserved-media/index.du b/src/preserved-media/index.du index a5738be..b02f6c0 100644 --- a/src/preserved-media/index.du +++ b/src/preserved-media/index.du @@ -1,14 +1,17 @@ -# Preserved media +'def title Preserved media +'def desc An assortment of documents, videos, etc. which are not made by me, but aren't archived on the internet or have the potential of permanently disappearing. -An assortment of documents, videos, etc. which are [=not=] made by me, but aren't archived on the internet or have the potential of permanently disappearing. +# {title} -If you are an owner of something listed here, [url /about contact me] and I'll remove it immediately. +An assortment of documents, videos, etc. which are {b not} made by me, but aren't archived on the internet or have the potential of permanently disappearing. + +If you are an owner of something listed here, {url contact me;/about} and I'll remove it immediately. \n :defs -; [$ft-zip] 22.09.2022   [url /files/media/BrilliantButtonMaker-LucaZappa-updated.zip Reconstructed source] of Luca Zappa's Brilliant Button Maker -: Using what archive.org had, I reconstructed most of the source code for the "Brilliant Button Maker" by [url https://www.linkedin.com/in/lucazappa/ Luca Zappa]. I also host it [url https://hob.syndamia.com/brilliant-button-maker/ here]. +; {ft-zip} 22.09.2022   {url Reconstructed source;/files/media/BrilliantButtonMaker-LucaZappa-updated.zip} of Luca Zappa's Brilliant Button Maker +: Using what archive.org had, I reconstructed most of the source code for the "Brilliant Button Maker" by {url Luca Zappa;https://www.linkedin.com/in/lucazappa/}. I also host it {url here;https://hob.syndamia.com/brilliant-button-maker/}. -; [$ft-text] 14.10.1991   [url /files/media/43208-%D0%A3/43208-%D0%A3.pdf Прибор электроизмерительный комбинированный типа 43208-У] -: A scanned manual (in Russian) for the Soviet Analog Multimeter [url http://radioamator.ru/izmereniya/multimetry-testery/221-kombinirovannyj-pribor-43208-u-osobennosti-skhemy-i-remonta 43208-У] +; {ft-text} 14.10.1991   {url Прибор электроизмерительный комбинированный типа 43208-У;/files/media/43208-%D0%A3/43208-%D0%A3.pdf} +: A scanned manual (in Russian) for the Soviet Analog Multimeter {url 43208-У;http://radioamator.ru/izmereniya/multimetry-testery/221-kombinirovannyj-pribor-43208-u-osobennosti-skhemy-i-remonta} diff --git a/src/preserved-web-pages.du b/src/preserved-web-pages.du index 5fc7d1a..07b901c 100644 --- a/src/preserved-web-pages.du +++ b/src/preserved-web-pages.du @@ -1,11 +1,14 @@ -# Preserved Web pages +'def title Preserved Web pages +'def desc Web pages/sites with endangered archival, not made by me, that I've decided to host. -Similarly to [url /preserved-media preserved media], these are web pages/sites with endangered archival, [=not=] made by me, that I've decided to host. +# {title} -If you are an owner of something listed here, [url /about contact me] and I'll remove it immediately. +Similarly to {url preserved media;/preserved-media}, these are web pages/sites with endangered archival, {b not} made by me, that I've decided to host. + +If you are an owner of something listed here, {url contact me;/about} and I'll remove it immediately. \n :defs -; [$ft-browser] 2005   [url https://hob.syndamia.com/brilliant-button-maker/ Brilliant Button Maker] by Luca Zappa   [url https://syndamia.com/files/hob/BrilliantButtonMaker-LucaZappa-updated.zip source code] +; {ft-browser} 2005   {url Brilliant Button Maker;https://hob.syndamia.com/brilliant-button-maker/} by Luca Zappa   {url source code;https://syndamia.com/files/hob/BrilliantButtonMaker-LucaZappa-updated.zip} : A nice web button maker from the 2000s, written in PHP. Since it was no longer available, I found and fixed up most of the PHP that archive.org saved. diff --git a/src/preserved-web-pages/index.du b/src/preserved-web-pages/index.du index 5fc7d1a..07b901c 100644 --- a/src/preserved-web-pages/index.du +++ b/src/preserved-web-pages/index.du @@ -1,11 +1,14 @@ -# Preserved Web pages +'def title Preserved Web pages +'def desc Web pages/sites with endangered archival, not made by me, that I've decided to host. -Similarly to [url /preserved-media preserved media], these are web pages/sites with endangered archival, [=not=] made by me, that I've decided to host. +# {title} -If you are an owner of something listed here, [url /about contact me] and I'll remove it immediately. +Similarly to {url preserved media;/preserved-media}, these are web pages/sites with endangered archival, {b not} made by me, that I've decided to host. + +If you are an owner of something listed here, {url contact me;/about} and I'll remove it immediately. \n :defs -; [$ft-browser] 2005   [url https://hob.syndamia.com/brilliant-button-maker/ Brilliant Button Maker] by Luca Zappa   [url https://syndamia.com/files/hob/BrilliantButtonMaker-LucaZappa-updated.zip source code] +; {ft-browser} 2005   {url Brilliant Button Maker;https://hob.syndamia.com/brilliant-button-maker/} by Luca Zappa   {url source code;https://syndamia.com/files/hob/BrilliantButtonMaker-LucaZappa-updated.zip} : A nice web button maker from the 2000s, written in PHP. Since it was no longer available, I found and fixed up most of the PHP that archive.org saved. diff --git a/src/privacy.du b/src/privacy.du index f3fe682..a6f10f8 100644 --- a/src/privacy.du +++ b/src/privacy.du @@ -1,15 +1,18 @@ -# Privacy policy +'def title Privacy policy +'def desc syndamia.com (and tiny.syndamia.com) offer no use data submission and implement no JavaScript-based tracking. Standard HTTP logs are collected. -[url https://syndamia.com syndamia.com] and [url https://tiny.syndamia.com tiny.syndamia.com] offer no user data submission (user accounts, reply forms, etc.). -Also, there is [url #no-collection-with-javascript no form of data collection with Javascript]. +# {title} -Some [url #third-party-services third-party services] as well as some [url #http-logs essential server-side programs] may collect data. -Any data I'm responsible for [=is NEVER collected to be sold!=] +{url syndamia.com;https://syndamia.com} and {url tiny.syndamia.com;https://tiny.syndamia.com} offer no user data submission (user accounts, reply forms, etc.). +Also, there is {url no form of data collection with Javascript;#no-collection-with-javascript}. + +Some {url third-party services;#third-party-services} as well as some {url essential server-side programs;#http-logs} may collect data. +Any data I'm responsible for {b is NEVER collected to be sold!} ### HTTP logs General HTTP requests to the server (and data surrounding them) are saved, which may include: IP address, timestamps, exact page request, user agent, etc. -My current web server software (program, which handles website requests) of choice is [url https://httpd.apache.org/ apache2], and the data format (mostly) corresponds to it's defaults. +My current web server software (program, which handles website requests) of choice is {url apache2;https://httpd.apache.org/}, and the data format (mostly) corresponds to it's defaults. One such data line would look something like: @@ -20,13 +23,13 @@ These logs could be useful for certain issues, like bad server performance or ma ### Third-party services -My domain is bought with [url https://www.namecheap.com/ namecheap] and it's associated DNS entries are managed with namecheap servers. +My domain is bought with {url namecheap;https://www.namecheap.com/} and it's associated DNS entries are managed with namecheap servers. This means that DNS entries, or in simpler terms - domain configurations, first go through namecheap, and that may or may not mean they can collect data from you. -Analogously, my website is hosted on [url https://www.hetzner.com/ hetzner] servers, which may or may not be doing some sort of data collection, outside of my control. +Analogously, my website is hosted on {url hetzner;https://www.hetzner.com/} servers, which may or may not be doing some sort of data collection, outside of my control. ### No collection with Javascript -[url /regarding-js.html This site uses Javascript], so some feature configuration information may be temporarily stored in your browser. -For what exactly that data is, read [url /regarding-js.html#data-in-browser-storage here]. +{url This site uses Javascript;/regarding-js.html}, so some feature configuration information may be temporarily stored in your browser. +For what exactly that data is, read {url here;/regarding-js.html#data-in-browser-storage}. However, for now there are no plans on integrating any sort of statistics or personal data collection. diff --git a/src/regarding-js.du b/src/regarding-js.du index 2251d3f..b04abd8 100644 --- a/src/regarding-js.du +++ b/src/regarding-js.du @@ -1,75 +1,79 @@ -# Regarding usage of JavaScript +'def title Regarding usage of JavaScript +'def desc Listing of the different JavaScript scripts used in this website and the data they store in the browser. -On 20.02.2022 I decided to lift the "ban" on usage of JavaScript in this website. This gives me the freedom to implement some useful features for those that have it enabled. [=Any content that doesn't depend on JavaScript will be perfectly consumable without it!=] +# {title} + +On 20.02.2022 I decided to lift the "ban" on usage of JavaScript in this website. This gives me the freedom to implement some useful features for those that have it enabled. {b Any content that doesn't depend on JavaScript will be perfectly consumable without it!} Any user data that might be saved isn't, and never will be, used for purposes not listed here. There isn't, and won't ever be, any form of tracking or data collection that isn't required for some feature (listed here). ## Implemented features -:table_5 +:table +:5 |= Script |= Description |= GitLab source |= Size |= Lines -|: [url /scripts/image-show.js image-show.js] +|: {url image-show.js;/scripts/image-show.js} |: Click to zoom on images -|: [url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/image-show.js Link] +|: {url Link;https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/image-show.js} |: 551B |: 24 -|: [url /scripts/back-to-top.js back-to-top.js] +|: {url back-to-top.js;/scripts/back-to-top.js} |: Automatically appearing button to scroll to top -|: [url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/back-to-top.js Link] +|: {url Link;https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/back-to-top.js} |: 378B |: 15 -|: [url /scripts/styling-preload.js styling-preload.js] +|: {url styling-preload.js;/scripts/styling-preload.js} |: Disable/enable certain stylesheets before page rendering -|: [url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/styling-preload.js Link] +|: {url Link;https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/styling-preload.js} |: 385B |: 13 -|: [url /scripts/theme-changer.js theme-changer.js] +|: {url theme-changer.js;/scripts/theme-changer.js} |: Change theme between light and dark (split in two files) -|: [url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/theme-changer.js Link] +|: {url Link;https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/theme-changer.js} |: 468B |: 18 -|: [url /scripts/page-width.js page-width.js] +|: {url page-width.js;/scripts/page-width.js} |: Change whether text covers the whole width of the page or only the middle (applicable to wide screens) -|: [url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/page-width.js Link] +|: {url Link;https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/page-width.js} |: 640B |: 23 -|: [url /scripts/expand-navbar.js expand-navbar.js] +|: {url expand-navbar.js;/scripts/expand-navbar.js} |: Button to shrink and expand the sidebar -|: [url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/expand-navbar.js Link] +|: {url Link;https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/expand-navbar.js} |: 728B |: 20 -|: [url /scripts/presentation.js presentation.js] -|: Presentation logic (button capabilities and other) [=Loaded only on pages with presentations!=] -|: [url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/presentation.js Link] +|: {url presentation.js;/scripts/presentation.js} +|: Presentation logic (button capabilities and other) {b Loaded only on pages with presentations!} +|: {url Link;https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/presentation.js} |: 6.1KB |: 204 -|: [url /scripts/keyboard.js keyboard.js] +|: {url keyboard.js;/scripts/keyboard.js} |: Implements keyboard shortcuts -|: [url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/keyboard.js Link] +|: {url Link;https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/keyboard.js} |: 810B |: 40 -|: [url /scripts/snow.js snow.js] +|: {url snow.js;/scripts/snow.js} |: Adds and manages falling snowflakes. Functional only in December and January. -|: [url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/snow.js Link] +|: {url Link;https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/snow.js} |: 814B |: 36 -|: [url /scripts/snow-preload.js snow-preload.js] +|: {url snow-preload.js;/scripts/snow-preload.js} |: Initializes falling snowflake elements -|: [url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/snow-preload.js Link] +|: {url Link;https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/snow-preload.js} |: 561B |: 20 @@ -86,32 +90,35 @@ Any user data that might be saved isn't, and never will be, used for purposes no |: 413 + ## Data in browser storage .p ### Local storage -:table_3 +:table +:3 |= Key |= Values |= Description -|: [`theme`] -|: [`dark`] | [`light`] +|: {` theme} +|: {` dark} | {` light} |: Saves which theme should be loaded -|: [`width`] -|: [`norm`] | [`wide`] +|: {` width} +|: {` norm} | {` wide} |: Saves in which width pages should be shown -|: [`navbar`] -|: [`norm`] | [`hidden`] +|: {` navbar} +|: {` norm} | {` hidden} |: Saves whether the navbar should be expanded or shrunk -|: [`snow`] -|: [`on`] | [`off`] +|: {` snow} +|: {` on} | {` off} |: Saves whether snowflakes are shown (and animated). Functional only in December and January. + .p diff --git a/src/rework.du b/src/rework.du index 752843c..be9a32f 100644 --- a/src/rework.du +++ b/src/rework.du @@ -1,5 +1,8 @@ +'def title Due for rework +'def desc Page is due for a rework! + # Rework -Pages that have the message [url ./rework.html [=Due for Rework=]] are in some form [=outdated=]. They might have bad formatting, bad wording, contain outdated information or something else is wrong with them. +Pages that have the message {url {b Due for Rework};./rework.html} are in some form {b outdated}. They might have bad formatting, bad wording, contain outdated information or something else is wrong with them. -In any case, [=these pages shouldn't be taken at face value, as they will be updated and fixed soon enough=]. +In any case, {b these pages shouldn't be taken at face value, as they will be updated and fixed soon enough}. diff --git a/src/setup.du b/src/setup.du index 1e48a96..754f5a1 100644 --- a/src/setup.du +++ b/src/setup.du @@ -1,11 +1,15 @@ -# Setup +'def title Setup +'def desc Hardware and software setups I have or have had. + +# {title} Everyone that is really interested in technology has custom configurations for everything they use. Here are mine. ## Hardware I own -:table_6 +:table +:6 |= Designation |= OS |= Motherboard / device @@ -16,29 +20,29 @@ Here are mine. |: Main desktop tower |: NixOS (24.11) |: ASRock B550 Phantom Gaming 4 -|: [url https://www.amd.com/en/products/processors/desktops/ryzen/5000-series/amd-ryzen-9-5900x.html AMD Ryzen 9 5900X] -|: [url https://www.amd.com/en/products/graphics/desktops/radeon/6000-series/amd-radeon-rx-6800-xt.html AMD Radeon RX 6800 XT] +|: {url AMD Ryzen 9 5900X;https://www.amd.com/en/products/processors/desktops/ryzen/5000-series/amd-ryzen-9-5900x.html} +|: {url AMD Radeon RX 6800 XT;https://www.amd.com/en/products/graphics/desktops/radeon/6000-series/amd-radeon-rx-6800-xt.html} |: 1x Corsair CMK32GX4M2E3200C16 |: |: |: Bought: 2024 -|: [url https://www.cpubenchmark.net/cpu.php?cpu=AMD+Ryzen+9+5900X&id=3870 39125 mark], 12 cores, 24 threads, 3.70 GHz, L1: 768 KB, L2: 6 MB, L3: 64 MB, 64-bit -|: [url https://www.videocardbenchmark.net/gpu.php?gpu=Radeon+RX+6800+XT&id=4312 25027 mark], 2000 MHz, 16 GB memory +|: {url 39125 mark;https://www.cpubenchmark.net/cpu.php?cpu=AMD+Ryzen+9+5900X&id=3870}, 12 cores, 24 threads, 3.70 GHz, L1: 768 KB, L2: 6 MB, L3: 64 MB, 64-bit +|: {url 25027 mark;https://www.videocardbenchmark.net/gpu.php?gpu=Radeon+RX+6800+XT&id=4312}, 2000 MHz, 16 GB memory |: DDR4, 32 GB (2x 16GB), 3200 MHz |: Old desktop tower |: NixOS (24.05) |: ASRock Z97 Anniversary -|: [url https://www.intel.com/content/www/us/en/products/sku/77488/intel-core-i34160-processor-3m-cache-3-60-ghz/specifications.html Intel Core i3-4160] +|: {url Intel Core i3-4160;https://www.intel.com/content/www/us/en/products/sku/77488/intel-core-i34160-processor-3m-cache-3-60-ghz/specifications.html} |: AMD Sapphire Radeon R7 265 |: 2x Corsair CMV8GX3M1A1600C11 |: |: |: Bought: 2015 -|: [url https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i3-4160+%40+3.60GHz&id=2317 3510 mark], 2 cores, 4 threads, 3.60 GHz, L1: 128 KB, L2: 512 KB, L3: 3 MB, 64-bit -|: [url https://www.videocardbenchmark.net/gpu.php?gpu=Radeon+HD+7850&id=323 3849 mark], 900 MHz, 2 GB memory +|: {url 3510 mark;https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i3-4160+%40+3.60GHz&id=2317}, 2 cores, 4 threads, 3.60 GHz, L1: 128 KB, L2: 512 KB, L3: 3 MB, 64-bit +|: {url 3849 mark;https://www.videocardbenchmark.net/gpu.php?gpu=Radeon+HD+7850&id=323}, 900 MHz, 2 GB memory |: DDR3, 16 GB (2x 8GB), 1600 MHz |: Main laptop @@ -51,8 +55,8 @@ Here are mine. |: |: |: Bought: 2023\nReleased: 2017 -|: [url https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i5-6300U+%40+2.40GHz&id=2609 3240 mark], 2 cores, 4 threads, 2.40 GHz, L1: 128 KB, L2: 512 KB, L3: 3 MB, 64-bit -|: [url https://www.videocardbenchmark.net/gpu.php?gpu=Intel+HD+520&id=3255 871 mark], 300 MHz +|: {url 3240 mark;https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i5-6300U+%40+2.40GHz&id=2609}, 2 cores, 4 threads, 2.40 GHz, L1: 128 KB, L2: 512 KB, L3: 3 MB, 64-bit +|: {url 871 mark;https://www.videocardbenchmark.net/gpu.php?gpu=Intel+HD+520&id=3255}, 300 MHz |: DDR4, SODIMM, 16 GB, 2133 MHz |: Second laptop @@ -65,11 +69,12 @@ Here are mine. |: |: |: Bought: 2019\nReleased: 2018 -|: [url https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i7-8565U+%40+1.80GHz&id=3308 6152 mark], 4 cores, 8 threads, 4.60 GHz, L1: 128 KB, L2: 1 MB, L3: 8 MB, 64-bit -|: [url https://www.videocardbenchmark.net/gpu.php?gpu=Intel+UHD+Graphics+620&id=3805 1039 mark], 300 MHz +|: {url 6152 mark;https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i7-8565U+%40+1.80GHz&id=3308}, 4 cores, 8 threads, 4.60 GHz, L1: 128 KB, L2: 1 MB, L3: 8 MB, 64-bit +|: {url 1039 mark;https://www.videocardbenchmark.net/gpu.php?gpu=Intel+UHD+Graphics+620&id=3805}, 300 MHz |: LPDDR3 (soldered), 16 GB, 2133 MHz + .comment |: Main smartphone |: Fresh Android ROM @@ -91,44 +96,45 @@ Here are mine. |: VPS |: ? -[*Yes, I stole the idea for this from [url https://hacktivis.me/about Haelwenn Monnier]*] +{i Yes, I stole the idea for this from {url Haelwenn Monnier;https://hacktivis.me/about}} ## OS setup -:table_3 +:table +:3 |= Distro |= Fully switched |= Configuration files/scripts -|: [=Desktop OS=] +|: {b Desktop OS} |: |: |: NixOS |: 11.2023 -|: [url https://gitlab.com/Syndamia/nix NixOS configuration] +|: {url NixOS configuration;https://gitlab.com/Syndamia/nix} |: Gentoo |: 03.2023 -|: [url https://gitlab.com/Syndamia/dotfiles/-/tree/main/.b/etc/portage portage configuration files], [url https://gitlab.com/Syndamia/application-setup/-/blob/main/gentoo/Makefile Installation Makefile] +|: {url portage configuration files;https://gitlab.com/Syndamia/dotfiles/-/tree/main/.b/etc/portage}, {url Installation Makefile;https://gitlab.com/Syndamia/application-setup/-/blob/main/gentoo/Makefile} |: Funtoo |: 12.2021 -|: [url https://gitlab.com/Syndamia/dotfiles/-/tree/ef18469c90c8e90d3db436a1a204aec5c92cac73/.b/etc/portage portage configuration files] +|: {url portage configuration files;https://gitlab.com/Syndamia/dotfiles/-/tree/ef18469c90c8e90d3db436a1a204aec5c92cac73/.b/etc/portage} |: Fedora 33-34 |: 12.2020 -|: [url https://gitlab.com/Syndamia/application-setup/-/blob/main/scratch-fedora-setup.sh Installation from Minimal], [url https://gitlab.com/Syndamia/application-setup/-/blob/main/fedora-setup.sh Installation from Cinnamon], [url https://gitlab.com/Syndamia/application-setup/-/tree/main/cinnamon-setup Cinnamon setup], [url https://gitlab.com/Syndamia/dotfiles/-/blob/main/.c/fedora-openbox.sh openbox setup] +|: {url Installation from Minimal;https://gitlab.com/Syndamia/application-setup/-/blob/main/scratch-fedora-setup.sh}, {url Installation from Cinnamon;https://gitlab.com/Syndamia/application-setup/-/blob/main/fedora-setup.sh}, {url Cinnamon setup;https://gitlab.com/Syndamia/application-setup/-/tree/main/cinnamon-setup}, {url openbox setup;https://gitlab.com/Syndamia/dotfiles/-/blob/main/.c/fedora-openbox.sh} |: Linux Mint 19.3-20 |: 01.2020 -|: [url https://gitlab.com/Syndamia/application-setup/-/blob/main/linux-mint-setup.sh Installation script], [url https://gitlab.com/Syndamia/application-setup/-/tree/main/cinnamon-setup Cinnamon setup] +|: {url Installation script;https://gitlab.com/Syndamia/application-setup/-/blob/main/linux-mint-setup.sh}, {url Cinnamon setup;https://gitlab.com/Syndamia/application-setup/-/tree/main/cinnamon-setup} |: Manjaro Cinnamon 18.1.4-18.1.5 |: 12.2019 |: - -|: [=Server OS=] +|: {b Server OS} |: |: @@ -141,48 +147,52 @@ Here are mine. |: - -[url https://gitlab.com/Syndamia/dotfiles Dotfiles here]. -Primary shell is [url https://www.zsh.org/ zsh]. + +{url Dotfiles here;https://gitlab.com/Syndamia/dotfiles}. +Primary shell is {url zsh;https://www.zsh.org/}. ### Desktop environment -:table_3 +:table +:3 |= Name |= Fully switched |= List of apps -|: [url http://openbox.org/wiki/Main_Page openbox wm] + custom apps +|: {url openbox wm;http://openbox.org/wiki/Main_Page} + custom apps |: 06.2021 -|: [url https://gitlab.com/Syndamia/dotfiles/-/blob/main/.c/Application%20Stack.md Application Stack] +|: {url Application Stack;https://gitlab.com/Syndamia/dotfiles/-/blob/main/.c/Application%20Stack.md} -|: [url https://projects.linuxmint.com/cinnamon/ Cinnamon] +|: {url Cinnamon;https://projects.linuxmint.com/cinnamon/} |: 12.2019 |: - + ## Text editor -:table_3 +:table +:3 |= Name |= Fully switched |= Configuration files -|: [url https://neovim.io/ neovim] +|: {url neovim;https://neovim.io/} |: 08.2024 -|: [url https://gitlab.com/Syndamia/anderson/ anderson] +|: {url anderson;https://gitlab.com/Syndamia/anderson/} -|: [url https://www.vim.org/ vim] +|: {url vim;https://www.vim.org/} |: 10.2020 -|: [url https://gitlab.com/Syndamia/dotfiles/-/tree/main/.vim dotfiles] +|: {url dotfiles;https://gitlab.com/Syndamia/dotfiles/-/tree/main/.vim} -|: [url https://en.wikipedia.org/wiki/Atom_%28text_editor%29 Atom] +|: {url Atom;https://en.wikipedia.org/wiki/Atom_%28text_editor%29} |: 05.2020 - 07.2020 |: Switched back after -|: [url https://www.monodevelop.com/ Monodevelop] +|: {url Monodevelop;https://www.monodevelop.com/} |: 01.2020 |: - -|: [url https://visualstudio.microsoft.com/ Visual Studio 2017] +|: {url Visual Studio 2017;https://visualstudio.microsoft.com/} |: 11.2018 |: - diff --git a/src/setup/index.du b/src/setup/index.du index 1e48a96..754f5a1 100644 --- a/src/setup/index.du +++ b/src/setup/index.du @@ -1,11 +1,15 @@ -# Setup +'def title Setup +'def desc Hardware and software setups I have or have had. + +# {title} Everyone that is really interested in technology has custom configurations for everything they use. Here are mine. ## Hardware I own -:table_6 +:table +:6 |= Designation |= OS |= Motherboard / device @@ -16,29 +20,29 @@ Here are mine. |: Main desktop tower |: NixOS (24.11) |: ASRock B550 Phantom Gaming 4 -|: [url https://www.amd.com/en/products/processors/desktops/ryzen/5000-series/amd-ryzen-9-5900x.html AMD Ryzen 9 5900X] -|: [url https://www.amd.com/en/products/graphics/desktops/radeon/6000-series/amd-radeon-rx-6800-xt.html AMD Radeon RX 6800 XT] +|: {url AMD Ryzen 9 5900X;https://www.amd.com/en/products/processors/desktops/ryzen/5000-series/amd-ryzen-9-5900x.html} +|: {url AMD Radeon RX 6800 XT;https://www.amd.com/en/products/graphics/desktops/radeon/6000-series/amd-radeon-rx-6800-xt.html} |: 1x Corsair CMK32GX4M2E3200C16 |: |: |: Bought: 2024 -|: [url https://www.cpubenchmark.net/cpu.php?cpu=AMD+Ryzen+9+5900X&id=3870 39125 mark], 12 cores, 24 threads, 3.70 GHz, L1: 768 KB, L2: 6 MB, L3: 64 MB, 64-bit -|: [url https://www.videocardbenchmark.net/gpu.php?gpu=Radeon+RX+6800+XT&id=4312 25027 mark], 2000 MHz, 16 GB memory +|: {url 39125 mark;https://www.cpubenchmark.net/cpu.php?cpu=AMD+Ryzen+9+5900X&id=3870}, 12 cores, 24 threads, 3.70 GHz, L1: 768 KB, L2: 6 MB, L3: 64 MB, 64-bit +|: {url 25027 mark;https://www.videocardbenchmark.net/gpu.php?gpu=Radeon+RX+6800+XT&id=4312}, 2000 MHz, 16 GB memory |: DDR4, 32 GB (2x 16GB), 3200 MHz |: Old desktop tower |: NixOS (24.05) |: ASRock Z97 Anniversary -|: [url https://www.intel.com/content/www/us/en/products/sku/77488/intel-core-i34160-processor-3m-cache-3-60-ghz/specifications.html Intel Core i3-4160] +|: {url Intel Core i3-4160;https://www.intel.com/content/www/us/en/products/sku/77488/intel-core-i34160-processor-3m-cache-3-60-ghz/specifications.html} |: AMD Sapphire Radeon R7 265 |: 2x Corsair CMV8GX3M1A1600C11 |: |: |: Bought: 2015 -|: [url https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i3-4160+%40+3.60GHz&id=2317 3510 mark], 2 cores, 4 threads, 3.60 GHz, L1: 128 KB, L2: 512 KB, L3: 3 MB, 64-bit -|: [url https://www.videocardbenchmark.net/gpu.php?gpu=Radeon+HD+7850&id=323 3849 mark], 900 MHz, 2 GB memory +|: {url 3510 mark;https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i3-4160+%40+3.60GHz&id=2317}, 2 cores, 4 threads, 3.60 GHz, L1: 128 KB, L2: 512 KB, L3: 3 MB, 64-bit +|: {url 3849 mark;https://www.videocardbenchmark.net/gpu.php?gpu=Radeon+HD+7850&id=323}, 900 MHz, 2 GB memory |: DDR3, 16 GB (2x 8GB), 1600 MHz |: Main laptop @@ -51,8 +55,8 @@ Here are mine. |: |: |: Bought: 2023\nReleased: 2017 -|: [url https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i5-6300U+%40+2.40GHz&id=2609 3240 mark], 2 cores, 4 threads, 2.40 GHz, L1: 128 KB, L2: 512 KB, L3: 3 MB, 64-bit -|: [url https://www.videocardbenchmark.net/gpu.php?gpu=Intel+HD+520&id=3255 871 mark], 300 MHz +|: {url 3240 mark;https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i5-6300U+%40+2.40GHz&id=2609}, 2 cores, 4 threads, 2.40 GHz, L1: 128 KB, L2: 512 KB, L3: 3 MB, 64-bit +|: {url 871 mark;https://www.videocardbenchmark.net/gpu.php?gpu=Intel+HD+520&id=3255}, 300 MHz |: DDR4, SODIMM, 16 GB, 2133 MHz |: Second laptop @@ -65,11 +69,12 @@ Here are mine. |: |: |: Bought: 2019\nReleased: 2018 -|: [url https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i7-8565U+%40+1.80GHz&id=3308 6152 mark], 4 cores, 8 threads, 4.60 GHz, L1: 128 KB, L2: 1 MB, L3: 8 MB, 64-bit -|: [url https://www.videocardbenchmark.net/gpu.php?gpu=Intel+UHD+Graphics+620&id=3805 1039 mark], 300 MHz +|: {url 6152 mark;https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i7-8565U+%40+1.80GHz&id=3308}, 4 cores, 8 threads, 4.60 GHz, L1: 128 KB, L2: 1 MB, L3: 8 MB, 64-bit +|: {url 1039 mark;https://www.videocardbenchmark.net/gpu.php?gpu=Intel+UHD+Graphics+620&id=3805}, 300 MHz |: LPDDR3 (soldered), 16 GB, 2133 MHz + .comment |: Main smartphone |: Fresh Android ROM @@ -91,44 +96,45 @@ Here are mine. |: VPS |: ? -[*Yes, I stole the idea for this from [url https://hacktivis.me/about Haelwenn Monnier]*] +{i Yes, I stole the idea for this from {url Haelwenn Monnier;https://hacktivis.me/about}} ## OS setup -:table_3 +:table +:3 |= Distro |= Fully switched |= Configuration files/scripts -|: [=Desktop OS=] +|: {b Desktop OS} |: |: |: NixOS |: 11.2023 -|: [url https://gitlab.com/Syndamia/nix NixOS configuration] +|: {url NixOS configuration;https://gitlab.com/Syndamia/nix} |: Gentoo |: 03.2023 -|: [url https://gitlab.com/Syndamia/dotfiles/-/tree/main/.b/etc/portage portage configuration files], [url https://gitlab.com/Syndamia/application-setup/-/blob/main/gentoo/Makefile Installation Makefile] +|: {url portage configuration files;https://gitlab.com/Syndamia/dotfiles/-/tree/main/.b/etc/portage}, {url Installation Makefile;https://gitlab.com/Syndamia/application-setup/-/blob/main/gentoo/Makefile} |: Funtoo |: 12.2021 -|: [url https://gitlab.com/Syndamia/dotfiles/-/tree/ef18469c90c8e90d3db436a1a204aec5c92cac73/.b/etc/portage portage configuration files] +|: {url portage configuration files;https://gitlab.com/Syndamia/dotfiles/-/tree/ef18469c90c8e90d3db436a1a204aec5c92cac73/.b/etc/portage} |: Fedora 33-34 |: 12.2020 -|: [url https://gitlab.com/Syndamia/application-setup/-/blob/main/scratch-fedora-setup.sh Installation from Minimal], [url https://gitlab.com/Syndamia/application-setup/-/blob/main/fedora-setup.sh Installation from Cinnamon], [url https://gitlab.com/Syndamia/application-setup/-/tree/main/cinnamon-setup Cinnamon setup], [url https://gitlab.com/Syndamia/dotfiles/-/blob/main/.c/fedora-openbox.sh openbox setup] +|: {url Installation from Minimal;https://gitlab.com/Syndamia/application-setup/-/blob/main/scratch-fedora-setup.sh}, {url Installation from Cinnamon;https://gitlab.com/Syndamia/application-setup/-/blob/main/fedora-setup.sh}, {url Cinnamon setup;https://gitlab.com/Syndamia/application-setup/-/tree/main/cinnamon-setup}, {url openbox setup;https://gitlab.com/Syndamia/dotfiles/-/blob/main/.c/fedora-openbox.sh} |: Linux Mint 19.3-20 |: 01.2020 -|: [url https://gitlab.com/Syndamia/application-setup/-/blob/main/linux-mint-setup.sh Installation script], [url https://gitlab.com/Syndamia/application-setup/-/tree/main/cinnamon-setup Cinnamon setup] +|: {url Installation script;https://gitlab.com/Syndamia/application-setup/-/blob/main/linux-mint-setup.sh}, {url Cinnamon setup;https://gitlab.com/Syndamia/application-setup/-/tree/main/cinnamon-setup} |: Manjaro Cinnamon 18.1.4-18.1.5 |: 12.2019 |: - -|: [=Server OS=] +|: {b Server OS} |: |: @@ -141,48 +147,52 @@ Here are mine. |: - -[url https://gitlab.com/Syndamia/dotfiles Dotfiles here]. -Primary shell is [url https://www.zsh.org/ zsh]. + +{url Dotfiles here;https://gitlab.com/Syndamia/dotfiles}. +Primary shell is {url zsh;https://www.zsh.org/}. ### Desktop environment -:table_3 +:table +:3 |= Name |= Fully switched |= List of apps -|: [url http://openbox.org/wiki/Main_Page openbox wm] + custom apps +|: {url openbox wm;http://openbox.org/wiki/Main_Page} + custom apps |: 06.2021 -|: [url https://gitlab.com/Syndamia/dotfiles/-/blob/main/.c/Application%20Stack.md Application Stack] +|: {url Application Stack;https://gitlab.com/Syndamia/dotfiles/-/blob/main/.c/Application%20Stack.md} -|: [url https://projects.linuxmint.com/cinnamon/ Cinnamon] +|: {url Cinnamon;https://projects.linuxmint.com/cinnamon/} |: 12.2019 |: - + ## Text editor -:table_3 +:table +:3 |= Name |= Fully switched |= Configuration files -|: [url https://neovim.io/ neovim] +|: {url neovim;https://neovim.io/} |: 08.2024 -|: [url https://gitlab.com/Syndamia/anderson/ anderson] +|: {url anderson;https://gitlab.com/Syndamia/anderson/} -|: [url https://www.vim.org/ vim] +|: {url vim;https://www.vim.org/} |: 10.2020 -|: [url https://gitlab.com/Syndamia/dotfiles/-/tree/main/.vim dotfiles] +|: {url dotfiles;https://gitlab.com/Syndamia/dotfiles/-/tree/main/.vim} -|: [url https://en.wikipedia.org/wiki/Atom_%28text_editor%29 Atom] +|: {url Atom;https://en.wikipedia.org/wiki/Atom_%28text_editor%29} |: 05.2020 - 07.2020 |: Switched back after -|: [url https://www.monodevelop.com/ Monodevelop] +|: {url Monodevelop;https://www.monodevelop.com/} |: 01.2020 |: - -|: [url https://visualstudio.microsoft.com/ Visual Studio 2017] +|: {url Visual Studio 2017;https://visualstudio.microsoft.com/} |: 11.2018 |: - diff --git a/src/slides.du b/src/slides.du index d91775c..1adae74 100644 --- a/src/slides.du +++ b/src/slides.du @@ -1,17 +1,20 @@ -# Slides +'def title Slides +'def desc Slides from presentations I've made + +# {title} These are the different presentations I've made and possibly presented. \n -#### [*2023*] +#### {i 2023} .defs -; [$gb] 19 Jan   [url ./linuxgraphy-by-strabo Linuxgraphy by Strabo]   [*Last presented: 22.01.2023*] +; {gb} 19 Jan   {url Linuxgraphy by Strabo;./linuxgraphy-by-strabo}   {i Last presented: 22.01.2023} : A presentation talking about some of the history of UNIX and how Linux works -#### [*2022*] +#### {i 2022} .defs -; [$gb] 27 Sep   [url ./demo Demo presentation]   [*Won't be presented*] +; {gb} 27 Sep   {url Demo presentation;./demo}   {i Won't be presented} : Showcase of my presentation system diff --git a/src/slides/demo/index.du b/src/slides/demo/index.du index cdad5f4..a12d808 100644 --- a/src/slides/demo/index.du +++ b/src/slides/demo/index.du @@ -1,40 +1,41 @@ -# Demo presentation +'def title Demo +'def desc Small presentation, showcasing my costom presentation system -'define expected-reading 6 min -'define created 27 September 2022 -'define edited 22 February 2023 -[$pagenav] +# {title} + +{pagenav 6 min;27 September 2022;22 February 2023} This is a small presentation, explaining how my custom system for making presentations works. .important -This page is [url /rework.html due for rework], I've switched to dunbar from ftags (and MEL) +This page is {url due for rework;/rework.html}, I've switched to dunbar from ftags (and MEL) -[$presentation-controller] +{presentation-controller} :title_slide35 # My presentation system -.font18 [*Syndamia AT [url https://syndamia.com syndamia.com]*] +.font18 {i Syndamia AT {url syndamia.com;https://syndamia.com}} .p -Before we go any further, click the [=icon in the middle=] right above this rectangle, to the left. +Before we go any further, click the {b icon in the middle} right above this rectangle, to the left. .p Now the presentation should fill out the entire page. On the bottom right are your controls. .p -Press the [*right arrow*] in the controls to go to the next slide. +Press the {i right arrow} in the controls to go to the next slide. :slide27 # Key bindings -[$br3] +{br3} -:table_2 +:table +:2 |= Action |= Keyboard keys @@ -58,24 +59,25 @@ Press the [*right arrow*] in the controls to go to the next slide. + :slide # Introduction -[$br1] +{br1} .p I created a simple system for making presentations with slides in them. -The gist of it is: different [url https://en.wikipedia.org/wiki/Markdown Markdown] paragraphs are put into a rectangle, each rectangle representing a slide, with some added options for layout and format. +The gist of it is: different {url Markdown;https://en.wikipedia.org/wiki/Markdown} paragraphs are put into a rectangle, each rectangle representing a slide, with some added options for layout and format. ## ftags .p -An ftag ([url https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/awk-edits#ftags "format tag"]) is what I call a short string of characters, that starts with two ampersands (&&). -Each ftag is a "marker" that gets replaced by some other text (usually [url https://en.wikipedia.org/wiki/HTML HTML tags]). +An ftag ({url "format tag";https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/awk-edits#ftags}) is what I call a short string of characters, that starts with two ampersands (&&). +Each ftag is a "marker" that gets replaced by some other text (usually {url HTML tags;https://en.wikipedia.org/wiki/HTML}). .p -An easy example is the image of the Great Britain flag (part of [url https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/awk-edits/Flags.awk Flags.awk], not the presentation system!): typing out &&GB (in lowecase), gets replaced by the actual image - &&gb. +An easy example is the image of the Great Britain flag (part of {url Flags.awk;https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/awk-edits/Flags.awk}, not the presentation system!): typing out &&GB (in lowecase), gets replaced by the actual image - &&gb. :slide @@ -89,11 +91,11 @@ An easy example is the image of the Great Britain flag (part of [url https://git - Ideally, the system would be made well enough that creating a presentation would be significantly faster than with one of those. - Making my own system means I can tailor it to my needs and preferences. - Looking around other [url https://gist.github.com/vasilisvg/1611562 HTML-based presentation tools]: + Looking around other {url HTML-based presentation tools;https://gist.github.com/vasilisvg/1611562}: .bulleted - - [url https://revealjs.com/ reveal.js] is way too heavy and fancy for my needs (animations are nice, but I'm fine going without them) - - [url https://paulrouget.com/dzslides/ DZSlides] and [url https://meyerweb.com/eric/tools/s5/ S5] are really nice, however both are HTML-centric, and I want my slides to be written in Markdown. + - {url reveal.js;https://revealjs.com/} is way too heavy and fancy for my needs (animations are nice, but I'm fine going without them) + - {url DZSlides;https://paulrouget.com/dzslides/} and {url S5;https://meyerweb.com/eric/tools/s5/} are really nice, however both are HTML-centric, and I want my slides to be written in Markdown. Creating ftags that are transformed to DZSlide HTML is possible, but at that point I should just make my own system. - and pretty much everything else falls into either category @@ -104,13 +106,13 @@ An easy example is the image of the Great Britain flag (part of [url https://git # Formatting .p -Every (presentation-specific) ftag is listed and explained in [url https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/awk-edits/Presentation.awk Presentation.awk]. -To summarize, each slide is wrapped in [`&&slide`] and [`&&/slide`] (or [`&&clide`] and [`&&/clide`]), you can change font size for specific portions, you can add basic (without formatting) tables for fancy layout, you can align text and elements and you can add line breaks. +Every (presentation-specific) ftag is listed and explained in {url Presentation.awk;https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/awk-edits/Presentation.awk}. +To summarize, each slide is wrapped in {` &&slide} and {` &&/slide} (or {` &&clide} and {` &&/clide}), you can change font size for specific portions, you can add basic (without formatting) tables for fancy layout, you can align text and elements and you can add line breaks. .p And they can work together in most different combination. -[$br1] +{br1} .p Though, remember that everything gets translated to HTML, so don't do (even if it works) @@ -136,16 +138,16 @@ Font-size 30px (default) .font35 Font-size 35px -[$br5] +{br5} .fright This text is floated to the right -[$br2] +{br2} .centered While this one is centered -[$br2] +{br2} .fright Floated right\nFloated right\nFloated right @@ -159,7 +161,8 @@ Maybe this should be changed? .p The source Markdown for the predvious slide is: -```dunbar +'def LANG dunbar +``` 'snippet 125 156 ./index.du @@ -174,19 +177,19 @@ The source Markdown for the predvious slide is: - List Element 1 - List Element 2 - [$newrow] + {newrow} .p - [=any=] sort of content + {b any} sort of content -[$br1] +{br1} :sqrow .p So you can very easily put images next to your text - .centered [image /blog/fix-no-frame-buffer-plan9/img/rio-default-login.png] + .centered {img /blog/fix-no-frame-buffer-plan9/img/rio-default-login.png} @@ -195,7 +198,8 @@ The source Markdown for the predvious slide is: .p The source Markdown for the predvious slide is: -```dunbar +'def LANG dunbar +``` 'snippet 166 192 ./index.du @@ -209,16 +213,16 @@ You can also print very easily the whole presentation on A4 sheets of paper, sin .p Pretty much all other website functionalities, like themes and click-to-zoom images, aren't inhibited. -The slides are easily scrollable/browseable and if you don't have JavaScript enabled, everything will be shown as a normal(-ish) article, without any [*major*] styling issues. +The slides are easily scrollable/browseable and if you don't have JavaScript enabled, everything will be shown as a normal(-ish) article, without any {i major} styling issues. ## Setup .p -Everything is contained in 3 files: [url https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/awk-edits/Presentation.awk Presentation.awk], [url https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/src/scripts/presentation.js presentation.js] and [url https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/src/presentation.css presentation.css], which pretty much work on your "compiled" HTML. +Everything is contained in 3 files: {url Presentation.awk;https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/awk-edits/Presentation.awk}, {url presentation.js;https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/src/scripts/presentation.js} and {url presentation.css;https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/src/presentation.css}, which pretty much work on your "compiled" HTML. .p -[`Presentation.awk`] handles replacement of ftags (only in [`/talks`] pages!). -[`presentation.js`] is inserted into the HTML by [`&&presentation`], and handles the navigation bar as well as insertion of [`presentation.css`] (the overall presentation-specific styling). +{` Presentation.awk} handles replacement of ftags (only in {` /talks} pages!). +{` presentation.js} is inserted into the HTML by {` &&presentation}, and handles the navigation bar as well as insertion of {` presentation.css} (the overall presentation-specific styling). :title_slide @@ -227,4 +231,4 @@ Everything is contained in 3 files: [url https://gitlab.com/Syndamia/syndamiadot .fright .font18 -[*P.S. Press the same button (next to the print button) with which you started presenting, to stop presenting ;)*] +{i P.S. Press the same button (next to the print button) with which you started presenting, to stop presenting ;)} diff --git a/src/slides/index.du b/src/slides/index.du index d91775c..1adae74 100644 --- a/src/slides/index.du +++ b/src/slides/index.du @@ -1,17 +1,20 @@ -# Slides +'def title Slides +'def desc Slides from presentations I've made + +# {title} These are the different presentations I've made and possibly presented. \n -#### [*2023*] +#### {i 2023} .defs -; [$gb] 19 Jan   [url ./linuxgraphy-by-strabo Linuxgraphy by Strabo]   [*Last presented: 22.01.2023*] +; {gb} 19 Jan   {url Linuxgraphy by Strabo;./linuxgraphy-by-strabo}   {i Last presented: 22.01.2023} : A presentation talking about some of the history of UNIX and how Linux works -#### [*2022*] +#### {i 2022} .defs -; [$gb] 27 Sep   [url ./demo Demo presentation]   [*Won't be presented*] +; {gb} 27 Sep   {url Demo presentation;./demo}   {i Won't be presented} : Showcase of my presentation system diff --git a/src/slides/linuxgraphy-by-strabo/index.du b/src/slides/linuxgraphy-by-strabo/index.du index 19d18c1..a2535b9 100644 --- a/src/slides/linuxgraphy-by-strabo/index.du +++ b/src/slides/linuxgraphy-by-strabo/index.du @@ -1,53 +1,53 @@ -# Linuxgraphy by Strabo +'def title Linuxgraphy by Strabo +'def desc A history and feature showcase of Linux-based distributions. + +# {title} -'define expected-reading 38 min -'define created 19 January 2023 -'define edited 04 March 2023 -[$pagenav] +{pagenav 38 min;19 January 2023;04 March 2023} ### Custom assets -[*Licensing information in the last slide, at the bottom of the page*] +{i Licensing information in the last slide, at the bottom of the page} .bulleted -- [url ./img/unix-layers.png UNIX layers image] -- [url ./img/unix-dir-tree.png UNIX directory tree] -- [url ./mll-set.sh mll-set.sh] +- {url UNIX layers image;./img/unix-layers.png} +- {url UNIX directory tree;./img/unix-dir-tree.png} +- {url mll-set.sh;./mll-set.sh} ### Presented at :defs -; [$bg] Unofficial [url https://fmi.uni-sofia.bg/en FMI] Computer Science Discord server   [*04.03.2023 || 14:50 - 17:20*] -: In front of a tiny audience of other uni students. Exact revision [url https://gitlab.com/Syndamia/syndamiadotcom/-/blob/6feed223ff48fe00cf12fcd63f3f56179c298cae/src/talks/linuxgraphy-by-strabo/index.md here]. +; {bg} Unofficial {url FMI;https://fmi.uni-sofia.bg/en} Computer Science Discord server   {i 04.03.2023 || 14:50 - 17:20} +: In front of a tiny audience of other uni students. Exact revision {url here;https://gitlab.com/Syndamia/syndamiadotcom/-/blob/6feed223ff48fe00cf12fcd63f3f56179c298cae/src/talks/linuxgraphy-by-strabo/index.md}. -; [$bg] Unofficial [url https://fmi.uni-sofia.bg/en FMI] Computer Science Discord server   [*22.01.2023 || 18:00 - 21:00*] -: In front of a tiny audience of other uni students. Exact revision [url https://gitlab.com/Syndamia/syndamiadotcom/-/blob/6eb7a8fff01c6814253a0e738efb53734d297be9/src/talks/linuxgraphy-by-strabo/index.md here]. +; {bg} Unofficial {url FMI;https://fmi.uni-sofia.bg/en} Computer Science Discord server   {i 22.01.2023 || 18:00 - 21:00} +: In front of a tiny audience of other uni students. Exact revision {url here;https://gitlab.com/Syndamia/syndamiadotcom/-/blob/6eb7a8fff01c6814253a0e738efb53734d297be9/src/talks/linuxgraphy-by-strabo/index.md}. -[$presentation-controller] +{presentation-controller} :title_slide # Linuxgraphy by Strabo -[*Made by [url https://syndamia.com Syndamia]*] +{i Made by {url Syndamia;https://syndamia.com}} -[$br4] +{br4} :sqrow - [$br1] + {br1} :font22 - 2000 years ago [url https://en.wikipedia.org/wiki/Strabo Strabo] published [url https://en.wikipedia.org/wiki/Geography Geography], in which he laid out the world as it was known to the Romans and Greeks. + 2000 years ago {url Strabo;https://en.wikipedia.org/wiki/Strabo} published {url Geography;https://en.wikipedia.org/wiki/Geography}, in which he laid out the world as it was known to the Romans and Greeks. - [$br1] + {br1} Today, I'll lay out Linux as it is known to me. - [image https://upload.wikimedia.org/wikipedia/commons/thumb/e/ed/Strabo.jpg/199px-Strabo.jpg] + {img https://upload.wikimedia.org/wikipedia/commons/thumb/e/ed/Strabo.jpg/199px-Strabo.jpg} - [$br1] + {br1} @@ -65,7 +65,7 @@ 2. UNIX-style file system 2. Kernel - [$br2] + {br2} 3. Linux from the inside .numbered @@ -88,7 +88,7 @@ 4. Desktop manager 6. War on distros - [$br4] + {br4} 7. Demos - virtual machine and setup from zero @@ -100,7 +100,7 @@ # 1. Historical context -[$br1] +{br1} #### 1945 - 1955 @@ -117,8 +117,8 @@ This process was labor intensive: a qualified operator loaded your program, dump Computers became faster, but a lot of time was spend on managing jobs. .p -[url https://en.wikipedia.org/wiki/Resident_monitor resident monitors]: very small programs, which always [*resided*] in memory, and [*monitored*] what the state of the current job was.\n -Jobs were loaded in series ([url https://en.wikipedia.org/wiki/Batch_processing batches]). +{url resident monitors;https://en.wikipedia.org/wiki/Resident_monitor}: very small programs, which always {i resided} in memory, and {i monitored} what the state of the current job was.\n +Jobs were loaded in series ({url batches;https://en.wikipedia.org/wiki/Batch_processing}). When the current job finished, memory would be dumped and the next one would automatically be loaded and started. @@ -126,14 +126,14 @@ When the current job finished, memory would be dumped and the next one would aut #### 1960s -[$br1] +{br1} .p Peripherals (tapes, punch cards, ...) were extremely slow.\n -[url https://en.wikipedia.org/wiki/Computer_multitasking#Multiprogramming Multiprogramming]: the current job is waiting for a peripheral, another job would be started. +{url Multiprogramming;https://en.wikipedia.org/wiki/Computer_multitasking#Multiprogramming}: the current job is waiting for a peripheral, another job would be started. .p -[url https://en.wikipedia.org/wiki/Sabre_%28travel_reservation_system%29 Travel reservation system] by American Airlines: where travel agents would search, price and book services. +{url Travel reservation system;https://en.wikipedia.org/wiki/Sabre_%28travel_reservation_system%29} by American Airlines: where travel agents would search, price and book services. A computer system now had to support: .bulleted @@ -142,10 +142,10 @@ A computer system now had to support: - Storage organization, also following the rise of disks - Data communication links (often phone lines) -[$br1] +{br1} .p -More and more business started using computers, thanks to [url https://en.wikipedia.org/wiki/Minicomputer minicomputers], so demand for OS software increased. +More and more business started using computers, thanks to {url minicomputers;https://en.wikipedia.org/wiki/Minicomputer}, so demand for OS software increased. :slide @@ -153,27 +153,27 @@ More and more business started using computers, thanks to [url https://en.wikipe #### 1964 - 1969 .p -IBM's [url https://en.wikipedia.org/wiki/IBM_System/360 System/360] line of computers, each with expansion capabilities, backwards compatibility, all under one instruction set and operating system. +IBM's {url System/360;https://en.wikipedia.org/wiki/IBM_System/360} line of computers, each with expansion capabilities, backwards compatibility, all under one instruction set and operating system. .p -[url https://en.wikipedia.org/wiki/Multics Multics], an influential operating system that was designed for a General Electric mainframe. +{url Multics;https://en.wikipedia.org/wiki/Multics}, an influential operating system that was designed for a General Electric mainframe. Some of it's novel ideas include, but are not limited to: :bulleted -- [url https://en.wikipedia.org/wiki/Time-sharing Time-sharing]: +- {url Time-sharing;https://en.wikipedia.org/wiki/Time-sharing}: sharing resources of a singular machine among many users - (via [url https://en.wikipedia.org/wiki/Multiprogramming multiprogramming] and [url https://en.wikipedia.org/wiki/Computer_multitasking multi-tasking]) + (via {url multiprogramming;https://en.wikipedia.org/wiki/Multiprogramming} and {url multi-tasking;https://en.wikipedia.org/wiki/Computer_multitasking}) -- [url https://en.wikipedia.org/wiki/Single-level_store Single level store] (aka [url https://en.wikipedia.org/wiki/Virtual_memory virtual memory]): +- {url Single level store;https://en.wikipedia.org/wiki/Single-level_store} (aka {url virtual memory;https://en.wikipedia.org/wiki/Virtual_memory}): Processes would write into contiguous memory, but in reality it is scattered and managed by the operating system. -- [url https://en.wikipedia.org/wiki/Protection_ring Protection rings]: +- {url Protection rings;https://en.wikipedia.org/wiki/Protection_ring}: Allowing different levels of access to different resources (programs). - In general, this also often requires a [url https://en.wikipedia.org/wiki/Protected_mode CPU protected mode]. + In general, this also often requires a {url CPU protected mode;https://en.wikipedia.org/wiki/Protected_mode}. -- [url https://en.wikipedia.org/wiki/Directory_%28computing%29 Hierarchical file system]: +- {url Hierarchical file system;https://en.wikipedia.org/wiki/Directory_%28computing%29}: Arbitrary directories with subdirectories, rather than just having files next to each other or having directories which could only contain files. -- [url https://en.wikipedia.org/wiki/Shell_%28computing%29 Command processor] (that is separated from the OS): +- {url Command processor;https://en.wikipedia.org/wiki/Shell_%28computing%29} (that is separated from the OS): More on that later @@ -184,21 +184,21 @@ Some of it's novel ideas include, but are not limited to: .p Ultimately Multics grew too large, becoming unusable and unmaintainable.\n -In the beginning, programming was done mostly by [url https://en.wikipedia.org/wiki/Bell_Labs Bell Labs], with [url https://en.wikipedia.org/wiki/Ken_Thompson Ken Thompson] being one of the developers. +In the beginning, programming was done mostly by {url Bell Labs;https://en.wikipedia.org/wiki/Bell_Labs}, with {url Ken Thompson;https://en.wikipedia.org/wiki/Ken_Thompson} being one of the developers. -[$br1] +{br1} :sqrow .font18 - [image https://upload.wikimedia.org/wikipedia/commons/f/f8/Ken-Thompson-2019.png]\n - [*Ken Thompson image by National Inventors Hall of Fame*] - [image https://upload.wikimedia.org/wikipedia/commons/1/1b/Ken_Thompson_and_Dennis_Ritchie--1973.jpg ]\n - [*Ken Thompson and Dennis Ritchie in 1973*] + {img https://upload.wikimedia.org/wikipedia/commons/f/f8/Ken-Thompson-2019.png}\n + {i Ken Thompson image by National Inventors Hall of Fame} + {img ;https://upload.wikimedia.org/wikipedia/commons/1/1b/Ken_Thompson_and_Dennis_Ritchie--1973.jpg}\n + {i Ken Thompson and Dennis Ritchie in 1973} :column .p Thompson still had some desire to work on operating systems, after Bell Labs pulled out. - The tools he made while rewriting [url https://en.wikipedia.org/wiki/Space_Travel_%28video_game%29 his own video game] on a PDP-7 lead to a whole operating system: UNIX. + The tools he made while rewriting {url his own video game;https://en.wikipedia.org/wiki/Space_Travel_%28video_game%29} on a PDP-7 lead to a whole operating system: UNIX. .p Based, expanded on and improved upon many of Multic's ideas, UNIX became the father of modern OSs. @@ -211,38 +211,38 @@ In the beginning, programming was done mostly by [url https://en.wikipedia.org/w # 2. Structure of UNIX-likes .p -Ignoring [url https://unix.stackexchange.com/questions/14368/difference-between-posix-single-unix-specification-and-open-group-base-specifi/14415 standards] and [url https://unix.stackexchange.com/questions/87686/what-makes-an-operating-system-unix-like specifications], in my opinion, from the point of a user, a UNIX-like OS has the following components: +Ignoring {url standards;https://unix.stackexchange.com/questions/14368/difference-between-posix-single-unix-specification-and-open-group-base-specifi/14415} and {url specifications;https://unix.stackexchange.com/questions/87686/what-makes-an-operating-system-unix-like}, in my opinion, from the point of a user, a UNIX-like OS has the following components: -[$br2] +{br2} .ordered -1. [=shell=]: A programmable replaceable command-line interpreter, with utilities for managing the whole system and support for pipelines and I/O redirection -2. [=UNIX-style file system=]: [url https://en.wikipedia.org/wiki/Unix_filesystem Filesystem] as a single rooted tree, objects (nodes) in the file system are [url https://en.wikipedia.org/wiki/Inode inodes] and an inode can be [url https://en.wikipedia.org/wiki/Unix_file_types (at least)] either a regular file, directory or devices. Permissions per users and group. -3. [=kernel=]: Program that manages all communication and operations between the hardware and software +1. {b shell}: A programmable replaceable command-line interpreter, with utilities for managing the whole system and support for pipelines and I/O redirection +2. {b UNIX-style file system}: {url Filesystem;https://en.wikipedia.org/wiki/Unix_filesystem} as a single rooted tree, objects (nodes) in the file system are {url inodes;https://en.wikipedia.org/wiki/Inode} and an inode can be {url (at least);https://en.wikipedia.org/wiki/Unix_file_types} either a regular file, directory or devices. Permissions per users and group. +3. {b kernel}: Program that manages all communication and operations between the hardware and software -[$br2] +{br2} -.font18 [*For now we'll generally just look over some of the common stuff and go into detail later, while in Linux.*] +.font18 {i For now we'll generally just look over some of the common stuff and go into detail later, while in Linux.} :slide35 ## 2.1. shell -[$br1] +{br1} :sqrow :column - The operating system is divided into layers, [url https://youtu.be/-FtCTW2rVFM?t=57 like an onion].\n + The operating system is divided into layers, {url like an onion;https://youtu.be/-FtCTW2rVFM?t=57}.\n Only the kernel has access to the hardware.\n shells and executables (binaries) have access to the kernel. .p - shells provide user interfaces, [url http://en.wikipedia.org/wiki/Shell_%28computing%29 both] command-line and graphical. + shells provide user interfaces, {url both;http://en.wikipedia.org/wiki/Shell_%28computing%29} command-line and graphical. While on the topic of UNIX, we'll only discuss the former. - .centered [image ./img/unix-layers.png] + .centered {img ./img/unix-layers.png} @@ -260,18 +260,18 @@ Usually connecting to a computer (to the shell) is said to be done with either a .width25% .font18 - [image https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/ASR-33_at_CHM.agr.jpg/1280px-ASR-33_at_CHM.agr.jpg]\n - [*Teletype Model 33 by [url https://commons.wikimedia.org/wiki/User:ArnoldReinhold Arnold Reinhold]*] + {img https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/ASR-33_at_CHM.agr.jpg/1280px-ASR-33_at_CHM.agr.jpg}\n + {i Teletype Model 33 by {url Arnold Reinhold;https://commons.wikimedia.org/wiki/User:ArnoldReinhold}} - [$newrow] + {newrow} .p With the advent of computer displays, teleprinters were replaced with terminals, video display-keyboard combo. - Thanks to the widely popular [url https://en.wikipedia.org/wiki/VT100 VT100], almost all terminals support [url https://en.wikipedia.org/wiki/ANSI_escape_code ANSI escape codes]. + Thanks to the widely popular {url VT100;https://en.wikipedia.org/wiki/VT100}, almost all terminals support {url ANSI escape codes;https://en.wikipedia.org/wiki/ANSI_escape_code}. .font18 - [image https://upload.wikimedia.org/wikipedia/commons/thumb/9/99/DEC_VT100_terminal.jpg/675px-DEC_VT100_terminal.jpg?20131106192408]\n - [*DEC VT100 by [url https://www.flickr.com/people/54568729@N00 Jason Scott]*] + {img https://upload.wikimedia.org/wikipedia/commons/thumb/9/99/DEC_VT100_terminal.jpg/675px-DEC_VT100_terminal.jpg?20131106192408}\n + {i DEC VT100 by {url Jason Scott;https://www.flickr.com/people/54568729@N00}} @@ -281,16 +281,16 @@ Usually connecting to a computer (to the shell) is said to be done with either a Today we don't usually use such specialised hardware, but the names persist with slightly different meanings. .p -[url https://en.wikipedia.org/wiki/Virtual_console Virtual Terminal] (Console, tty): on some modern UNIX-likes (like Linux), the kernel/OS provides special devices, where a console is directly implemented/simulated with the connected computer and display. +{url Virtual Terminal;https://en.wikipedia.org/wiki/Virtual_console} (Console, tty): on some modern UNIX-likes (like Linux), the kernel/OS provides special devices, where a console is directly implemented/simulated with the connected computer and display. .bulleted -- systems that don't provide it usually expose another way to connect a console (now external hardware and/or software is required), like a [url https://en.wikipedia.org/wiki/Serial_port serial] port +- systems that don't provide it usually expose another way to connect a console (now external hardware and/or software is required), like a {url serial;https://en.wikipedia.org/wiki/Serial_port} port .p -[url https://en.wikipedia.org/wiki/Terminal_emulator Terminal Emulator]: a special program that emulates a virtual terminal (within another display system) +{url Terminal Emulator;https://en.wikipedia.org/wiki/Terminal_emulator}: a special program that emulates a virtual terminal (within another display system) .p -[url https://en.wikipedia.org/wiki/Pseudoterminal Pseudoterminal] (pty): a program that sits between a terminal and a shell (or other program), and makes them both think they're directly connected +{url Pseudoterminal;https://en.wikipedia.org/wiki/Pseudoterminal} (pty): a program that sits between a terminal and a shell (or other program), and makes them both think they're directly connected .bulleted - ssh, a program to remotely connect to a device's shell, establishes a pseudoterminal. Your local terminal thinks it's connected to a local shell and vice versa with the remote shell, however the pty in between handles the true communication. @@ -312,9 +312,9 @@ You can give a full or relative path, and that will be executed directly. Each command can be given parameters, separated by spaces, each (by convention) being either text values or options (switches). .p -Options usually start with a hyphen [`-`] (like [`-c`] or [`-current-time`]) and often support abbreviations ([`-a -b -c`] to [`-abc`]). -Newer conventions also allow start with two hyphens [`--`] ([`--current-time`]), though if shown as-is indicate the rest is a string. -More rarely you might see [`--OPTION=VALUE`] or just [`OPTION=VALUE`]. +Options usually start with a hyphen {` -} (like {` -c} or {` -current-time}) and often support abbreviations ({` -a -b -c} to {` -abc}). +Newer conventions also allow start with two hyphens {` --} ({` --current-time}), though if shown as-is indicate the rest is a string. +More rarely you might see {` --OPTION=VALUE} or just {` OPTION=VALUE}. :middle_slide @@ -322,7 +322,7 @@ More rarely you might see [`--OPTION=VALUE`] or just [`OPTION=VALUE`]. ### Thompson shell .p -The first UNIX shell is the [url https://en.wikipedia.org/wiki/Thompson_shell Thompson shell]. +The first UNIX shell is the {url Thompson shell;https://en.wikipedia.org/wiki/Thompson_shell}. The two major features that every other shell supports are: :bulleted @@ -345,10 +345,10 @@ command1 [args...] | command2 [args...] | ... .bulleted - Rooted singular tree of directories (the root folder of which is called "root", denoted with a "/") -- Each tree object (node) is an [url https://en.wikipedia.org/wiki/Inode i(ndex)node], containing type, ownership, access, internal data and any other metadata, but [=not=] name! -- Directory inodes (files) contain a table with rows of names and inode numbers, mapping a file name to it's contents. Each row is called a [url https://en.wikipedia.org/wiki/Hard_link hard link]. Every directory has a hard link to itself, called ".", and a hard link to it's parent, called "..". +- Each tree object (node) is an {url i(ndex)node;https://en.wikipedia.org/wiki/Inode}, containing type, ownership, access, internal data and any other metadata, but {b not} name! +- Directory inodes (files) contain a table with rows of names and inode numbers, mapping a file name to it's contents. Each row is called a {url hard link;https://en.wikipedia.org/wiki/Hard_link}. Every directory has a hard link to itself, called ".", and a hard link to it's parent, called "..". -.p [image ./img/unix-dir-tree.png ] +.p {img ;./img/unix-dir-tree.png} :middle_slide @@ -356,16 +356,16 @@ command1 [args...] | command2 [args...] | ... ### Attributes of an inode :bulleted -- [url https://en.wikipedia.org/wiki/Unix_file_types file type]: +- {url file type;https://en.wikipedia.org/wiki/Unix_file_types}: Each inode represents some sort of file (data), but a "file" can also be a directory or device, so we need to know how to handle it.\n There are 7 main types (but there can exist more, depending on OS): - [$br2] + {br2} .bulleted - - [=regular=]: just a plain old file - - [=directory=]: as explained, a file containing hard links to other files. Each directory is allowed to appear [*only once*] in a single parent. - - [=symbolic link=]: points to any file (or directory). It contains the (relative) path to that object (as a simple string), so a symlink not could even be valid. + - {b regular}: just a plain old file + - {b directory}: as explained, a file containing hard links to other files. Each directory is allowed to appear {i only once} in a single parent. + - {b symbolic link}: points to any file (or directory). It contains the (relative) path to that object (as a simple string), so a symlink not could even be valid. Think of a C++ pointer (pseudocode). ``` @@ -376,19 +376,19 @@ exec(/bin/mprog); -> Executes /usr/local/bin/mprog :slide :bulleted - - [=FIFO special=]: aka [url https://en.wikipedia.org/wiki/Named_pipe named pipe], a special type of regular file, where at any moment only one process can read from it and one can write to it. It takes the concept of shell pipes to inter-process communication. + - {b FIFO special}: aka {url named pipe;https://en.wikipedia.org/wiki/Named_pipe}, a special type of regular file, where at any moment only one process can read from it and one can write to it. It takes the concept of shell pipes to inter-process communication. ``` [Process] --write-> [FIFO] x-write-- [Process] [ A ] x--read-- [ ] --read--> [ B ] - - [=block special=]: a device which is randomly accessible, like a hard drive or cdrom drive. + - {b block special}: a device which is randomly accessible, like a hard drive or cdrom drive. Think of a C++ array (pseudocode): ``` BlockSpecial[438] = 1 ; var = BlockSpecial[438] - - [=character special=]: devices which are accessed via serial streams of input or output, like keyboards, mice, graphics cards and teletypes.\n + - {b character special}: devices which are accessed via serial streams of input or output, like keyboards, mice, graphics cards and teletypes.\n Think of a C++ stream (pseudocode): ``` @@ -398,9 +398,9 @@ CharacterSpecial << 1 ; CharacterSpecial >> var :middle_slide :bulleted - - [=sockets=]: file for inter-process communication. Compared to FIFO specials, they can be used by more than two processes, used in both directions and support [url https://en.wikipedia.org/wiki/File_descriptor file descriptors] and packets + - {b sockets}: file for inter-process communication. Compared to FIFO specials, they can be used by more than two processes, used in both directions and support {url file descriptors;https://en.wikipedia.org/wiki/File_descriptor} and packets - [$br1] + {br1} ``` [Process A] <--read&write--> [Socket 1] @@ -415,13 +415,13 @@ CharacterSpecial << 1 ; CharacterSpecial >> var #### Side-step into users and groups -[$br3] +{br3} .p -A user in UNIX is essentially a small collection of data, most important of it being a [=unique ID=] (number), a [=name=] (string), a [=group id=] (number; files created by the user are in that group) and a [=password=]. +A user in UNIX is essentially a small collection of data, most important of it being a {b unique ID} (number), a {b name} (string), a {b group id} (number; files created by the user are in that group) and a {b password}. .p -Groups are also small collections of data, but much simpler, comprised only of a [=unique ID=] (number), a [=name=] (string) and a [=list of users=] that are "in" the group. Their main purpose is to simplify access control. +Groups are also small collections of data, but much simpler, comprised only of a {b unique ID} (number), a {b name} (string) and a {b list of users} that are "in" the group. Their main purpose is to simplify access control. .p User with ID 0 is called root, it is the "system administrator", all actions made by the system itself are done as that user. @@ -430,25 +430,25 @@ Every user has their own "home" folder (under "/home/USERNAME/", except for root :slide :bulleted -- [url https://en.wikipedia.org/wiki/File_system_permissions file permissions]: +- {url file permissions;https://en.wikipedia.org/wiki/File_system_permissions}: control the freedom of a user to read (navigate for directories), change and execute files\n - File permissions are split into three sets: what the [=owner=] can do, what [=group=] members can do and what [=anyone else=] can do.\n + File permissions are split into three sets: what the {b owner} can do, what {b group} members can do and what {b anyone else} can do.\n - Each set contains a mix of three permissions: [=r=]ead, [=w=]rite and e[=x=]ecute, and each set stores some combination of them. + Each set contains a mix of three permissions: {b r}ead, {b w}rite and e{b x}ecute, and each set stores some combination of them. - [$br1] + {br1} .p - Each is represented by a bit in the order above ([`101`] means you [*can*] read, [*cannot*] write, [*can*] execute) and the overall permissions are often shown as a three digit number or character string.\n - Example: [`111101100`] will be shown as [`754`] or [`rwxr-xr--`] + Each is represented by a bit in the order above ({` 101} means you {i can} read, {i cannot} write, {i can} execute) and the overall permissions are often shown as a three digit number or character string.\n + Example: {` 111101100} will be shown as {` 754} or {` rwxr-xr--} - link count: - the count of hard links that point to the inode. A file is deleted [=only when there are no hard links left to it=]. - Every directory inode has at least two - one from parent and one from itself ("."), though the latter [=isn't=] counted. - Child and parent directories also [=add=] to the count. + the count of hard links that point to the inode. A file is deleted {b only when there are no hard links left to it}. + Every directory inode has at least two - one from parent and one from itself ("."), though the latter {b isn't} counted. + Child and parent directories also {b add} to the count. - [$br1] + {br1} - User ID of owner, Group ID, file size and timestamps @@ -459,42 +459,42 @@ Every user has their own "home" folder (under "/home/USERNAME/", except for root ## 2.3. Kernel .font18 -[$br1] +{br1} .p The kernel has the core functionality of the operating system and bridges the gap between programs and hardware. Some important subsystems include scheduling, file, device, process and memory management. .p -To preserve the [url https://en.wikipedia.org/wiki/Everything_is_a_file everything is a file] methodology, devices and processes can be handled as files (inside [`/dev`] and [`/proc`]). +To preserve the {url everything is a file;https://en.wikipedia.org/wiki/Everything_is_a_file} methodology, devices and processes can be handled as files (inside {` /dev} and {` /proc}). They (most of the time, in modern kernels) aren't actual files on a hard drive, but "virtual" files, where operations on them are handled in a different manner than normal by the kernel. -[$br2] +{br2} -.font35 Linux is [=not=] an operating system, it is a kernel!!! +.font35 Linux is {b not} an operating system, it is a kernel!!! -[$br2] +{br2} .p -Two of the important things a kernel does is manage [=processes=] and [=memory=]. +Two of the important things a kernel does is manage {b processes} and {b memory}. :slide35 ### 2.3.1 Processes -[$br1] +{br1} .p A program is some collection of code and other data, stored in a file (or noncompiled code).\n -A process is the program in motion, the program itself [*alongside*] certain system states. +A process is the program in motion, the program itself {i alongside} certain system states. .p The system states include (but are not limited to): .bulleted - the processor state, including the program counter and register values - memory map, indicating what regions of memory are allocated (to the process) -- [url https://en.wikipedia.org/wiki/File_descriptor file descriptors], unique identifiers for files +- {url file descriptors;https://en.wikipedia.org/wiki/File_descriptor}, unique identifiers for files :middle_slide35 @@ -503,8 +503,8 @@ The system states include (but are not limited to): On a multitasking (multiprocessing) system, which is any modern desktop system, multiple processes are always running "at once". .p -In reality, constantly one process is stopped and another is ran, switching between all of them ([url https://en.wikipedia.org/wiki/Context_switch context switching]). -All "waiting" processes are put in a prioritized queue ([url https://en.wikipedia.org/wiki/Run_queue run queue]). +In reality, constantly one process is stopped and another is ran, switching between all of them ({url context switching;https://en.wikipedia.org/wiki/Context_switch}). +All "waiting" processes are put in a prioritized queue ({url run queue;https://en.wikipedia.org/wiki/Run_queue}). .p Stopping is either done by the process itself (more on that later), or by the system when the process has been actively running for too much time. @@ -515,18 +515,18 @@ Stopping is either done by the process itself (more on that later), or by the sy #### Process Control Block .p -All process information is stored in a data structure, called a [*process control block*] (or process descriptor). -Not to be confused with a [url https://en.wikipedia.org/wiki/Printed_circuit_board printed circuit board]!\n +All process information is stored in a data structure, called a {i process control block} (or process descriptor). +Not to be confused with a {url printed circuit board;https://en.wikipedia.org/wiki/Printed_circuit_board}!\n A PCB's data can be split into three categories: .numbered -1. [=Process identification=] - the ID of the process itself, of it's parent process, of it's owner (user), etc. -2. [=Process state=] - as described, the processor state, etc.\n +1. {b Process identification} - the ID of the process itself, of it's parent process, of it's owner (user), etc. +2. {b Process state} - as described, the processor state, etc.\n On a context switch, values in registers are put into the stopped PCB and then are loaded from the running PCB. -3. [=Process control information=] - process state, memory map, privileges, etc. +3. {b Process control information} - process state, memory map, privileges, etc. .p -A process can be [=forked=], meaning a new process is created, with the same underlying code (but not process states and ...). +A process can be {b forked}, meaning a new process is created, with the same underlying code (but not process states and ...). :middle_slide35 @@ -534,11 +534,11 @@ A process can be [=forked=], meaning a new process is created, with the same und #### Process states .bulleted -- [=Created=]: This is the initial state given to a new process. In this state, the process awaits a "ready" state. -- [=Ready=] (Waiting): A process is put in the run queue and awaits being executed ("running" state). -- [=Running=]: When the process's program is being currently executed by the CPU. The process can run in either [*kernel mode*], having access to the kernel and user addresses, or [*user mode*], having access only to it's own code and data. -- [=Blocked=]: When a process cannot continue without external change, usually when waiting for an I/O device. -- [=Terminated=]: The process has either completed execution or has been killed. The process itself is called a [url https://en.wikipedia.org/wiki/Zombie_process "zombie process"] (until it is removed). +- {b Created}: This is the initial state given to a new process. In this state, the process awaits a "ready" state. +- {b Ready} (Waiting): A process is put in the run queue and awaits being executed ("running" state). +- {b Running}: When the process's program is being currently executed by the CPU. The process can run in either {i kernel mode}, having access to the kernel and user addresses, or {i user mode}, having access only to it's own code and data. +- {b Blocked}: When a process cannot continue without external change, usually when waiting for an I/O device. +- {b Terminated}: The process has either completed execution or has been killed. The process itself is called a {url "zombie process";https://en.wikipedia.org/wiki/Zombie_process} (until it is removed). :middle_slide35 @@ -546,7 +546,7 @@ A process can be [=forked=], meaning a new process is created, with the same und #### Exit status .p -Every process, before being deleted (and after being in a Terminated state) passes a small number, called the [url https://en.wikipedia.org/wiki/Exit_status exit status] (exit code), to it's parent process. +Every process, before being deleted (and after being in a Terminated state) passes a small number, called the {url exit status;https://en.wikipedia.org/wiki/Exit_status} (exit code), to it's parent process. For all intents and purposes, this number is an 8bit unsigned integer, meaning it's value is between 0 and 255. .p @@ -558,31 +558,31 @@ Different programs specify the meaning of an exit code in different ways, some a ### 2.3.2 Memory management -[$br2] +{br2} .p -In ye olde days, you would save a bit of memory for the operating system and give all of the rest to the current process ([url https://en.wiktionary.org/wiki/monoprogramming monoprogramming]), which we wait until completion. +In ye olde days, you would save a bit of memory for the operating system and give all of the rest to the current process ({url monoprogramming;https://en.wiktionary.org/wiki/monoprogramming}), which we wait until completion. .p This doesn't allow for context switching (disks are slow) and a blocked state forces the CPU to wait. .p -Some bad ideas include: depending on the code of all processes to not use the same addresses, use only [url https://en.wikipedia.org/wiki/Position-independent_code relative addresses] ([`-fPIC`] option in [`gcc`]) or use a [url https://en.wikipedia.org//wiki/Relocation_%28computing%29#Relocation_table table] that the kernel fills out with addresses. +Some bad ideas include: depending on the code of all processes to not use the same addresses, use only {url relative addresses;https://en.wikipedia.org/wiki/Position-independent_code} ({` -fPIC} option in {` gcc}) or use a {url table;https://en.wikipedia.org//wiki/Relocation_%28computing%29#Relocation_table} that the kernel fills out with addresses. :slide35 ### Virtual memory -[$br2] +{br2} .fright - [image ./img/virtual-memory-by-Ehamberg.png]\n + {img ./img/virtual-memory-by-Ehamberg.png}\n .font18 - [*Image by [url https://commons.wikimedia.org/wiki/File:Virtual_memory.svg Ehamberg]*] + {i Image by {url Ehamberg;https://commons.wikimedia.org/wiki/File:Virtual_memory.svg}} .p -A program (process) works with some (sequential) addresses, and the OS (with the help of [url https://en.wikipedia.org/wiki/Memory_management_unit hardware]) translates/maps the process' addresses (logical/[url https://en.wikipedia.org/wiki/Virtual_address_space virtual addresses]) to real ones (physical addresses). +A program (process) works with some (sequential) addresses, and the OS (with the help of {url hardware;https://en.wikipedia.org/wiki/Memory_management_unit}) translates/maps the process' addresses (logical/{url virtual addresses;https://en.wikipedia.org/wiki/Virtual_address_space}) to real ones (physical addresses). .p Simplified memory management for the program, protected address space for each process and improved flexibility. @@ -592,29 +592,29 @@ Simplified memory management for the program, protected address space for each p #### Segmentation (without paging) -[$br2] +{br2} .p Initially, virtual memory was implemented with segmentation, where a process' memory is divided into segments for code, stack, heap, etc. Each segment is given a chunk of contiguous memory, which can be resized, and addresses are defined as the base segment (physical) address with an offset. .p -In the modern day, segmentation isn't used by itself, since resizing segments could require reordering of memory and [url https://en.wikipedia.org/wiki/Fragmentation_%28computing%29#External_fragmentation external fragmentation], where there simply isn't enough contiguous memory, could occur. +In the modern day, segmentation isn't used by itself, since resizing segments could require reordering of memory and {url external fragmentation;https://en.wikipedia.org/wiki/Fragmentation_%28computing%29#External_fragmentation}, where there simply isn't enough contiguous memory, could occur. :slide35 #### Paging -[$br3] +{br3} .p The virtual and physical memory is divided into fixed-sized chunks of consecutive addresses. -A virtual memory chunk is called a [=page=], while a physical memory chunk is called a (page) [=frame=]. +A virtual memory chunk is called a {b page}, while a physical memory chunk is called a (page) {b frame}. Usually both have the same size of (at least) 4 KiB. .p -Every process has a [url https://en.wikipedia.org/wiki/Page_table page table], which maps the process' pages to system frames. +Every process has a {url page table;https://en.wikipedia.org/wiki/Page_table}, which maps the process' pages to system frames. Thus every memory address is translated from it's page location to a frame location. @@ -623,7 +623,7 @@ Thus every memory address is translated from it's page location to a frame locat .p Advantages include: .bulleted -- elimination of [url https://en.wikipedia.org/wiki/Fragmentation_%28computing%29#External_fragmentation external fragmentation] +- elimination of {url external fragmentation;https://en.wikipedia.org/wiki/Fragmentation_%28computing%29#External_fragmentation} - increased flexibility, allowed sharing of memory between processes (useful for shared libraries) - finding free memory is fast and easy, just use the first free pages you see - frames can be scattered @@ -633,7 +633,7 @@ Thus every memory address is translated from it's page location to a frame locat .bulleted - longer memory access, because of the page table -- [url https://en.wikipedia.org/wiki/Fragmentation_%28computing%29#Internal_fragmentation internal fragmentation], where one or multiple pages might be partially empty, leaving free space that cannot be used +- {url internal fragmentation;https://en.wikipedia.org/wiki/Fragmentation_%28computing%29#Internal_fragmentation}, where one or multiple pages might be partially empty, leaving free space that cannot be used :slide @@ -644,20 +644,20 @@ Thus every memory address is translated from it's page location to a frame locat Enough theory, time to have some fun and learn Linux! .p -We'll be using [url https://ivandavidov.github.io/minimal/#home Linux Minimal Live] (just a bootable ISO) because it's: +We'll be using {url Linux Minimal Live;https://ivandavidov.github.io/minimal/#home} (just a bootable ISO) because it's: .bulleted - very small, comprised of only the Linux kernel, GNU C library and Busybox\n -- made by a fellow Bulgarian [$bg] +- made by a fellow Bulgarian {bg} .p We're going to explore and look around the following stuff: .bulleted -- [=Shells=]: What a modern shell would often support on a Linux based OS -- [=Files and directories=]: Naming conventions and commands to work with them -- [=Common configuration files=]: Relevant configuration files, their purpose and syntax -- [=System management=]: Other commands with which to modify your system +- {b Shells}: What a modern shell would often support on a Linux based OS +- {b Files and directories}: Naming conventions and commands to work with them +- {b Common configuration files}: Relevant configuration files, their purpose and syntax +- {b System management}: Other commands with which to modify your system :middle_slide18 @@ -665,30 +665,30 @@ We're going to explore and look around the following stuff: #### If you're following at home .p -Owing to it's size, not everything we need comes out of the box, so I created [url ./mll-set.sh a script] which installs what's needed. +Owing to it's size, not everything we need comes out of the box, so I created {url a script;./mll-set.sh} which installs what's needed. If you want to try it out yourself, after booting up Minimal Linux Live, type out and run: ``` wget -q http://unsecure.syndamia.com/mll-set.sh && chmod +x mll-set.sh && ./mll-set.sh .p -You might've noticed that the command above doesn't use the normal [url ./mll-set.sh https://syndamia.com/talks/linuxgraphy-by-strabo/mll-set.sh] link. +You might've noticed that the command above doesn't use the normal {url https://syndamia.com/talks/linuxgraphy-by-strabo/mll-set.sh;./mll-set.sh} link. That is because, out of the box, MLL doesn't really support secure connections (https), so I've made only that file available without it. .p -The script, in summary, installs bash, coreutils and shadow "packages" (from [url http://s.minos.io/archive/bifrost/x86_64 http://s.minos.io/archive/bifrost/x86\_64]) to /usr/local/bin, creates /etc/passwd, /etc/bashrc and /etc/profile with some values in them and starts bash. +The script, in summary, installs bash, coreutils and shadow "packages" (from {url http://s.minos.io/archive/bifrost/x86\_64;http://s.minos.io/archive/bifrost/x86_64}) to /usr/local/bin, creates /etc/passwd, /etc/bashrc and /etc/profile with some values in them and starts bash. :slide ## 3.1. Shells -[$br2] +{br2} ### Variables and data types .p -Before talking about the different features newer shells support, we'll roughly cover variables and data types (mostly [url https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Parameters bash] specifics). +Before talking about the different features newer shells support, we'll roughly cover variables and data types (mostly {url bash;https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Parameters} specifics). .p A variable, also called parameter, is created with the syntax (NO spaces between the =): @@ -697,7 +697,7 @@ A variable, also called parameter, is created with the syntax (NO spaces between name=value .p -Where [`name`] is either a combination of letters (upper and lower case), numbers and the underscore character, which cannot begin with a number, or one of select few [=positional=] and [=special=] parameters. +Where {` name} is either a combination of letters (upper and lower case), numbers and the underscore character, which cannot begin with a number, or one of select few {b positional} and {b special} parameters. :slide35 @@ -705,20 +705,20 @@ Where [`name`] is either a combination of letters (upper and lower case), number #### Positional and special parameters .p -[url https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Positional-Parameters Positional parameters] are numbers from 1 to N, where each one corresponds to a shell (or function, or script) argument. +{url Positional parameters;https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Positional-Parameters} are numbers from 1 to N, where each one corresponds to a shell (or function, or script) argument. .p -Some of the [url https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Special-Parameters special parameters] are: +Some of the {url special parameters;https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Special-Parameters} are: .bulleted -- [`0`], corresponding to the shell's or script's name, -- [`@`] is all positional parameters, separated by spaces -- [`#`] is the number of positional parameters -- [`?`] is the last executed (foreground) process -- [`$`] is process ID of the current shell. +- {` 0}, corresponding to the shell's or script's name, +- {` @} is all positional parameters, separated by spaces +- {` #} is the number of positional parameters +- {` ?} is the last executed (foreground) process +- {` $} is process ID of the current shell. .p -[`value`], without any special surrounding characters (more on that later), is treated as a string (but it mustn't have spaces!), however it may also be omitted, in which case it is the empty string [`""`]. +{` value}, without any special surrounding characters (more on that later), is treated as a string (but it mustn't have spaces!), however it may also be omitted, in which case it is the empty string {` ""}. :slide35 @@ -727,28 +727,29 @@ Some of the [url https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.htm .p In most shells, there are 3 data types: strings, integers and (one-dimensional) indexed arrays. -[url https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#index-declare bash has more], like references and associative arrays, but those aren't universal. +{url bash has more;https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#index-declare}, like references and associative arrays, but those aren't universal. .p -A value is a [=string=] when surrounded by single [`'`] or double [`"`] quotes,\n -an [=integer=] when it isn't surrounded by anything and composed only of digits (if there are letters, it is a string; it's [url https://tldp.org/LDP/abs/html/untyped.html quite tricky] when a value is interpreted as a string or integer) and\n -an [=array=] when surrounded by braces [`()`], where inside elements are strings or integers, separated by spaces. +A value is a {b string} when surrounded by single {` '} or double {` "} quotes,\n +an {b integer} when it isn't surrounded by anything and composed only of digits (if there are letters, it is a string; it's {url quite tricky;https://tldp.org/LDP/abs/html/untyped.html} when a value is interpreted as a string or integer) and\n +an {b array} when surrounded by braces {` ()}, where inside elements are strings or integers, separated by spaces. An indexed array can also be created by specifying the value at any index: ``` -name[index\=]value +name[index\}value :slide #### Mixing types and operations -[$br1] +{br1} ``` name=value -:table_4 +:table +:4 |= Type |= string operation |= integer operation @@ -771,25 +772,26 @@ name=value + :slide #### Parameter expansion .p -With [url https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Parameter-Expansion parameter expansion], actions are done with the general variable (entity) or on strings and arrays values. -Operations on integers are done with [url https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Arithmetic-Expansion arithmetic expansion]. +With {url parameter expansion;https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Parameter-Expansion}, actions are done with the general variable (entity) or on strings and arrays values. +Operations on integers are done with {url arithmetic expansion;https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Arithmetic-Expansion}. .p -Parameter expansion is started with the character [`\$`] and either a name or curly braces. -Retrieving a value is done with the forms [`\$name`], [`\${name}`] and [`\${name[index]}`] for arrays. +Parameter expansion is started with the character {` \$} and either a name or curly braces. +Retrieving a value is done with the forms {` \$name}, {` \${name}} and {` \${name[index]}} for arrays. .p Some parameter expansions in bash: .bulleted -- [`\${#parameter}`] length of characters -- [`\${parameter:offset}`] and [`\${parameter:offset:length}`] return substring from index offset -- [`\${parameter/pattern/string}`] return a string, where every match on pattern is replaced by string -- [`\${name[@]}`] a (space separated) sequence of indices from 0 to length (for defined values) of array name +- {` \${#parameter}} length of characters +- {` \${parameter:offset}} and {` \${parameter:offset:length}} return substring from index offset +- {` \${parameter/pattern/string}} return a string, where every match on pattern is replaced by string +- {` \${name[@]}} a (space separated) sequence of indices from 0 to length (for defined values) of array name :slide @@ -797,20 +799,20 @@ Some parameter expansions in bash: #### Arithmetic expansion .p -Arithmetic expansions allow evaluation of [url https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Arithmetic arithmetic expressions]. -They're in the form [`\$(( expression ))`]. +Arithmetic expansions allow evaluation of {url arithmetic expressions;https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Arithmetic}. +They're in the form {` \$(( expression ))}. .p Some useful expressions are: .bulleted -- [`++name`], [`name++`], [`--name`], [`name++`] postfix and prefix incrementation and decrementation -- [`+`], [`-`], [`*`], [`/`], [`%`] normal arithmetic operators, [`**`] exponentiation -- [`~`], [`<<`], [`>>`], [`&`], [`^`], [`|`] bitwise operators -- [`==`], [`!=`], [`>`], [`>=`], [`<`], [`<=`] logical comparison -- [`!`], [`&&`], [`||`] logical not, and, or -- [`expr ? exprTrue : exprFalse`] conditional -- [`=`], [`+=`], ..., [`<<=`], ... assignment operators -- [`expr1 , expr2`] consecutive expressions and [`(expr)`] bracing +- {` ++name}, {` name++}, {` --name}, {` name++} postfix and prefix incrementation and decrementation +- {` +}, {` -}, {` *}, {` /}, {` %} normal arithmetic operators, {` **} exponentiation +- {` ~}, {` <<}, {` >>}, {` &}, {` ^}, {` |} bitwise operators +- {` ==}, {` !=}, {` >}, {` >=}, {` <}, {` <=} logical comparison +- {` !}, {` &&}, {` ||} logical not, and, or +- {` expr ? exprTrue : exprFalse} conditional +- {` =}, {` +=}, ..., {` <<=}, ... assignment operators +- {` expr1 , expr2} consecutive expressions and {` (expr)} bracing .p Expressions work with both variable names and integers. @@ -821,19 +823,19 @@ Expressions work with both variable names and integers. ### Bourne shell .p -Most modern shells support a lot of the more defying features of the [url https://en.wikipedia.org/wiki/Bourne_shell Bourne Shell], which include: +Most modern shells support a lot of the more defying features of the {url Bourne Shell;https://en.wikipedia.org/wiki/Bourne_shell}, which include: :bulleted -- [url https://en.wikipedia.org/wiki/Job_control_%28Unix%29 Job control]: Management of currently running groups of processes\n +- {url Job control;https://en.wikipedia.org/wiki/Job_control_%28Unix%29}: Management of currently running groups of processes\n :bulleted - - [`&`]: A process can be ran in the background with an ampersand (&) at the end of the command: + - {` &}: A process can be ran in the background with an ampersand (&) at the end of the command: ``` command [args...] & - - [`Ctrl+z`]: suspend the currently running (foreground) job - - [`bg`]: start a suspended job in the background - - [`fg`]: resume the last job to be put in the background and make it the current job with which we're interacting - - [`jobs`]: list all active (background) jobs + - {` Ctrl+z}: suspend the currently running (foreground) job + - {` bg}: start a suspended job in the background + - {` fg}: resume the last job to be put in the background and make it the current job with which we're interacting + - {` jobs}: list all active (background) jobs @@ -842,28 +844,28 @@ command [args...] & :bulleted -   :bulleted - - Every job is identified with a [=Job ID=] (number), which you can use by prepending a percentage sign. Example, to resume the job with JID 4: + - Every job is identified with a {b Job ID} (number), which you can use by prepending a percentage sign. Example, to resume the job with JID 4: ``` fg %4 - - For managing everything, usually there is a [*job table*]. + - For managing everything, usually there is a {i job table}. Upon shell termination, the shell tells all jobs in that table to terminate and waits for them.\n - [`disown`]: remove a job from the job table + {` disown}: remove a job from the job table - - [`kill`]: send a signal to the process or job. Then that process will have to handle it accordingly.\n - Common ones are [`-KILL`] to immediately stop the process, [`-QUIT`] to quit it, [`-ABRT`] to cancel the current action, [`-TERM`] shut down (orderly), [`-STOP`] shut down (forcefully) + - {` kill}: send a signal to the process or job. Then that process will have to handle it accordingly.\n + Common ones are {` -KILL} to immediately stop the process, {` -QUIT} to quit it, {` -ABRT} to cancel the current action, {` -TERM} shut down (orderly), {` -STOP} shut down (forcefully) :middle_slide27 :bulleted -- [url https://en.wikipedia.org/wiki/Here_document heredoc]: File literal, meaning it is a user "string" which is interpreted as a file +- {url heredoc;https://en.wikipedia.org/wiki/Here_document}: File literal, meaning it is a user "string" which is interpreted as a file .bulleted - - start with [`<< NAME`], where NAME can be anything you want, it is used to mark the beginning and end of a heredoc. [`<<`] is also a redirection symbol + - start with {` << NAME}, where NAME can be anything you want, it is used to mark the beginning and end of a heredoc. {` <<} is also a redirection symbol - on every new line write out your text, all characters will be preserved - - to end it, write out [`NAME`] on the beginning of a new empty line. Example: + - to end it, write out {` NAME} on the beginning of a new empty line. Example: ``` cat << MYFILE This is @@ -871,65 +873,65 @@ This is text MYFILE -- control operators: Control what command is executed, depending on [url https://en.wikipedia.org/wiki/Exit_status exit status] +- control operators: Control what command is executed, depending on {url exit status;https://en.wikipedia.org/wiki/Exit_status} .bulleted - - [`expr1 && expr2`]: Run expr2, only if expr1 exited successfully - - [`expr1 || expr2`]: Run expr2 if expr1 exited unsuccessfully - - [`expr1 ; expr2`]: Run expr2 after expr1 (sequential execution) + - {` expr1 && expr2}: Run expr2, only if expr1 exited successfully + - {` expr1 || expr2}: Run expr2 if expr1 exited unsuccessfully + - {` expr1 ; expr2}: Run expr2 after expr1 (sequential execution) :middle_slide27 :bulleted -- [url https://en.wikipedia.org/wiki/Redirection_%28computing%29 redirection]: Outside of having [`<`] and [`>`] for I/O redirection, often there is also +- {url redirection;https://en.wikipedia.org/wiki/Redirection_%28computing%29}: Outside of having {` <} and {` >} for I/O redirection, often there is also :bulleted - - [`>>`]: Acts like [`>`], putting text into a file, but rather than overwriting everything, it appends it - - [`<<`]: As explained, for heredocs - - [`<<<`]: To the right is a string ([url https://en.wikipedia.org/wiki/Here_document#Here_strings herestring]), and it is interpreted as a file + - {` >>}: Acts like {` >}, putting text into a file, but rather than overwriting everything, it appends it + - {` <<}: As explained, for heredocs + - {` <<<}: To the right is a string ({url herestring;https://en.wikipedia.org/wiki/Here_document#Here_strings}), and it is interpreted as a file ``` cat <<< "Hello World!" - - [=Standard input=], [=standard output=] and [=standard error=] are all [=files=] with which the shell works. + - {b Standard input}, {b standard output} and {b standard error} are all {b files} with which the shell works. Typing text in the shell puts it into stdin, command output are put into stdout (and shown to the user) and errors are put into stderr (also shown to the user). .p Each one of them is numbered from 0 to 2, and you can specify redirection by appending or prepending it to the redirection symbol.\n .p .bulleted - - [`N>outputfile`]: redirects the output from standard stream N into outputfile - - [`N>&M`]: redirects the output from standard stream N into standard stream M - - [`N<inputfile`]: redirects input file contents to standard stream N - - [`N<&M`]: redirects standard stream M to standard stream N + - {` N>outputfile}: redirects the output from standard stream N into outputfile + - {` N>&M}: redirects the output from standard stream N into standard stream M + - {` N<inputfile}: redirects input file contents to standard stream N + - {` N<&M}: redirects standard stream M to standard stream N :middle_slide27 :bulleted -- [url https://en.wikipedia.org/wiki/Test_%28Unix%29 built-in test command]: With [`test`] you can do conditional expressions. You can also often use brackets [`[ args... ]`] instead of [`test args...`] +- {url built-in test command;https://en.wikipedia.org/wiki/Test_%28Unix%29}: With {` test} you can do conditional expressions. You can also often use brackets {` [ args... ]} instead of {` test args...} :p :bulleted - Some of the available file checks .bulleted - - [`-e FILENAME`]: FILENAME exists - - [`-d FILENAME`]: if FILENAME is a directory - - [`-h FILENAME`]: if FILENAME is a symbolic link - - [`-w FILENAME`]: you can write in FILENAME + - {` -e FILENAME}: FILENAME exists + - {` -d FILENAME}: if FILENAME is a directory + - {` -h FILENAME}: if FILENAME is a symbolic link + - {` -w FILENAME}: you can write in FILENAME - Some of the available string checks .bulleted - - [`-n STR`]: string STR has nonzero length - - [`-z STR`]: string STR has length zero - - [`STR1 = STR2`] and [`STR1 != STR2`]: self explanatory + - {` -n STR}: string STR has nonzero length + - {` -z STR}: string STR has length zero + - {` STR1 = STR2} and {` STR1 != STR2}: self explanatory - Some of the available number checks .bulleted - - [`INT1 -eq INT2`]: equal integers - - [`INT1 -gt INT2`]: INT1 > INT2 - - [`INT1 -gt INT2`]: INT1 >= INT2 + - {` INT1 -eq INT2}: equal integers + - {` INT1 -gt INT2}: INT1 > INT2 + - {` INT1 -gt INT2}: INT1 >= INT2 - - Operators: [`!`] - negation, [`-a`] - binary AND, [`-o`] - binary OR, parentheses for grouping (escaped with [`\\`]) + - Operators: {` !} - negation, {` -a} - binary AND, {` -o} - binary OR, parentheses for grouping (escaped with {` \\}) @@ -937,14 +939,14 @@ cat <<< "Hello World!" :slide :bulleted -- [url https://en.wikipedia.org/wiki/Shell_script scripting support]: Running commands from top to bottom of a file +- {url scripting support;https://en.wikipedia.org/wiki/Shell_script}: Running commands from top to bottom of a file .p .bulleted - - [`#`]: Everything between a # and the end of the line denotes a comment - - [`#!`]: If on the first line of the file, is treated as a [url https://en.wikipedia.org/wiki/Shebang_%28Unix%29 shebang], which specifies what interpreter to be used for the script + - {` #}: Everything between a # and the end of the line denotes a comment + - {` #!}: If on the first line of the file, is treated as a {url shebang;https://en.wikipedia.org/wiki/Shebang_%28Unix%29}, which specifies what interpreter to be used for the script - compound commands: Structures for flow control\n - In all examples, [`test-command`] is any command (or combination with control operators), and logic is based on exit code. + In all examples, {` test-command} is any command (or combination with control operators), and logic is based on exit code. :p :bulleted @@ -956,7 +958,7 @@ elif test-command ; then commands-if-true else commands-if-true fi - [`elif`] statements can appear multiple times, both elif and else are optional + {` elif} statements can appear multiple times, both elif and else are optional @@ -965,7 +967,7 @@ fi :slide :bulleted -   - [$br1] + {br1} :bulleted - conditional (case) @@ -975,7 +977,7 @@ case word in (pattern | ...) commands-if-true ;; ... esac .p Where the beginning brace can be ommited.\n - Patterns are according to [url https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Pattern-Matching bash's pattern matching] + Patterns are according to {url bash's pattern matching;https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Pattern-Matching} - loops @@ -985,7 +987,7 @@ while test-command; do commands-if-true; done ``` for name in words...; do commands-if-true; done - If [`in words...`] is ommited, positional arguments are used + If {` in words...} is ommited, positional arguments are used @@ -995,17 +997,17 @@ for name in words...; do commands-if-true; done ## 3.2. Files and directories .bulleted -- [`/dev`]: devices -- [`/proc`]: process information +- {` /dev}: devices +- {` /proc}: process information -[$br3] +{br3} .bulleted -- [`/bin`]: main command programs (binaries), used by users -- [`/sbin`]: command programs, used for the system operation -- [`/usr`]: other system resources +- {` /bin}: main command programs (binaries), used by users +- {` /sbin}: command programs, used for the system operation +- {` /usr}: other system resources .bulleted - - [`/usr/bin`]: all other user command binaries + - {` /usr/bin}: all other user command binaries :slide @@ -1013,24 +1015,24 @@ for name in words...; do commands-if-true; done #### Everyday file system commands .bulleted -- [`mkdir`]: create directories -- [`rm`]: remove a (hardlink to) file or directory -- [`mv`]: move file (or directory) to another directory -- [`cp`]: copy a file -- [`ln`]: create hard (or soft, with [`-s`]) links to files (inodes) -- [`ls`]: list directory contents +- {` mkdir}: create directories +- {` rm}: remove a (hardlink to) file or directory +- {` mv}: move file (or directory) to another directory +- {` cp}: copy a file +- {` ln}: create hard (or soft, with {` -s}) links to files (inodes) +- {` ls}: list directory contents #### Other useful file system commands .bulleted -- [`shred`]: overwrite file contents -- [`dd`]: do many things with files, like modifying and duplicating data across devices and partitions, (basic) data recovery and generating files -- [`du`]: estimate file usage -- [`stat`]: display status for file or file system -- [`chwon`]: change owner of an inode -- [`chgrp`]: change group of an inode -- [`chmod`]: change file modes -- [`find`]: search for a file inside a directory (recursively) +- {` shred}: overwrite file contents +- {` dd}: do many things with files, like modifying and duplicating data across devices and partitions, (basic) data recovery and generating files +- {` du}: estimate file usage +- {` stat}: display status for file or file system +- {` chwon}: change owner of an inode +- {` chgrp}: change group of an inode +- {` chmod}: change file modes +- {` find}: search for a file inside a directory (recursively) :slide @@ -1038,23 +1040,23 @@ for name in words...; do commands-if-true; done #### Everyday text (file) commands .bulleted -- [`echo`]: prints a given string to standard output -- [`cat`]: sequentially prints files to standard output -- [`less`]: view files with support for scrolling -- [`head`]: print the first lines (or characters) of a file -- [`tail`]: print the last lines (or characters) of a file +- {` echo}: prints a given string to standard output +- {` cat}: sequentially prints files to standard output +- {` less}: view files with support for scrolling +- {` head}: print the first lines (or characters) of a file +- {` tail}: print the last lines (or characters) of a file #### Other useful text (file) commands .bulleted -- [`grep`]: searches for matches in a file, using simplified regular expressions. [`egrep`] for extended regex and [`fgrep`] for string match (as-is). -- [`sed`]: filter and transform text from files, according to regex -- [`tr`]: translate, map (more than one to one for example) and delete characters -- [`cut`]: remove parts of text from each line -- [`strings`]: find embedded text inside binary files -- [`truncate`]: shrink or extend the size of a file -- [`wc`]: count words inside file -- [`diff`]: compare files and show their differences +- {` grep}: searches for matches in a file, using simplified regular expressions. {` egrep} for extended regex and {` fgrep} for string match (as-is). +- {` sed}: filter and transform text from files, according to regex +- {` tr}: translate, map (more than one to one for example) and delete characters +- {` cut}: remove parts of text from each line +- {` strings}: find embedded text inside binary files +- {` truncate}: shrink or extend the size of a file +- {` wc}: count words inside file +- {` diff}: compare files and show their differences :middle_slide @@ -1062,17 +1064,17 @@ for name in words...; do commands-if-true; done #### Device commands .bulleted -- [`mount`]: bind another file system to a location in the file system -- [`umount`]: remove binding to a file system -- [`lsusb`]: lists USB devices -- [`lspci`]: lists PCI devices +- {` mount}: bind another file system to a location in the file system +- {` umount}: remove binding to a file system +- {` lsusb}: lists USB devices +- {` lspci}: lists PCI devices #### System information commands .bulleted -- [`date`]: display current date and time -- [`hostname`]: show (or set) the systems hostname (network name) -- [`free`]: display free memory on the system +- {` date}: display current date and time +- {` hostname}: show (or set) the systems hostname (network name) +- {` free}: display free memory on the system :slide @@ -1080,44 +1082,44 @@ for name in words...; do commands-if-true; done #### User and group management .bulleted -- [`useradd`]: creates a new user (with a password) -- [`userdel`]: remove a user and all of his files -- [`usermod`]: modify a user account, including his name and groups -- [`passwd`]: change password of a user. With [`-l`] user could be locked (impossible to log in) +- {` useradd}: creates a new user (with a password) +- {` userdel}: remove a user and all of his files +- {` usermod}: modify a user account, including his name and groups +- {` passwd}: change password of a user. With {` -l} user could be locked (impossible to log in) -[$br3] +{br3} .bulleted -- [`groupadd`]: create a new group -- [`groupdel`]: remove a group -- [`groupmod`]: modify an existing group +- {` groupadd}: create a new group +- {` groupdel}: remove a group +- {` groupmod}: modify an existing group -[$br3] +{br3} .bulleted -- [`w`]: show who is logged in and what they are doing -- [`who`]: show who is logged in -- [`whomai`]: print username -- [`login`]: establish a new connection to the system +- {` w}: show who is logged in and what they are doing +- {` who}: show who is logged in +- {` whomai}: print username +- {` login}: establish a new connection to the system :slide :bulleted -- [`/etc`]: system configuration files - [$br2] +- {` /etc}: system configuration files + {br2} :bulleted - - [`/etc/group`]: the data for all groups is stored here, in the format + - {` /etc/group}: the data for all groups is stored here, in the format ``` GROUPNAME:PASSWORD:GID:USERS... - - [`/etc/passwd`]: the data for all users is stored here, in the format + - {` /etc/passwd}: the data for all users is stored here, in the format ``` USERNAME:PASSWORD:UID:GID:USERINFO:HOMEDIR:SHELL - - [`/etc/shadow`]: stores other user data, especially the password as an encrypted string, in the format + - {` /etc/shadow}: stores other user data, especially the password as an encrypted string, in the format ``` USERNAME:PASSWORD:LASTCHANGED:MINBETWEENCHANGES:MAXBETWEENCHANGES:WARNEXPIRE:INACTIVEDAYS:EXPIRE @@ -1129,40 +1131,44 @@ USERNAME:PASSWORD:LASTCHANGED:MINBETWEENCHANGES:MAXBETWEENCHANGES:WARNEXPIRE:INA :bulleted -   :bulleted - - [`/etc/fstab`]: read on boot by mount to setup devices in fs + - {` /etc/fstab}: read on boot by mount to setup devices in fs ``` +'emplace # device-spec mount-point fs-type options dump pass /dev/sda1 / ext4 defaults 1 1 UUID=123A-456B /boot vfat noauto,noatime 1 2 LABEL=Vault /mnt/Vault auto nosuid,nodev,nofail 0 0 +'endemplace - - [`/etc/hosts`]: list of host names (domain names) and their corresponding IP address, when a DNS server doesn't do the job + - {` /etc/hosts}: list of host names (domain names) and their corresponding IP address, when a DNS server doesn't do the job ``` +'emplace # ipaddress domains 127.0.0.1 localhost mywebsite.com something.else 62.44.101.138 my.uni +'endemplace - - [`/etc/bashrc`]: global defaults and aliases used by the bash shell - - [`/etc/motd`]: message of the day (unexecuted text), shown after login but before the shell is ran + - {` /etc/bashrc}: global defaults and aliases used by the bash shell + - {` /etc/motd}: message of the day (unexecuted text), shown after login but before the shell is ran :middle_slide35 :bulleted -- [`/usr`]: other system resources +- {` /usr}: other system resources .bulleted - - [`/usr/lib`]: library files - - [`/usr/local`]: local, system software - - [`/usr/share`]: architecture independent data, like manuals + - {` /usr/lib}: library files + - {` /usr/local}: local, system software + - {` /usr/share}: architecture independent data, like manuals -- [`/var`]: variable data, like logs and cache -- [`/home`]: home directories of all users -- [`/lib`]: libraries and kernel modules -- [`/mnt`]: mounted temporary filesystems -- [`/root`]: home directory for the root user +- {` /var}: variable data, like logs and cache +- {` /home}: home directories of all users +- {` /lib}: libraries and kernel modules +- {` /mnt}: mounted temporary filesystems +- {` /root}: home directory for the root user @@ -1179,9 +1185,9 @@ For software, such a license is applied to the source code from which the origin Some commonly used ones, with a (NON-LEGALLY BINDING) summary include: .bulleted -- [url https://en.wikipedia.org/wiki/MIT_License MIT]: the author is not responsible for anything that the code does -- [url https://en.wikipedia.org/wiki/BSD_licenses BSD-3-Clause]: use the same license (copyleft), the author is not responsible for anything that the code does -- [url https://en.wikipedia.org/wiki/GNU_General_Public_License GNU GPL]: disclose the original project and use the same license ([url https://en.wikipedia.org/wiki/Copyleft copyleft]) +- {url MIT;https://en.wikipedia.org/wiki/MIT_License}: the author is not responsible for anything that the code does +- {url BSD-3-Clause;https://en.wikipedia.org/wiki/BSD_licenses}: use the same license (copyleft), the author is not responsible for anything that the code does +- {url GNU GPL;https://en.wikipedia.org/wiki/GNU_General_Public_License}: disclose the original project and use the same license ({url copyleft;https://en.wikipedia.org/wiki/Copyleft}) .p This is important, since pretty much everything can be freely modified by anyone (for the better or worse, but generally better). @@ -1191,19 +1197,19 @@ This is important, since pretty much everything can be freely modified by anyone # 5. What makes up a useful OS -[$br1] +{br1} .p A Linux-based operating system is nothing more than the Linux kernel, combined with an assortment of programs.\n -Overall, the main elements that make up a useful [*desktop*] operating system (alongside a command-line shell) are: +Overall, the main elements that make up a useful {i desktop} operating system (alongside a command-line shell) are: -[$br1] +{br1} .numbered -1. [=Bootloader=]: load the kernel and operating system -2. [=Init system=]: well managed way to start everything inside the OS -3. [=Package manager=]: way to manage our binaries -4. [=Desktop manager=]: graphical shell +1. {b Bootloader}: load the kernel and operating system +2. {b Init system}: well managed way to start everything inside the OS +3. {b Package manager}: way to manage our binaries +4. {b Desktop manager}: graphical shell :slide @@ -1221,10 +1227,10 @@ BIOS -> Master Boot Record -> Active Parition -> Bootloader -> -> Boot menu (optional) -> Kernel -> Everything else .bulleted -- [url https://en.wikipedia.org/wiki/BIOS BIOS]: a small chip with code that is ran upon power up -- [url https://en.wikipedia.org/wiki/Master_boot_record MBR]: small amount of space at the very start of the disk, that contains some (bootstrap) code and partition information. The BIOS hands off execution to the bootstrap code. +- {url BIOS;https://en.wikipedia.org/wiki/BIOS}: a small chip with code that is ran upon power up +- {url MBR;https://en.wikipedia.org/wiki/Master_boot_record}: small amount of space at the very start of the disk, that contains some (bootstrap) code and partition information. The BIOS hands off execution to the bootstrap code. - Active partition: MBR loads and runs code from the beginning of the partition (boot sector), which starts the bootloader -- [url https://en.wikipedia.org/wiki/Bootloader Bootloader]: the first complex program, which manages kernels, shows a menu, allows for debugging and so on +- {url Bootloader;https://en.wikipedia.org/wiki/Bootloader}: the first complex program, which manages kernels, shows a menu, allows for debugging and so on :middle_slide @@ -1234,10 +1240,10 @@ The BIOS is baked into the motherboard, the MBR is pretty universal (and it's le .p That leaves us with the need for a bootloader. -On Linux, the most used one is called [url https://en.wikipedia.org/wiki/GNU_GRUB GRUB]. +On Linux, the most used one is called {url GRUB;https://en.wikipedia.org/wiki/GNU_GRUB}. .p -It's config is found in [`/etc/default/grub`] (which is then fully generated with [`grub-mkconfig`]) and can be "installed in the partition" with [`grub-install`]. +It's config is found in {` /etc/default/grub} (which is then fully generated with {` grub-mkconfig}) and can be "installed in the partition" with {` grub-install}. ``` GRUB_DEFAULT=0 @@ -1257,12 +1263,13 @@ Now we need to load the user stuff, like a network manager, the graphical user i In Minimal Linux Live, this is done by some hard written scripts, which aren't very modular or extensible. .p -[url https://en.wikipedia.org/wiki/Init Init systems] use configuration files, called service, to start a program in some way. +{url Init systems;https://en.wikipedia.org/wiki/Init} use configuration files, called service, to start a program in some way. :bulleted -- [url https://en.wikipedia.org/wiki/Systemd systemd], which also aims to also provide easy system configuration +- {url systemd;https://en.wikipedia.org/wiki/Systemd}, which also aims to also provide easy system configuration - ```ini + 'def LANG ini + ``` [Unit] Description=Service [Service] @@ -1272,7 +1279,7 @@ ExecStart=/usr/local/sbin/script.sh [Install] WantedBy=multi-user.target -- [url https://en.wikipedia.org/wiki/OpenRC openrc], a simple and modern system +- {url openrc;https://en.wikipedia.org/wiki/OpenRC}, a simple and modern system @@ -1280,10 +1287,10 @@ WantedBy=multi-user.target ## 5.3. Package manager -[$br1] +{br1} .p -Programs are just executable files, usually placed in a specific folder, like [`/usr/bin`]. +Programs are just executable files, usually placed in a specific folder, like {` /usr/bin}. .bulleted - MLL comes with ~100 executables (and ~230 after my script) @@ -1310,7 +1317,7 @@ Additional benefits of package management automation include: - version caveats - (indirectly) improved stability because of maintainer compatibility checks -[$br1] +{br1} ``` apt install PKG @@ -1326,18 +1333,18 @@ apt upgrade A widow system is your graphical shell: the graphical way to interact with your computer (the kernel). It's main components are: -[$br1] +{br1} :bulleted -- [=Window manager=]: the overall system with which you create, remove, resize and work with windows. They are generally separated into two types: +- {b Window manager}: the overall system with which you create, remove, resize and work with windows. They are generally separated into two types: .bulleted - - [*Stacked*]: this is what you know, windows are just rectangles floating about, and can be put one over each other - - [*Tiled*]: windows take up a predefined (but changeable) portion of the screen + - {i Stacked}: this is what you know, windows are just rectangles floating about, and can be put one over each other + - {i Tiled}: windows take up a predefined (but changeable) portion of the screen -- [=Compositor=]: adds an unseen window buffer, allowing additional processing, before a window is shown. This powers transparency, animation effects and more. +- {b Compositor}: adds an unseen window buffer, allowing additional processing, before a window is shown. This powers transparency, animation effects and more. -- [=Session manager=]: graphical application that manages the window managers (outside WMs), think of it as a login window +- {b Session manager}: graphical application that manages the window managers (outside WMs), think of it as a login window @@ -1352,36 +1359,36 @@ A distribution is a complete set of of all applications that you might use. Overall, there are 4-5 distributions from which 90% of all other distros are based upon: .numbered -1. [url http://www.slackware.com/ Slackware]: +1. {url Slackware;http://www.slackware.com/}: as the oldest still maintained distro, it served as inspiration for a lot of other distros. It aims to be as simple and as close to UNIX as possible. -2. [url https://www.debian.org/ Debian] (and [url https://ubuntu.com/ Ubuntu]): +2. {url Debian;https://www.debian.org/} (and {url Ubuntu;https://ubuntu.com/}): it is the most popular distribution (if we also include Ubuntu). Ubuntu aims to be modern and fancy, while Debian aims to be as stable as possible, which makes it the most popular in server usage. -3. [url https://www.gentoo.org/ Gentoo]: +3. {url Gentoo;https://www.gentoo.org/}: the distribution which defined non-binary software distribution -4. [url https://archlinux.org/ Arch Linux]: +4. {url Arch Linux;https://archlinux.org/}: a very popular and modern distribution with the goal of providing the latest and greatest software. .p We haven't touched too much, but Linux distributions aren't limited to desktop or server computers. .numbered -1. [url https://en.wikipedia.org/wiki/Android_%28operating_system%29#AOSP AOSP]: the base of the whole Android operating system -2. [url https://en.wikipedia.org/wiki/OpenWrt OpenWRT]: a router operating system +1. {url AOSP;https://en.wikipedia.org/wiki/Android_%28operating_system%29#AOSP}: the base of the whole Android operating system +2. {url OpenWRT;https://en.wikipedia.org/wiki/OpenWrt}: a router operating system :slide35 # 7. Demos - virtual machine and setup from zero -[$br2] +{br2} .p Now for the best part: we'll be installing a Linux distribution on a virtual machine and then directly on a laptop, running Windows 10! .p -I've chosen to install [url https://linuxmint.com/ Linux Mint], since it is generally targeted towards newcomers and will feel familiar enough to Windows users. +I've chosen to install {url Linux Mint;https://linuxmint.com/}, since it is generally targeted towards newcomers and will feel familiar enough to Windows users. .p Currently there won't be an official recording of the process, you should've been here live! @@ -1401,27 +1408,27 @@ All of these contain, at most, small paraphrased sentences in the slides. They served as personal educational and reference tools. .bulleted -- [url https://en.wikipedia.org/ wikipedia] and [url https://stackexchange.com/ stackexchange] have been used extensively and linked where appropriate. -- [url https://people.cs.rutgers.edu/~pxk/416/index.html CS416 - Operating Systems Design] by [url https://people.cs.rutgers.edu/~pxk/rutgers/ Paul Krzyzanowski] at [url https://www.cs.rutgers.edu/ Rutgers State University] -- [url https://web.archive.org/web/20220713165958/https://homepage.cs.uri.edu/~thenry/resources/unix_art/ch02s01.html Origins and History of UNIX, 1969-1995] from [url https://web.archive.org/web/20220611160552/https://homepage.cs.uri.edu/~thenry/resources/unix_art/index.html The Art of Unix Programming] by Eric Steven Raymond -- [url https://www.youtube.com/watch?v=EY6q5dv_B-o Ken Thompson interviewed by Brian Kernighan at VCF East 2019] by [url https://vcfed.org/ Vintage Computer Federation] -- [url http://www.cs.uah.edu/~kkeen/CS590/Pseudo%20Terminals.ppt Pseudo Terminals presentation] from [url http://www.cs.uah.edu/~kkeen/CS590/ CS590] by [url http://www.cs.uah.edu/~kkeen/kkeen.html Kevin J. Keen] at [url https://www.uah.edu/ University of Alabama in Huntsville] -- [url https://teaching.idallen.com/dat2330/04f/notes/links_and_inodes.html Hard links and Unix file system nodes] from [url https://teaching.idallen.com/dat2330/04f/ DAT 2330 Introduction to Operating Systems] by [url http://www.idallen.com/ Ian D. Allen] -- [url https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/9_VirtualMemory.html Virtual Memory, OS Course Notes] by [url https://www.cs.uic.edu/~jbell/ Dr. John T. Bell] at [url https://www.cs.uic.edu University of Illinois Chicago],\n - which is directly based on [url https://archive.org/details/operating-system-concepts-9e Operating System Concepts, 9th Edition] by [url https://codex.cs.yale.edu/avi/ Abraham Silberschatz] -- [url http://csapp.cs.cmu.edu/3e/home.html Chapter 9 Preview - Virtual Memory] from [url http://csapp.cs.cmu.edu/ Computer Systems: A Programmer's Perspective] by [url http://www.cs.cmu.edu/~bryant Randal E. Bryant] and [url http://www.cs.cmu.edu/~droh David R. O'Hallaron] -- [url https://www.cse.iitb.ac.in/~mythili/teaching/cs347_autumn2016/notes/07-memory.pdf Memory Management, Lecture Notes] by [url https://www.cse.iitb.ac.in/~mythili/ Mythili Vutukuru] -- [url http://www.cs.iit.edu/~cs561/cs351/VM/paging%20advantages%20and%20disadvantages.html Paging advantages and disadvantages] by Charles R. Bauer at [url http://www.cs.iit.edu/ Computer Science Departmemnt of Illinois Institute of Technology] -- [url https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html Bash Reference Manual] by the [url https://www.gnu.org/ GNU project] and [url https://man.openbsd.org/ksh ksh manual] by the [url https://www.openbsd.org/ OpenBSD project] -- [url https://www.in-ulm.de/~mascheck/bourne/v7/ Manual of the Bourne Shell on Version 7], archived by [url https://www.in-ulm.de/~mascheck/ Sven Mascheck] -- [url https://www.linuxbase.org/betaspecs/fhs/fhs/ch04.html /usr hierarchy] from [url https://www.linuxbase.org/betaspecs/fhs/fhs/index.html Filesystem Hierarchy Standard] by [url https://www.linuxfoundation.org/ Linux Foundation], Daniel Quinlan, Paul 'Rusty' Russell, Christopher Yeoh -- [url https://www.pathname.com/fhs/pub/fhs-2.3.pdf Filesystem Hierarchy Standard] by Rusty Russel, Daniel Quinlan and Christopher Yeoh -- [url https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/usernames.html#FTN.AEN26405 User & Group Names] from [url https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/book1.html Linux Standard Base Core Specification] by [url https://en.wikipedia.org/wiki/Free_Standards_Group Free Standards Group] -- [url https://docstore.mik.ua/orelly/linux/run/ch05_07.htm Managing User Accounts] from [url https://docstore.mik.ua/orelly/linux/run/index.htm Running Linux, Third Edition] by Matt Welsh, Matthias Kalle Dalheimer, and Lar Kaufman -- [url https://neosmart.net/wiki/mbr-boot-process/ The BIOS/MBR Boot Process] by [url https://wiki.neosmart.net/ NeoSmart's Knowledgebase] +- {url wikipedia;https://en.wikipedia.org/} and {url stackexchange;https://stackexchange.com/} have been used extensively and linked where appropriate. +- {url CS416 - Operating Systems Design;https://people.cs.rutgers.edu/~pxk/416/index.html} by {url Paul Krzyzanowski;https://people.cs.rutgers.edu/~pxk/rutgers/} at {url Rutgers State University;https://www.cs.rutgers.edu/} +- {url Origins and History of UNIX, 1969-1995;https://web.archive.org/web/20220713165958/https://homepage.cs.uri.edu/~thenry/resources/unix_art/ch02s01.html} from {url The Art of Unix Programming;https://web.archive.org/web/20220611160552/https://homepage.cs.uri.edu/~thenry/resources/unix_art/index.html} by Eric Steven Raymond +- {url Ken Thompson interviewed by Brian Kernighan at VCF East 2019;https://www.youtube.com/watch?v=EY6q5dv_B-o} by {url Vintage Computer Federation;https://vcfed.org/} +- {url Pseudo Terminals presentation;http://www.cs.uah.edu/~kkeen/CS590/Pseudo%20Terminals.ppt} from {url CS590;http://www.cs.uah.edu/~kkeen/CS590/} by {url Kevin J. Keen;http://www.cs.uah.edu/~kkeen/kkeen.html} at {url University of Alabama in Huntsville;https://www.uah.edu/} +- {url Hard links and Unix file system nodes;https://teaching.idallen.com/dat2330/04f/notes/links_and_inodes.html} from {url DAT 2330 Introduction to Operating Systems;https://teaching.idallen.com/dat2330/04f/} by {url Ian D. Allen;http://www.idallen.com/} +- {url Virtual Memory, OS Course Notes;https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/9_VirtualMemory.html} by {url Dr. John T. Bell;https://www.cs.uic.edu/~jbell/} at {url University of Illinois Chicago;https://www.cs.uic.edu},\n + which is directly based on {url Operating System Concepts, 9th Edition;https://archive.org/details/operating-system-concepts-9e} by {url Abraham Silberschatz;https://codex.cs.yale.edu/avi/} +- {url Chapter 9 Preview - Virtual Memory;http://csapp.cs.cmu.edu/3e/home.html} from {url Computer Systems: A Programmer's Perspective;http://csapp.cs.cmu.edu/} by {url Randal E. Bryant;http://www.cs.cmu.edu/~bryant} and {url David R. O'Hallaron;http://www.cs.cmu.edu/~droh} +- {url Memory Management, Lecture Notes;https://www.cse.iitb.ac.in/~mythili/teaching/cs347_autumn2016/notes/07-memory.pdf} by {url Mythili Vutukuru;https://www.cse.iitb.ac.in/~mythili/} +- {url Paging advantages and disadvantages;http://www.cs.iit.edu/~cs561/cs351/VM/paging%20advantages%20and%20disadvantages.html} by Charles R. Bauer at {url Computer Science Departmemnt of Illinois Institute of Technology;http://www.cs.iit.edu/} +- {url Bash Reference Manual;https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html} by the {url GNU project;https://www.gnu.org/} and {url ksh manual;https://man.openbsd.org/ksh} by the {url OpenBSD project;https://www.openbsd.org/} +- {url Manual of the Bourne Shell on Version 7;https://www.in-ulm.de/~mascheck/bourne/v7/}, archived by {url Sven Mascheck;https://www.in-ulm.de/~mascheck/} +- {url /usr hierarchy;https://www.linuxbase.org/betaspecs/fhs/fhs/ch04.html} from {url Filesystem Hierarchy Standard;https://www.linuxbase.org/betaspecs/fhs/fhs/index.html} by {url Linux Foundation;https://www.linuxfoundation.org/}, Daniel Quinlan, Paul 'Rusty' Russell, Christopher Yeoh +- {url Filesystem Hierarchy Standard;https://www.pathname.com/fhs/pub/fhs-2.3.pdf} by Rusty Russel, Daniel Quinlan and Christopher Yeoh +- {url User & Group Names;https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/usernames.html#FTN.AEN26405} from {url Linux Standard Base Core Specification;https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/book1.html} by {url Free Standards Group;https://en.wikipedia.org/wiki/Free_Standards_Group} +- {url Managing User Accounts;https://docstore.mik.ua/orelly/linux/run/ch05_07.htm} from {url Running Linux, Third Edition;https://docstore.mik.ua/orelly/linux/run/index.htm} by Matt Welsh, Matthias Kalle Dalheimer, and Lar Kaufman +- {url The BIOS/MBR Boot Process;https://neosmart.net/wiki/mbr-boot-process/} by {url NeoSmart's Knowledgebase;https://wiki.neosmart.net/} # Licensing .p -Images on slides "2.1. shell" and "2.2. UNIX-style file system" are made by me and [url /license.html licensed as content].\n -The script [url http://syndamia.com/talks/linuxgraphy-by-strabo/mll-set.sh mll-set.sh] is licensed under MIT (though I don't see it as substatial enough to be licensed under anything). +Images on slides "2.1. shell" and "2.2. UNIX-style file system" are made by me and {url licensed as content;/license.html}.\n +The script {url mll-set.sh;http://syndamia.com/talks/linuxgraphy-by-strabo/mll-set.sh} is licensed under MIT (though I don't see it as substatial enough to be licensed under anything). diff --git a/src/teaching.du b/src/teaching.du index cf675b3..3888537 100644 --- a/src/teaching.du +++ b/src/teaching.du @@ -4,27 +4,27 @@ This is a list of all the subjects I've taught professionally. \n -#### [*2025 - 2026*] +#### {i 2025 - 2026} :defs -; [$bg] 2025-2026   [url https://learn.fmi.uni-sofia.bg/course/view.php?id=12341 З629 Универсални конфигурации с Nix] - [url https://github.com/universal-configurations-with-nix/fmi-2025-2026 лекции, материали и задачи] -: Хоноруван преподавател във [url https://www.fmi.uni-sofia.bg/ ФМИ] на избираем курс +; {bg} 2025-2026   {url З629 Универсални конфигурации с Nix;https://learn.fmi.uni-sofia.bg/course/view.php?id=12341} - {url лекции, материали и задачи;https://github.com/universal-configurations-with-nix/fmi-2025-2026} +: Хоноруван преподавател във {url ФМИ;https://www.fmi.uni-sofia.bg/} на избираем курс -; [$bg] 2025-2026   [url /teaching/oop-2025 З520 Обектно-ориентирано програмиране - практикум, КН, 5 група] -: Хоноруван преподавател във [url https://www.fmi.uni-sofia.bg/ ФМИ] на специалност [url https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki Компютърни науки] +; {bg} 2025-2026   {url З520 Обектно-ориентирано програмиране - практикум, КН, 5 група;/teaching/oop-2025} +: Хоноруван преподавател във {url ФМИ;https://www.fmi.uni-sofia.bg/} на специалност {url Компютърни науки;https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki} -; [$bg] 2025-2026   [url /teaching/upp-2025 3107 Увод в програмирането - практикум, КН, 5 група] -: Хоноруван преподавател във [url https://www.fmi.uni-sofia.bg/ ФМИ] на специалност [url https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki Компютърни науки] +; {bg} 2025-2026   {url 3107 Увод в програмирането - практикум, КН, 5 група;/teaching/upp-2025} +: Хоноруван преподавател във {url ФМИ;https://www.fmi.uni-sofia.bg/} на специалност {url Компютърни науки;https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki} -; [$bg] 2025   [url https://github.com/universal-configurations-with-nix Универсални конфигурации с Nix] - [url https://github.com/universal-configurations-with-nix/academy-2025 лекции, материали, задачи] и [url https://www.youtube.com/watch?v=QcHIeRtySxA&list=PLjPLCCBcJVpGfRHmHlucj3D7lbNkQZAH- записи] -: Преподавател в частна академия по Nix към [url https://blocksense.network blocksense.network] +; {bg} 2025   {url Универсални конфигурации с Nix;https://github.com/universal-configurations-with-nix} - {url лекции, материали, задачи;https://github.com/universal-configurations-with-nix/academy-2025} и {url записи;https://www.youtube.com/watch?v=QcHIeRtySxA&list=PLjPLCCBcJVpGfRHmHlucj3D7lbNkQZAH-} +: Преподавател в частна академия по Nix към {url blocksense.network;https://blocksense.network} -#### [*2023 - 2024*] +#### {i 2023 - 2024} :defs -; [$bg] 2023-2024   [url /teaching/oop-2023 З520 Обектно-ориентрано програмиране - практикум, КН, 8 група] -: Хоноруван преподавател във [url https://www.fmi.uni-sofia.bg/ ФМИ] на специалност [url https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki Компютърни науки] +; {bg} 2023-2024   {url З520 Обектно-ориентрано програмиране - практикум, КН, 8 група;/teaching/oop-2023} +: Хоноруван преподавател във {url ФМИ;https://www.fmi.uni-sofia.bg/} на специалност {url Компютърни науки;https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki} -; [$bg] 2023-2024   [url /teaching/upp-2023 3107 Увод в програмирането - практикум, КН, 8 група] -: Хоноруван преподавател във [url https://www.fmi.uni-sofia.bg/ ФМИ] на специалност [url https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki Компютърни науки] +; {bg} 2023-2024   {url 3107 Увод в програмирането - практикум, КН, 8 група;/teaching/upp-2023} +: Хоноруван преподавател във {url ФМИ;https://www.fmi.uni-sofia.bg/} на специалност {url Компютърни науки;https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki} diff --git a/src/teaching/index.du b/src/teaching/index.du index cf675b3..3888537 100644 --- a/src/teaching/index.du +++ b/src/teaching/index.du @@ -4,27 +4,27 @@ This is a list of all the subjects I've taught professionally. \n -#### [*2025 - 2026*] +#### {i 2025 - 2026} :defs -; [$bg] 2025-2026   [url https://learn.fmi.uni-sofia.bg/course/view.php?id=12341 З629 Универсални конфигурации с Nix] - [url https://github.com/universal-configurations-with-nix/fmi-2025-2026 лекции, материали и задачи] -: Хоноруван преподавател във [url https://www.fmi.uni-sofia.bg/ ФМИ] на избираем курс +; {bg} 2025-2026   {url З629 Универсални конфигурации с Nix;https://learn.fmi.uni-sofia.bg/course/view.php?id=12341} - {url лекции, материали и задачи;https://github.com/universal-configurations-with-nix/fmi-2025-2026} +: Хоноруван преподавател във {url ФМИ;https://www.fmi.uni-sofia.bg/} на избираем курс -; [$bg] 2025-2026   [url /teaching/oop-2025 З520 Обектно-ориентирано програмиране - практикум, КН, 5 група] -: Хоноруван преподавател във [url https://www.fmi.uni-sofia.bg/ ФМИ] на специалност [url https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki Компютърни науки] +; {bg} 2025-2026   {url З520 Обектно-ориентирано програмиране - практикум, КН, 5 група;/teaching/oop-2025} +: Хоноруван преподавател във {url ФМИ;https://www.fmi.uni-sofia.bg/} на специалност {url Компютърни науки;https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki} -; [$bg] 2025-2026   [url /teaching/upp-2025 3107 Увод в програмирането - практикум, КН, 5 група] -: Хоноруван преподавател във [url https://www.fmi.uni-sofia.bg/ ФМИ] на специалност [url https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki Компютърни науки] +; {bg} 2025-2026   {url 3107 Увод в програмирането - практикум, КН, 5 група;/teaching/upp-2025} +: Хоноруван преподавател във {url ФМИ;https://www.fmi.uni-sofia.bg/} на специалност {url Компютърни науки;https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki} -; [$bg] 2025   [url https://github.com/universal-configurations-with-nix Универсални конфигурации с Nix] - [url https://github.com/universal-configurations-with-nix/academy-2025 лекции, материали, задачи] и [url https://www.youtube.com/watch?v=QcHIeRtySxA&list=PLjPLCCBcJVpGfRHmHlucj3D7lbNkQZAH- записи] -: Преподавател в частна академия по Nix към [url https://blocksense.network blocksense.network] +; {bg} 2025   {url Универсални конфигурации с Nix;https://github.com/universal-configurations-with-nix} - {url лекции, материали, задачи;https://github.com/universal-configurations-with-nix/academy-2025} и {url записи;https://www.youtube.com/watch?v=QcHIeRtySxA&list=PLjPLCCBcJVpGfRHmHlucj3D7lbNkQZAH-} +: Преподавател в частна академия по Nix към {url blocksense.network;https://blocksense.network} -#### [*2023 - 2024*] +#### {i 2023 - 2024} :defs -; [$bg] 2023-2024   [url /teaching/oop-2023 З520 Обектно-ориентрано програмиране - практикум, КН, 8 група] -: Хоноруван преподавател във [url https://www.fmi.uni-sofia.bg/ ФМИ] на специалност [url https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki Компютърни науки] +; {bg} 2023-2024   {url З520 Обектно-ориентрано програмиране - практикум, КН, 8 група;/teaching/oop-2023} +: Хоноруван преподавател във {url ФМИ;https://www.fmi.uni-sofia.bg/} на специалност {url Компютърни науки;https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki} -; [$bg] 2023-2024   [url /teaching/upp-2023 3107 Увод в програмирането - практикум, КН, 8 група] -: Хоноруван преподавател във [url https://www.fmi.uni-sofia.bg/ ФМИ] на специалност [url https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki Компютърни науки] +; {bg} 2023-2024   {url 3107 Увод в програмирането - практикум, КН, 8 група;/teaching/upp-2023} +: Хоноруван преподавател във {url ФМИ;https://www.fmi.uni-sofia.bg/} на специалност {url Компютърни науки;https://www.fmi.uni-sofia.bg/bg/kompyutrni-nauki} diff --git a/src/teaching/oop-2023/index.du b/src/teaching/oop-2023/index.du index 1cd59f5..e4963a6 100644 --- a/src/teaching/oop-2023/index.du +++ b/src/teaching/oop-2023/index.du @@ -1,82 +1,86 @@ -# Обектно-ориентирано програмиране - практикум, Компютърни науки, 8 група +'def title Обектно-ориентирано програмиране - практикум, Компютърни науки, 8 група +'def desc Материали на проведените през 2023/2024 практикуми по Обектно-ориентирано програмиране на Компютърни науки (2 поток), 8 група. + +# {title} Материали на проведените през 2023/2024 практикуми по Обектно-ориентирано програмиране на Компютърни науки (2 поток), 8 група. -[=Зала:=] ФМИ 120 || -[=Време:=] 13:15 - 15:00 || -[=Ден:=] Четвъртък -\n -[=Директни връзки:=] -[url ../upp-2023/week1/welcome.html?a#section-4 Контакт с мен] | -[url https://github.com/Syndamia/oop-2023-solutions Решения на задачи] | -[url https://github.com/Aleksis99/Object-Oriented-Programming_FMI_2023-2024 Материали от семинари] | -[url https://learn.fmi.uni-sofia.bg/course/view.php?id=10041 Курс в мудъл] +{b Зала:} ФМИ 120 || +{b Време:} 13:15 - 15:00 || +{b Ден:} Четвъртък +<br/> +{b Директни връзки:} +{url Контакт с мен;../upp-2023/week1/welcome.html?a#section-4} | +{url Решения на задачи;https://github.com/Syndamia/oop-2023-solutions} | +{url Материали от семинари;https://github.com/Aleksis99/Object-Oriented-Programming_FMI_2023-2024} | +{url Курс в мудъл;https://learn.fmi.uni-sofia.bg/course/view.php?id=10041} -:table_3 +:table +:3 |= № |= Дата |= Материали |: 1 |: 22.02.2024 -|: [url ./week1/organization.html?a Организационно] \|\| [url ./week1/good-software.html?a Основни добри софтуерни практики] \|\| [url ./week1/ Задачи] \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week01 Решения] \|\| [url https://classroom.github.com/a/UPJOzHty GitHub classroom] +|: {url Организационно;./week1/organization.html?a} || {url Основни добри софтуерни практики;./week1/good-software.html?a} || {url Задачи;./week1/} || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week01} || {url GitHub classroom;https://classroom.github.com/a/UPJOzHty} |: 2 |: 29.02.2024 -|: [url ./week2/ Задачи] \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week02 Решения] \|\| [url https://classroom.github.com/a/3qPsfyyI GitHub classroom] +|: {url Задачи;./week2/} || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week02} || {url GitHub classroom;https://classroom.github.com/a/3qPsfyyI} |: 3 |: 07.03.2024 -|: [url ./week3/ Задачи] \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week03 Решения] \|\| [url https://classroom.github.com/a/KPMqXsFp GitHub classroom] +|: {url Задачи;./week3/} || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week03} || {url GitHub classroom;https://classroom.github.com/a/KPMqXsFp} |: 4 |: 14.03.2024 -|: [url ./week4/ Задачи] \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week04 Решения] \|\| [url https://classroom.github.com/a/qa_FfWeG GitHub classroom] +|: {url Задачи;./week4/} || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week04} || {url GitHub classroom;https://classroom.github.com/a/qa_FfWeG} |: 5 |: 21.03.2024 -|: [url ./week5/ Задачи] \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week05 Решения] \|\| [url https://classroom.github.com/a/42ZZ56Mg GitHub classroom] +|: {url Задачи;./week5/} || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week05} || {url GitHub classroom;https://classroom.github.com/a/42ZZ56Mg} |: 6 |: 28.03.2024 -|: [url ./week6/ Задачи] \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week06 Решения] \|\| [url https://classroom.github.com/a/rzSTn5pu GitHub classroom] +|: {url Задачи;./week6/} || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week06} || {url GitHub classroom;https://classroom.github.com/a/rzSTn5pu} |: 7 |: 04.04.2024 -|: [url ./week7/ Задачи] \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week07 Решения] \|\| [url https://classroom.github.com/a/vvZENbkX GitHub classroom] +|: {url Задачи;./week7/} || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week07} || {url GitHub classroom;https://classroom.github.com/a/vvZENbkX} |: 8 |: 11.04.2024 -|: [url ./week8/ Задачи] \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week08 Решения] \|\| [url https://classroom.github.com/a/7d0MBjcK GitHub classroom] +|: {url Задачи;./week8/} || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week08} || {url GitHub classroom;https://classroom.github.com/a/7d0MBjcK} |: 9 |: 18.04.2024 -|: [url ./week9/ Задачи] \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week09 Решения] \|\| [url https://classroom.github.com/a/wlL1oUg2 GitHub classroom] +|: {url Задачи;./week9/} || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week09} || {url GitHub classroom;https://classroom.github.com/a/wlL1oUg2} |: 10 |: 25.04.2024 -|: [url ./week10/ Задачи] \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week10 Решения] \|\| [url https://classroom.github.com/a/PbkITWhF GitHub classroom] +|: {url Задачи;./week10/} || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week10} || {url GitHub classroom;https://classroom.github.com/a/PbkITWhF} |: 11 |: 09.05.2024 -|: [url ./week11/ Задачи] \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week11 Решения] \|\| [url https://classroom.github.com/a/oYQehcnN GitHub classroom] [=Това упражнение е от 11:15 до 13:15=] +|: {url Задачи;./week11/} || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week11} || {url GitHub classroom;https://classroom.github.com/a/oYQehcnN} {b Това упражнение е от 11:15 до 13:15} |: 12 |: 09.05.2024 -|: [url ./week12/ Задачи] \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week12 Решения] \|\| [url https://classroom.github.com/a/o7hNz1pr GitHub classroom] +|: {url Задачи;./week12/} || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week12} || {url GitHub classroom;https://classroom.github.com/a/o7hNz1pr} |: 13 |: 16.05.2024 -|: [url ./week13/ Задачи] \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week13 Решения] \|\| [url https://classroom.github.com/a/GvV1wrC1 GitHub classroom] +|: {url Задачи;./week13/} || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week13} || {url GitHub classroom;https://classroom.github.com/a/GvV1wrC1} |: 14 |: 23.05.2024 -|: [url ./week14/ Задачи] <!-- \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week12 Решения] --> \|\| [url https://classroom.github.com/a/K0XomKEP GitHub classroom] +|: {url Задачи;./week14/} <!-- || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week12} --> || {url GitHub classroom;https://classroom.github.com/a/K0XomKEP} |: 15 |: 30.05.2024 -|: [url ./week15/ Задачи] <!-- \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week12 Решения] --> \|\| [url https://classroom.github.com/a/z2QadyEE GitHub classroom] [=Това упражнение е от 11:15 до 13:15=] +|: {url Задачи;./week15/} <!-- || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week12} --> || {url GitHub classroom;https://classroom.github.com/a/z2QadyEE} {b Това упражнение е от 11:15 до 13:15} |: 16 |: 06.06.2024 -|: [url ./week16/ Задачи] <!-- \|\| [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week12 Решения] --> \|\| [url https://classroom.github.com/a/BWjw2dUC GitHub classroom] +|: {url Задачи;./week16/} <!-- || {url Решения;https://github.com/Syndamia/oop-2023-solutions/tree/main/week12} --> || {url GitHub classroom;https://classroom.github.com/a/BWjw2dUC} diff --git a/src/teaching/oop-2023/week1/good-software.du b/src/teaching/oop-2023/week1/good-software.du index 3f8fd9a..bb19eb0 100644 --- a/src/teaching/oop-2023/week1/good-software.du +++ b/src/teaching/oop-2023/week1/good-software.du @@ -1,4 +1,7 @@ -# Основни добри софтуерни практики - ООП, Седмица 1, 22.02.2024 +'def title Основни добри софтуерни практики - ООП, Седмица 1, 22.02.2024 +'def desc Миналия семестър не ни стигна времето да обсъдим домашното по-сериозно. Главния проблем, който забелязах, беше колко грозно и нагласено бяха написани решенията. Ще поговорим по тази тема. + +# {title} \n @@ -6,7 +9,7 @@ Главния проблем, който забелязах, беше колко грозно и нагласено бяха написани решенията. Като въведение в ООП, ще поговорим по тази тема. -[$presentation-controller] +{presentation-controller} :title_slide @@ -18,7 +21,7 @@ ## Какво прави програмиста с чужд код? -[$br4] +{br4} .numbered 1. Чете @@ -32,17 +35,19 @@ ## Подобряване на четене -[$br4] +{br4} .unordered - Лично вярвам, че четимост е по-важна от конвенции - Човек вижда най-лесно "контрастни" шаблони ``` +'emplace . . 0.00.0 010010 815213 000000 000000 738438 . . .0000. 100001 122481 .... 0....0 011110 511119 +'endemplace Както виждате, в примера има усмихнато личице, "закодирано" по различни начини. @@ -54,7 +59,7 @@ :middle_slide -Труден за четене код [*(забелязвате ли грешките?)*]: +Труден за четене код {i (забелязвате ли грешките?)}: .font22 ``` @@ -84,7 +89,7 @@ if (board[a][b][i] == ' ') { :middle_slide -По-лесен за четене код [*(а сега виждат ли се по-лесно?)*]: +По-лесен за четене код {i (а сега виждат ли се по-лесно?)}: :font18 :code @@ -120,7 +125,7 @@ for (int i = 0; i < layers; i++) -Би трябвало да е малко по-лесно, в последния [`if`] имаме "e[=n=]ptyRow", което е печатната грешка, [`!=`] което трябва да бъде [`==`] и липсва въвеждането на [`b`] след първия [`if`]. +Би трябвало да е малко по-лесно, в последния {` if} имаме "e{b n}ptyRow", което е печатната грешка, {` !=} което трябва да бъде {` ==} и липсва въвеждането на {` b} след първия {` if}. Примерът не е перфектен, но илюстрира какво се опитвам да кажа: формата на код е от огромно значение, обръщайте ѝ внимание. @@ -130,20 +135,20 @@ for (int i = 0; i < layers; i++) ## Абстракцията - улеснява изучаване И употреба/модификация -[$br1] +{br1} .bulleted - Разделяме обработване на стойностите от директната имплементацията - Създаваме нови "машинни инструкции" -[$br1] +{br1} .bulleted -- [`doX()`] е по-лошо от [`do(X)`] +- {` doX()} е по-лошо от {` do(X)} .unordered - - можем да преизползваме [`do()`] за неща, различни от [`X`] - - един път разбрано, всяка употреба на [`do()`] също е разбрана; този стил кара [`do()`] да бъде по-обща функция, което я прави по-лесна за разбиране - - модификация на [`do(X)`] се свежда до заменяне на [`do()`] с [`doOther()`] или до заменяне на [`X`] с [`Y`]; променяме "инструкцията" или променяме данната + - можем да преизползваме {` do()} за неща, различни от {` X} + - един път разбрано, всяка употреба на {` do()} също е разбрана; този стил кара {` do()} да бъде по-обща функция, което я прави по-лесна за разбиране + - модификация на {` do(X)} се свежда до заменяне на {` do()} с {` doOther()} или до заменяне на {` X} с {` Y}; променяме "инструкцията" или променяме данната Нека сега разгледаме няколко примера, първият е много груб и елементарен, но служи за добро начало: @@ -168,14 +173,14 @@ int fib5() │ int fib(int n) Би трябвало да е супер очевидно, никой няма да пише отделна функция на Фибоначи за всяко число. -Нека сега да разгледаме няколко "реални" примера, свързани с домашното (за припомняне, условието се намира [url https://learn.fmi.uni-sofia.bg/mod/assign/view.php?id=296069 тук]). +Нека сега да разгледаме няколко "реални" примера, свързани с домашното (за припомняне, условието се намира {url тук;https://learn.fmi.uni-sofia.bg/mod/assign/view.php?id=296069}). Самите решения няма винаги да са добре форматирани, това е направено с цел да се поберат добре в слайда. Първия е върху функция, която приема координатите на плочка, премахва я от дъската (ако съществува) и я слага в края на празния ред. :slide -Лошо - [`doX()`] в тялото на функцията +Лошо - {` doX()} в тялото на функцията ```cpp void tryTakeTile(char** board, int rows, int cols, @@ -201,16 +206,16 @@ void tryTakeTile(char** board, int rows, int cols, Повечето предадени работи са имплементирали функционалността по точно този начин. Замислете се обаче, какво става ако сменим типа данна, тоест ако дъската е триизмерна? -Тогава трябва да добавим още една [`int`] променлива, още едно условие в [`if`], трябва да я добавим при трите индексирания на [`board`]. +Тогава трябва да добавим още една {` int} променлива, още едно условие в {` if}, трябва да я добавим при трите индексирания на {` board}. -Какво става ако променим самата структура от данни за [`emptyRow`] (за сега сте учили само масиви, но скоро ще видите, че има и други начини да съхраняваш редица информация), тогава ще трябва да пренапишем целия цикъл. +Какво става ако променим самата структура от данни за {` emptyRow} (за сега сте учили само масиви, но скоро ще видите, че има и други начини да съхраняваш редица информация), тогава ще трябва да пренапишем целия цикъл. Тоест, ако променим нещо, трябва да пренапишем значителни части от самия код, и като разширим това върху 10-20 функции, изведнъж малка промяна става голяма. Нека сега да пренапишем функцията, използвайки колкото се може повече абстракция. :middle_slide -Добро - [`do(X)`] +Добро - {` do(X)} :code_cpp bool tryReadCoordinates(int& x, int& y) { @@ -233,9 +238,9 @@ void tryTakeTile(char** board, int rows, int cols, -Искаме трето измерение на [`board`]? -Няма проблем, написали сме нова [`tryReadCoordinates`], която приема три променливи, и в [`tryTakeTile`] добавяме една декларация и обновяваме двете индексирания на [`board`]. -Ако [`emptyRow`] стане друг тип данна, просто променяме функцията да бъде [`appendToOtherDataType`] и сме готови. +Искаме трето измерение на {` board}? +Няма проблем, написали сме нова {` tryReadCoordinates}, която приема три променливи, и в {` tryTakeTile} добавяме една декларация и обновяваме двете индексирания на {` board}. +Ако {` emptyRow} стане друг тип данна, просто променяме функцията да бъде {` appendToOtherDataType} и сме готови. И ако тази промяна трябва да се направи в много функции, даже бихме могли да употребяваме функционалност на самия текстов редактор да търси и заменя срещания на един низ с друг. @@ -244,7 +249,7 @@ void tryTakeTile(char** board, int rows, int cols, :slide -Лошо - всички цикли са [`doX()`] +Лошо - всички цикли са {` doX()} ```cpp void generateLayer(char** layer, int rows, int cols, @@ -272,15 +277,15 @@ void generateLayer(char** layer, int rows, int cols, Този сегмент е по-интересен за променяне от преди, понеже за да го направим хубаво трябва да променим самата ни логика. Запълването със шпации е ясно, обаче случайното поставяне на плочки не е. -Ако имаме функция [`placeRandomЕлемент`] която само поставя една плочка в слоя, пак ще имаме вложени цикли, трябва да има начин да останем с един цикъл. -Ако направим [`placeRandomElementNTimes`], тогава пък абстрахираната функция става твърде специфична и вече имаме [`doX()`] при самата нея. +Ако имаме функция {` placeRandomЕлемент} която само поставя една плочка в слоя, пак ще имаме вложени цикли, трябва да има начин да останем с един цикъл. +Ако направим {` placeRandomElementNTimes}, тогава пък абстрахираната функция става твърде специфична и вече имаме {` doX()} при самата нея. Чрез функционално програмиране този проблем може да се разреши лесно, обаче вие ще го учите следващия семестър. С достатъчно размишления, може да стигнем до следния вариант: вместо всяка плочка да я поставяме на случайна позиция, защо не поставим всички плочки една след друга и не разбъркаме слоя? :middle_slide -Добро - [`do(X)`] +Добро - {` do(X)} ```cpp void generateLayer(char** layer, int rows, int cols, @@ -296,7 +301,7 @@ void generateLayer(char** layer, int rows, int cols, shuffleMatrix(layer, rows, cols); } -[=Бонус:=] работи по-коректно от преди +{b Бонус:} работи по-коректно от преди В предходния вариант, ако примерно цялата е пълна освен една клетка, и трябва да поставим една финална плочка, тогава трябва да чакаме докато случайните стойности се напаснат точно с координатите на тази една клетка. @@ -304,14 +309,14 @@ void generateLayer(char** layer, int rows, int cols, Даже, този проблем става все по-тегав с времето: с всяка запълнена клетка, шанса случайните стойности да ударят на заети координати се увеличава. Докато тук, нямаме този проблем, отнема някакво консистентно предопределено време да разбъркаме матрицата. -Как имплементираме [`shuffleMatrix`] си има и своите тънкости, но най-елементарния начин е просто да направим сортираш алгоритъм, при който вместо да сравним две стойности, използваме случайна стойност, която определя дали ще разменим плочките. +Как имплементираме {` shuffleMatrix} си има и своите тънкости, но най-елементарния начин е просто да направим сортираш алгоритъм, при който вместо да сравним две стойности, използваме случайна стойност, която определя дали ще разменим плочките. Друго хубаво нещо на решения с абстракция, е един лек лавинен ефект, където веднъж като почнем да мислим за абстракции, намираме къде да ги ползваме навсякъде. Да разгледаме същата функция, обаче при D подточка. :middle_slide -Решения със слоеве правят същото. Лошо - [`doX()`] при циклите: +Решения със слоеве правят същото. Лошо - {` doX()} при циклите: ```cpp void generate(char*** board, int rows, int cols, int layers, @@ -325,13 +330,13 @@ void generate(char*** board, int rows, int cols, int layers, } -Без абстракция отново ще пренапишем голяма част от [`generate`] функцията, за да се побере на слайда съм оставил само "най-сложната" промяна - случайните стойности. -Пак, имаше решения на подточката, без преизползване на [`generate`] за един слой. -Айде да разгледаме решението, заедно с абстрахираната [`generate`]. +Без абстракция отново ще пренапишем голяма част от {` generate} функцията, за да се побере на слайда съм оставил само "най-сложната" промяна - случайните стойности. +Пак, имаше решения на подточката, без преизползване на {` generate} за един слой. +Айде да разгледаме решението, заедно с абстрахираната {` generate}. :slide -Добро - [`do(X)`] +Добро - {` do(X)} ```cpp void generateLayer(char** layer, int rows, int cols, @@ -357,14 +362,14 @@ void generate(char*** board, int rows, int cols, int layers, Супер елементарно, има-няма 5-6 реда код промяна, при генериране за всеки слой, просто извикваме функцията за генериране върху един слой, за всеки слой. А в самата функция само премахваме броя вмъкнати плочки от сумата на даден тип. -Наблюдателните са забелязали, че в "ръчното" решение слоевете са третия индекс, тоест имаме [`board[x][y][layer]`], докато в това решение е първия, тоест [`board[layer][x][y]`]. +Наблюдателните са забелязали, че в "ръчното" решение слоевете са третия индекс, тоест имаме {` board[x][y][layer]}, докато в това решение е първия, тоест {` board[layer][x][y]}. Разликата е значителна, но от гледна точка на код, особено когато използваме абстракция, промяната е лесна. Иначе, в момента се намираме в много добра позиция, без абстракция как правим рестартирането на играта? По условие броя и типовете плочки трябва да се запазят, но позиции не. Истината е, че става малко тромаво: цикълът за намираме на позиции се преизползва, и броя плочки трябва да се запази. -Обаче, сега това става с едно [`shuffleMatrix`], не е нужно нищо специално да правим! +Обаче, сега това става с едно {` shuffleMatrix}, не е нужно нищо специално да правим! :middle_slide35 @@ -372,7 +377,7 @@ void generate(char*** board, int rows, int cols, int layers, .unordered - Целта на коментарите е да направи разбиране и модификация на код по-лесни. -- В повечето случаи, коментарът трябва да ни дава [*нова*] информация или да [*свърже*] парчета информация +- В повечето случаи, коментарът трябва да ни дава {i нова} информация или да {i свърже} парчета информация Да разгледаме следния пример. @@ -401,7 +406,7 @@ for (int i = 0; i < rows; i++) { } -При добрия вариант, получаваме нова информация, че това запълване се случва понеже ще подаваме към някаква си [`functionX`], и че евентуално може да има други функции, при които празни клетки може да не се обозначават с [`'\0'`]. +При добрия вариант, получаваме нова информация, че това запълване се случва понеже ще подаваме към някаква си {` functionX}, и че евентуално може да има други функции, при които празни клетки може да не се обозначават с {` '\0'}. В лошия можем да стигнем до същото заключение като погледнем самия код. :comment @@ -412,9 +417,9 @@ for (int i = 0; i < rows; i++) { .quote For practical reasons, the demonstration programs must be small, many times smaller than the "life-size programs" I have in mind. My basic problem is that precisely this difference in scale is one of the major sources of our difficulties in programming! -— Edsger W. Dijkstra, [url https://www.cs.utexas.edu/users/EWD/ewd02xx/EWD249.PDF Notes on Structured Programming, On our inability to do much] +— Edsger W. Dijkstra, {url Notes on Structured Programming, On our inability to do much;https://www.cs.utexas.edu/users/EWD/ewd02xx/EWD249.PDF} -[$br1] +{br1} Решение на цялото домашно, с описаните методи TODO @@ -424,13 +429,13 @@ for (int i = 0; i < rows; i++) { -Умението да разрешиш един проблем [*не те*] прави добър програмист, да го разрешиш по четим, разширяем, лесен, ефикасен, ... начин [*те*] прави добър програмист. +Умението да разрешиш един проблем {i не те} прави добър програмист, да го разрешиш по четим, разширяем, лесен, ефикасен, ... начин {i те} прави добър програмист. :slide35 ## Изводи -[$br4] +{br4} .unordered - Форматирайте/подравнявайте си кода, искате лесно четене diff --git a/src/teaching/oop-2023/week1/index.du b/src/teaching/oop-2023/week1/index.du index f229343..5dd5787 100644 --- a/src/teaching/oop-2023/week1/index.du +++ b/src/teaching/oop-2023/week1/index.du @@ -1,17 +1,20 @@ -# Задачи - ООП, Седмица 1, 22.02.2024 +'def title Задачи - ООП, Седмица 1, 22.02.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/UPJOzHty classroom.github.com/a/UPJOzHty] +GitHub classroom: {url classroom.github.com/a/UPJOzHty;https://classroom.github.com/a/UPJOzHty} ## Задача 1 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise1.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise1.cpp} Имплементирайте низ чрез структура. В структурата трябва да запазвате указател към низа и неговата дължина. -Имплементирайте функция [`concatString`], която приема две структури от този тип и връща низ, пак в същата структура, който е конкатенация (слепване) на първите два низа. +Имплементирайте функция {` concatString}, която приема две структури от този тип и връща низ, пак в същата структура, който е конкатенация (слепване) на първите два низа. .question Има ли значение дали типовете на аргументите, или на върнатата стойност, са референции или указатели (или нито едното)? @@ -19,35 +22,36 @@ GitHub classroom: [url https://classroom.github.com/a/UPJOzHty classroom.github. ## Задача 2 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise2.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise2.cpp} Имплементирайте структура за динамично-заделен масив от целочислени числа. Тя трябва да запазва указател към масива, размера на масива и бройката на елементи в масива. Заделянето на динамична памет е бавна операция, затова винаги ще заделяме повече клетки, отколкото са ни нужни. -Имплементирайте функция [`resize`], която удвоява размера на масива (нека първоначалния размер на масива е 2), на подадена стойност от тип вашата структура. +Имплементирайте функция {` resize}, която удвоява размера на масива (нека първоначалния размер на масива е 2), на подадена стойност от тип вашата структура. -Имплементирайте функция [`addToEnd`], която приема (инстанция на) структурата ви и вмъква елемент в първата незаета позиция. +Имплементирайте функция {` addToEnd}, която приема (инстанция на) структурата ви и вмъква елемент в първата незаета позиция. В самия код тествайте функциите (не е нужен потребителски вход). ## Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise3.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise3.cpp} Разглеждате "пакети" (логове) информация от редица датчици. Един пакет запазва времето, когато информацията е била отчетена от датчиците, и стойностите на всички датчици: температура, атмосферно налягане, влажност и надморска височина. Всички типове данни са целочислени. От входа получавате N, броя пакети, които трябва да запазите, и след това 5N на брой целочислени стойности. -Накрая получавате буква: [`t`], [`p`], [`h`], [`e`], всяка съответства на някоя отделна стойност от датчиците. +Накрая получавате буква: {` t}, {` p}, {` h}, {` e}, всяка съответства на някоя отделна стойност от датчиците. Трябва да изкарате на екрана всичките стойности от пакетите, подредени в нарастващ ред на времето, като всички след първата са разликите им спрямо първата. -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -65,29 +69,31 @@ p |: -15 87 109 79 3 75 + ## Задача 4 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise4.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise4.cpp} -'footnote sabre Защото една от първите индустрии, които са се нуждаели от компютърни системи, била [url https://en.wikipedia.org/wiki/Sabre_%28travel_reservation_system%29#History авиационната индустрия]. +'footnote sabre Защото една от първите индустрии, които са се нуждаели от компютърни системи, била {url авиационната индустрия;https://en.wikipedia.org/wiki/Sabre_%28travel_reservation_system%29#History}. -Направете структура за съхранение на полети[$sabre]. +Направете структура за съхранение на полети{sabre}. Трябва да запазите имената на началния и крайния град като низове (допускаме, че няма шпации в имената на градовете), часът на излитане и на кацане в целочислен формат (като на циферблат на дигитален часовник, без разделителното двоеточие) и цената на полета в тип с плаваща запетая (в долари). ### а) въвеждане -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise4.cpp#L15-L36 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise4.cpp#L15-L36} От входа получавате N, това определя броя полети, които трябва да се добавят в системата. Всеки полет е редица от 5 стойности, в реда в който са дефинирани. -[*Напомням, че това е нагласено да ползвате [`std::cin`] вместо ръчно да обработвате целия ред.*] +{i Напомням, че това е нагласено да ползвате {` std::cin} вместо ръчно да обработвате целия ред.} Изкарайте началните и крайните градове, както и цената на полетите, подредени в нарастващ ред на час на излитане. -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -109,9 +115,10 @@ Berlin Paris 140 Paris NewYork 500 + ### б) търсене -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise4.cpp#L38-L247 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise4.cpp#L38-L247} След като се въведат всички полети, получавате от входа два низа - имена на градове. Трябва да изкарате най-евтиния, и след него най-бързия, вариант за пътуване от първия град към втория. @@ -119,9 +126,10 @@ Paris NewYork 500 Прикачване между полети е позволено, така че под "вариант" трябва да изкарате всичките полети, които са решение. За един полет е нужно да изкарате само началния град, крайния град, час на излитане и цена, като градовете трябва да са подредени в нарастващ ред на часа на излитане. -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -144,11 +152,12 @@ Quickest: Sofia NewYork 0610 800 + ## Задача 5 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise5.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week01/Exercise5.cpp} -Имате система за потребители, всеки потребител си има име и приятели (един приятел е [=указател към потребител=]). +Имате система за потребители, всеки потребител си има име и приятели (един приятел е {b указател към потребител}). В началото се въвежда N, това е броят потребители в системата. За един потребител, първо се въвежда на нов ред името му, след това броя на неговите приятели и накрая, на отделни редове, имената на всички тези приятели. @@ -156,9 +165,10 @@ Sofia NewYork 0610 800 Накрая получавате едно име, това е началния потребител. Трябва да намерите, започвайки от него, с колко други потребителя има някаква приятелска връзка (директна, приятел на приятел, приятел на приятел на приятел, ...). -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход diff --git a/src/teaching/oop-2023/week1/organization.du b/src/teaching/oop-2023/week1/organization.du index 3732566..b16b1f3 100644 --- a/src/teaching/oop-2023/week1/organization.du +++ b/src/teaching/oop-2023/week1/organization.du @@ -1,8 +1,11 @@ -# Организация - ООП, Седмица 1, 22.02.2024 +'def title Организация - ООП, Седмица 1, 22.02.2024 +'def desc Организационни бележки и новини + +# {title} \n -[$presentation-controller] +{presentation-controller} :title_slide35 @@ -39,16 +42,16 @@ :middle_slide35 :unordered -- Зачитат се [=единствено нещата, качени в GitHub classroom, качени в срок=] +- Зачитат се {b единствено нещата, качени в GitHub classroom, качени в срок} .unordered - - До [=15=] минути след края на часа + - До {b 15} минути след края на часа - Както преди, не е нужно да присъствате, за да качвате решения - Ако случайно някой не знае как се ползва: -.centered [url ../upp-2023/week1/setup.html?a syndamia.com/upp-2023/week1/setup.html?a] +.centered {url syndamia.com/upp-2023/week1/setup.html?a;../upp-2023/week1/setup.html?a} Който по време на УП е използвал GitHub classroom не би трябвало да прави нещо, продължавате си по старо му, със същите акаунти. -Разбира се, за всякакви проблеми се [url ../upp-2023/week1/welcome.html?a#section-4 свържете с мен]. +Разбира се, за всякакви проблеми се {url свържете с мен;../upp-2023/week1/welcome.html?a#section-4}. diff --git a/src/teaching/oop-2023/week10/index.du b/src/teaching/oop-2023/week10/index.du index d36406b..1cc62a5 100644 --- a/src/teaching/oop-2023/week10/index.du +++ b/src/teaching/oop-2023/week10/index.du @@ -1,8 +1,11 @@ -# Задачи - ООП, Седмица 10, 25.04.2024 +'def title Задачи - ООП, Седмица 10, 25.04.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/PbkITWhF classroom.github.com/a/PbkITWhF] +GitHub classroom: {url classroom.github.com/a/PbkITWhF;https://classroom.github.com/a/PbkITWhF} ## Преговорни @@ -10,14 +13,14 @@ GitHub classroom: [url https://classroom.github.com/a/PbkITWhF classroom.github. ### Задача 1 - Шаблони -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise01 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise01} -Реализирайте шаблонен клас [`Array`], който запазва динамично-заделен и оразмеряем масив от елементи с подаден тип. +Реализирайте шаблонен клас {` Array}, който запазва динамично-заделен и оразмеряем масив от елементи с подаден тип. Имплементирайте голяма четворка. ### Задача 2 - Оператори -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise02 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise02} За предходния шаблонен клас имплементирайте оператори: @@ -28,11 +31,11 @@ GitHub classroom: [url https://classroom.github.com/a/PbkITWhF classroom.github. ### Задача 3 - Грешки -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise03 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise03} Имплементирайте функция, която приема име на текстов файл и изкарва на екрана първия ред от него. Ако файлът не може да бъде отворен, хвърлете грешка - низ. -Ако във файлът няма други редове (няма знакът [`'\\n'`]), тогава хвърлете грешка число - размерът на файла. +Ако във файлът няма други редове (няма знакът {` '\\n'}), тогава хвърлете грешка число - размерът на файла. В главната функция, приемете името на файла от потребителския вход и извикайте функцията. Ако файлът не може да бъде отворен, тогава изкарайте хвърлената грешка на терминала и приключете програмата (успешно). @@ -42,85 +45,85 @@ GitHub classroom: [url https://classroom.github.com/a/PbkITWhF classroom.github. ### Задача 4 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise04 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise04} -Реализирайте клас [`Time24`], който запазва час и минути (в 24-часов формат) в две отделни целичислени член-данни. -Имплементирайте член-функция [`Print24`], която изкарва часа на екрана в 24-часов формат. +Реализирайте клас {` Time24}, който запазва час и минути (в 24-часов формат) в две отделни целичислени член-данни. +Имплементирайте член-функция {` Print24}, която изкарва часа на екрана в 24-часов формат. Нека конструкторът му приема две целочислени променливи, една за часа и втора за минутите. -Реализирайте негов наследник [`Time12`], който имплементира метод [`Print12`], принтиращ часа в 12-часов формат. +Реализирайте негов наследник {` Time12}, който имплементира метод {` Print12}, принтиращ часа в 12-часов формат. Имплементирайте и негов конструктор, който приема две целочислени променливи (една за часа и една за минутите), заедно с булева променлива описваща дали часа е следобеден или не. ### Задача 5 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise05 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise05} -Реализирайте клас [`FN`], който запазва факултетен номер като неотрицателно цяло число от 5 цифри. -Реализирайте негов наследник [`ModernFN`], който запазва и начален (префиксен) низ, състоящ се от цифра, две букви и още две цифри. +Реализирайте клас {` FN}, който запазва факултетен номер като неотрицателно цяло число от 5 цифри. +Реализирайте негов наследник {` ModernFN}, който запазва и начален (префиксен) низ, състоящ се от цифра, две букви и още две цифри. -Имплементирайте конструктори, като този на [`FN`] приема число, докато този на [`ModernFN`] приема низ, състоящ се от целия факултетен номер (и трябва да конвертирате последните 5 цифри към число). -Имплементирайте метод [`PrintOldFN`] на класа [`FN`] и метод [`PrintNewFN`] на класа [`ModernFN`], които изкарват целия факултетен номер на съответния клас. +Имплементирайте конструктори, като този на {` FN} приема число, докато този на {` ModernFN} приема низ, състоящ се от целия факултетен номер (и трябва да конвертирате последните 5 цифри към число). +Имплементирайте метод {` PrintOldFN} на класа {` FN} и метод {` PrintNewFN} на класа {` ModernFN}, които изкарват целия факултетен номер на съответния клас. ### Задача 6 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise06 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise06} -Реализирайте клас [`Grade`], който запазва оценка (от 2 до 6) като неотрицателна целочислена член-данна. -Реализирайте и негов наследник [`GradeWithName`], който запазва и името на оценката като низ с произволна дължина. +Реализирайте клас {` Grade}, който запазва оценка (от 2 до 6) като неотрицателна целочислена член-данна. +Реализирайте и негов наследник {` GradeWithName}, който запазва и името на оценката като низ с произволна дължина. -Конструктора на [`Grade`] приема само числовата стойност, докато този на наследника приема и името на оценката. -Имплементирайте голяма петица на [`GradeWithName`]. +Конструктора на {` Grade} приема само числовата стойност, докато този на наследника приема и името на оценката. +Имплементирайте голяма петица на {` GradeWithName}. ### Задача 7 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise07 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise07} -Реализирайте клас [`String`], който запазва низ с произволна дължина. -Имплементирайте голяма петица и член-функция [`At`], която приема индекс и връща референция към буквата на този индекс (при невалиден индекс хвърляте грешка). +Реализирайте клас {` String}, който запазва низ с произволна дължина. +Имплементирайте голяма петица и член-функция {` At}, която приема индекс и връща референция към буквата на този индекс (при невалиден индекс хвърляте грешка). -Реализирайте негов наследник [`FileString`], който запазва и името на текстов файл като низ с произволна дължина. +Реализирайте негов наследник {` FileString}, който запазва и името на текстов файл като низ с произволна дължина. Ако е нужно, имплементирайте голяма петица. -Самия низ в [`FileString`] е първия низ (начало първата буква и край [`'\\n'`]) от файла с подадено име. +Самия низ в {` FileString} е първия низ (начало първата буква и край {` '\\n'}) от файла с подадено име. -Имплементирайте метод [`ChangeAt`], който приема индекс и нова буква, променя буквата на дадения индекс с подадената и обновява файла със запазеното име. +Имплементирайте метод {` ChangeAt}, който приема индекс и нова буква, променя буквата на дадения индекс с подадената и обновява файла със запазеното име. ### Задача 8 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise08 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise08} -Реализирайте клас [`User`], който запава име и парола като два низа с произволна дължина. -Реализирайте негов наследник [`Moderator`], който запазва и подпис, който също е низ с произволна дължина. -Реализирайте наследник [`Administrator`] на [`Moderator`], който запазва и оразмеряващ се масив от цели числа. +Реализирайте клас {` User}, който запава име и парола като два низа с произволна дължина. +Реализирайте негов наследник {` Moderator}, който запазва и подпис, който също е низ с произволна дължина. +Реализирайте наследник {` Administrator} на {` Moderator}, който запазва и оразмеряващ се масив от цели числа. Идеята е, че всяко действие от модератор или администратор се "подписва" публично (за да се знае, че той го е направил, дори да си смени името), а за администратор допълнително пазим масив от идентификатори на форуми, които администрира. За всеки клас имплементирайте голяма петица и гетъри и сетъри за името и паролата, когато е нужно. -За [`Moderator`] имплементирайте гетър за подписа, но без сетър. -За [`Administrator`] имплементирайте методи за добавяне и премахване на идентификатор на форум. +За {` Moderator} имплементирайте гетър за подписа, но без сетър. +За {` Administrator} имплементирайте методи за добавяне и премахване на идентификатор на форум. ### Задача 9 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise09 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise09} -Реализирайте клас [`CommunicationPacket`], който запазва начален и краен адрес като две неотрицателни цели числа, заедно с трето число за размера на данните. +Реализирайте клас {` CommunicationPacket}, който запазва начален и краен адрес като две неотрицателни цели числа, заедно с трето число за размера на данните. В този клас никога няма данни, затова размера винаги е нула. -Реализирайте негови наследници [`StringPacket`] и [`IntPacket`], където първия запазва и низ с произволна дължина (и дължината му е размера на данните) докато втория запазва и едно цяло число (и размера на [`int`] е размера на данните). +Реализирайте негови наследници {` StringPacket} и {` IntPacket}, където първия запазва и низ с произволна дължина (и дължината му е размера на данните) докато втория запазва и едно цяло число (и размера на {` int} е размера на данните). Размерът не се подава на конструктори, а се изчислява в конструктори. Имплементирайте голяма петица и конструктори с нужните параметри. ### Задача 10 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise10 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week10/Exercise10} -Реализирайте клас [`String`], който запазва низ с произволна дължина, и имплементира оператори ==, !=, + (който връща нов низ с конкатенацията на двата низа). +Реализирайте клас {` String}, който запазва низ с произволна дължина, и имплементира оператори ==, !=, + (който връща нов низ с конкатенацията на двата низа). -Реализирайте негов наследник [`ModifiableString`], който имплементира оператор[] (връщащ референция към буквата на дадения индекс) и оператор+=. +Реализирайте негов наследник {` ModifiableString}, който имплементира оператор[] (връщащ референция към буквата на дадения индекс) и оператор+=. -Реализирайте наследник на [`ModifiableString`], [`ShowableString`], който имплементира оператори << и >>. -Реализирайте наследник на [`ModifiableString`], [`SaveableString`], който имплементира методи write и read, приемащи име на двоичен файл и записващи или четещи низа от този файл. +Реализирайте наследник на {` ModifiableString}, {` ShowableString}, който имплементира оператори << и >>. +Реализирайте наследник на {` ModifiableString}, {` SaveableString}, който имплементира методи write и read, приемащи име на двоичен файл и записващи или четещи низа от този файл. За всички класове имплементирайте голяма петица, когато е нужно. @@ -128,23 +131,23 @@ GitHub classroom: [url https://classroom.github.com/a/PbkITWhF classroom.github. ### Задача 11 -Реализирайте шаблонен клас [`Array`], който запазва оразмеряем масив с елементи от подаден тип. -Имплементирайте оператор== и оператор!=, заедно с метод [`isEmpty`]. +Реализирайте шаблонен клас {` Array}, който запазва оразмеряем масив с елементи от подаден тип. +Имплементирайте оператор== и оператор!=, заедно с метод {` isEmpty}. Концептуално идеята е, че този масив не може да се променя след като му се въведат стойностите от конструктора. -Реализирайте негов наследник [`PrintableArray`], който имплементира оператори << и >>. -Реализирайте наследник [`SaveableArray`] на [`Array`], който имплементира методи write и read, приемащи име на файл и булева стойност дали е двоичен или не, и съответно прочитат или запазват елементите от този масив във файла. +Реализирайте негов наследник {` PrintableArray}, който имплементира оператори << и >>. +Реализирайте наследник {` SaveableArray} на {` Array}, който имплементира методи write и read, приемащи име на файл и булева стойност дали е двоичен или не, и съответно прочитат или запазват елементите от този масив във файла. -Реализирайте трети наследник, [`ModifiableArray`], на [`Array`], в който са имплементирани член-функции: +Реализирайте трети наследник, {` ModifiableArray}, на {` Array}, в който са имплементирани член-функции: .unordered -- [`push`], която приема елемент и го вмъква в (десния) края на масива -- [`pop`], който премахва елемент от (десния) края на масива -- [`last`], който връща последния елемент от масива +- {` push}, която приема елемент и го вмъква в (десния) края на масива +- {` pop}, който премахва елемент от (десния) края на масива +- {` last}, който връща последния елемент от масива Може да се налага масива да се оразмерява. Като подсказка, имплементирайте си метод, наличен за класа и наследници, който вмъква елемент на произволен индекс. -Реализирайте наследник [`IndexableArray`] на [`ModifiableArray`], който имплементира оператор[]. +Реализирайте наследник {` IndexableArray} на {` ModifiableArray}, който имплементира оператор[]. Ако индекса е след края, тогава "вмъквате" елементи по подразбиране между края и подадения индекс, и връщате елемента от сега новия край. -Реализирайте наследник [`FrontableArray`] на [`ModifiableArray`], който имплементира методи [`pushf`] и [`popf`], които работят като [`push`] и [`pop`], но с елемента в началото на масива (първия елемент). +Реализирайте наследник {` FrontableArray} на {` ModifiableArray}, който имплементира методи {` pushf} и {` popf}, които работят като {` push} и {` pop}, но с елемента в началото на масива (първия елемент). diff --git a/src/teaching/oop-2023/week11/index.du b/src/teaching/oop-2023/week11/index.du index 295c2de..661a24f 100644 --- a/src/teaching/oop-2023/week11/index.du +++ b/src/teaching/oop-2023/week11/index.du @@ -1,165 +1,168 @@ -# Задачи - ООП, Седмица 11, 09.05.2024 +'def title Задачи - ООП, Седмица 11, 09.05.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/oYQehcnN classroom.github.com/a/oYQehcnN] +GitHub classroom: {url classroom.github.com/a/oYQehcnN;https://classroom.github.com/a/oYQehcnN} ## Преговорни .warn Моля, не отделяйте на преговорните задачи повече от 30мин -.important Всеки бащин клас, във всички случаи, трябва да има виртуален деструктор ([`virtual ~ClassName();`]). +.important Всеки бащин клас, във всички случаи, трябва да има виртуален деструктор ({` virtual ~ClassName()\;}). ### Задача 1 - Шаблони и оператори -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise01 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise01} Реализирайте шаблонен клас множество, който запазва фиксиран брой елементи от подаден тип. Реализирайте голяма петица и оператори: .bulleted -- [`+`], [`+=`] които действат като обединение -- [`*`], [`*=`] които действат като сечение -- [`-`], [`-=`] които действат като допълнение +- {` +}, {` +=} които действат като обединение +- {` *}, {` *=} които действат като сечение +- {` -}, {` -=} които действат като допълнение ### Задача 2 - Наследяване -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise02 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise02} -Реализирайте клас [`Employee`], съхраняващ име на човек, позиция и департамент като низове със съответно дължина 512, 128 и 64, заедно със заплата като число с плаваща запетая. +Реализирайте клас {` Employee}, съхраняващ име на човек, позиция и департамент като низове със съответно дължина 512, 128 и 64, заедно със заплата като число с плаваща запетая. -Реализирайте негов наследник [`Manager`], който допълнително пази масив с фиксиран размер от Employee. +Реализирайте негов наследник {` Manager}, който допълнително пази масив с фиксиран размер от Employee. -Реализирайте наследника на [`Employee`], [`Developer`], който допълнително пази брой проекти върху който работи. +Реализирайте наследника на {` Employee}, {` Developer}, който допълнително пази брой проекти върху който работи. -Наследниците не могат да достъпят заплатата, но трябва да могат да достъпят другите данни на [`Employee`]. +Наследниците не могат да достъпят заплатата, но трябва да могат да достъпят другите данни на {` Employee}. ## Лесни ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise03 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise03} .comment Динамично свързване, Inherit 3 -Реализирайте клас [`Electronics`], който съдържа модел (низ с максимална дължина от 255 знака), [`needsVolts`] и [`needsAmps`] (стойности с плаваща запетая). +Реализирайте клас {` Electronics}, който съдържа модел (низ с максимална дължина от 255 знака), {` needsVolts} и {` needsAmps} (стойности с плаваща запетая). Имплементирайте негови наследници: .bulleted -- [`Laptop`], който допълнително съхранява размер на екрана като число с плаваща запетая -- [`WashingMachine`], който допълнително запазва максимално тегло на прането, като цяло неотрицателно число -- [`Camera`], която допълнително запазва резолюция като число с плаваща запетая (в мегапиксели) +- {` Laptop}, който допълнително съхранява размер на екрана като число с плаваща запетая +- {` WashingMachine}, който допълнително запазва максимално тегло на прането, като цяло неотрицателно число +- {` Camera}, която допълнително запазва резолюция като число с плаваща запетая (в мегапиксели) -За всеки клас реализирайте член-функция [`Print`], която изкарва всички данни на екрана. +За всеки клас реализирайте член-функция {` Print}, която изкарва всички данни на екрана. -&:question Чрез статично или динамично свързване сте имплементирали [`Print`]? Каква е разликата? +&:question Чрез статично или динамично свързване сте имплементирали {` Print}? Каква е разликата? ### Задача 4 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise04 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise04} .comment Dynamic linking, Inherit 2 -Реализирайте клас [`String`], който запазва динамично-заделен масив. +Реализирайте клас {` String}, който запазва динамично-заделен масив. -Имплементирайте негов наследник [`Name`], който допълнително запазва число: номер на името (първо име, бащино име (второ име), фамилия (трето име)). +Имплементирайте негов наследник {` Name}, който допълнително запазва число: номер на името (първо име, бащино име (второ име), фамилия (трето име)). -Имплементирайте втори наследник на [`String`], [`Street`], който запазва и число: номер на улицата. +Имплементирайте втори наследник на {` String}, {` Street}, който запазва и число: номер на улицата. -Във всеки клас имплементирайте голяма петица, член-функция [`Length`], като: +Във всеки клас имплементирайте голяма петица, член-функция {` Length}, като: .bulleted -- в [`String`] връща дължината на низа, -- в [`Name`] връща дължината на името умножена по номера си и -- в [`Street`] връща дължината на името на улицата плюс броя цифри в номера на улицата. +- в {` String} връща дължината на низа, +- в {` Name} връща дължината на името умножена по номера си и +- в {` Street} връща дължината на името на улицата плюс броя цифри в номера на улицата. -Самият низ в [`String`] [=не=] може да се достъпва от наследниците. +Самият низ в {` String} {b не} може да се достъпва от наследниците. ### Задача 5 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise05 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise05} .comment Templates 1 type -Реализирайте шаблонен клас [`Counted`], който запазва елемент от подаден тип и неговата бройка (цяло неотрицателно число). -Имплементирайте оператори [`++`], [`--`], [`+=`], [`-=`], които променят бройката, както и гетъри за елемента и бройката. +Реализирайте шаблонен клас {` Counted}, който запазва елемент от подаден тип и неговата бройка (цяло неотрицателно число). +Имплементирайте оператори {` ++}, {` --}, {` +=}, {` -=}, които променят бройката, както и гетъри за елемента и бройката. ### Задача 6 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise06 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise06} .comment Templates 2 types -Реализирайте шаблонен клас [`TwoArray`], който запазва два динамично-заделени масива с подадени типове. +Реализирайте шаблонен клас {` TwoArray}, който запазва два динамично-заделени масива с подадени типове. Масивите не могат да се оразмеряват и имат еднаква дължина. Имплементирайте: .bulleted - голяма петица, -- оператор [`[]`], който по подаден индекс връща елемент от първия масив, и -- оператор [`()`], който по подаден индекс връща елемент от втория масив. +- оператор {` []}, който по подаден индекс връща елемент от първия масив, и +- оператор {` ()}, който по подаден индекс връща елемент от втория масив. ### Задача 7 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise07 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise07} .comment Abstract class -Реализирайте абстрактен клас [`DynamicArray`], който задължава наследниците да имплементират оператор [`[]`] и оператор [`+=`]. +Реализирайте абстрактен клас {` DynamicArray}, който задължава наследниците да имплементират оператор {` []} и оператор {` +=}. Реализирайте негови наследници: :unordered -- [`Numbers`], който "имплементира" динамично-заделен масив от цели числа, като +- {` Numbers}, който "имплементира" динамично-заделен масив от цели числа, като .bulleted - - оператор [`[]`] връща първия елемент, по-малък от подадения индекс. Ако няма такъв, връщате първия елемент. - - оператор [`+=`] вмъква елементите в началото на масива + - оператор {` []} връща първия елемент, по-малък от подадения индекс. Ако няма такъв, връщате първия елемент. + - оператор {` +=} вмъква елементите в началото на масива -- [`String`], който "имплементира" динамично-заделен масив от букви, като +- {` String}, който "имплементира" динамично-заделен масив от букви, като .bulleted - - оператор [`[]`] връща индекс на брой (първата, втората, ...) главна буква в низа. Ако няма такава, тогава връща последната буква. - - оператор [`+=`] вмъква елементите в края на масива + - оператор {` []} връща индекс на брой (първата, втората, ...) главна буква в низа. Ако няма такава, тогава връща последната буква. + - оператор {` +=} вмъква елементите в края на масива Имплементирайте голяма петица. .question Къде ще имплементирате динамичния масив и голямата петица? -.question Можем ли да използваме оператор [`+=`] в полиморфна йерархия? +.question Можем ли да използваме оператор {` +=} в полиморфна йерархия? ### Задача 8 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise08 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise08} .comment Abstract class -Имплементирайте абстрактен клас [`Message`], който съдържа динамично-заделен низ (текстово съобщение, което се показва на екрана) и задължава наследниците да имплементират: +Имплементирайте абстрактен клас {` Message}, който съдържа динамично-заделен низ (текстово съобщение, което се показва на екрана) и задължава наследниците да имплементират: .unordered -- метод [`size`], който връща общия размер на всички данни в байтове. +- метод {` size}, който връща общия размер на всички данни в байтове. -Реализирайте негов наследник [`Link`] (хипервръзка), който запазва и втори динамично-заделен низ, запазващ адресът към който линкът сочи. +Реализирайте негов наследник {` Link} (хипервръзка), който запазва и втори динамично-заделен низ, запазващ адресът към който линкът сочи. -Реализирайте втори негов наследник [`Location`], чието текстово съдържание е адрес, и който допълнително запазва две стойности с плаваща запетая: една за географска ширина и втора за географска дължина. +Реализирайте втори негов наследник {` Location}, чието текстово съдържание е адрес, и който допълнително запазва две стойности с плаваща запетая: една за географска ширина и втора за географска дължина. -За всички класове реализирайте член-функция [`Length`], която връща размера на [=текстовото съобщение=] и оператор [`<<`]. +За всички класове реализирайте член-функция {` Length}, която връща размера на {b текстовото съобщение} и оператор {` <<}. -.question Има ли разлика между оператор [`<<`] на трите класа? +.question Има ли разлика между оператор {` <<} на трите класа? ### Задача 9 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise09 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week11/Exercise09} -Реализирайте абстрактен шаблонен клас [`MixedArray`], който съхранява алтерниращи елементи от два типа. +Реализирайте абстрактен шаблонен клас {` MixedArray}, който съхранява алтерниращи елементи от два типа. Тоест, на индекс 0 имаме елемент от първия тип, на индекс 1 от втория, на индекс 2 от първи и так. нат. -Елементите не е нужно да могат да се конвертират помежду си (тоест не може да използвате полиморфен контейнер), затова се достъпват с член функция [`At`], приемаща индекс и референции към указатели към всеки тип. -При подаден индекс, на единия указател се записва адресът на съответната стойност, а на другия [`nullptr`]. +Елементите не е нужно да могат да се конвертират помежду си (тоест не може да използвате полиморфен контейнер), затова се достъпват с член функция {` At}, приемаща индекс и референции към указатели към всеки тип. +При подаден индекс, на единия указател се записва адресът на съответната стойност, а на другия {` nullptr}. -Също имплементира голяма петица и задължава наследниците да имплементират оператори [`+=`], върщащи указател. +Също имплементира голяма петица и задължава наследниците да имплементират оператори {` +=}, върщащи указател. -Реализирайте негов наследник [`DirectConcat`], който реализира [`+=`] като директно слепване (конкатениране). +Реализирайте негов наследник {` DirectConcat}, който реализира {` +=} като директно слепване (конкатениране). -Реализирайте втори негов наследник, [`MixedConcat`], който реализир [`+=`] като алтернира елемент от първия масив с елемент от втория. +Реализирайте втори негов наследник, {` MixedConcat}, който реализир {` +=} като алтернира елемент от първия масив с елемент от втория. ## Трудни @@ -183,7 +186,7 @@ GitHub classroom: [url https://classroom.github.com/a/oYQehcnN classroom.github. Имплементирайте клас Document, който запазва масив от Node-ове и за който са имплементирани: .bulleted -- методи save и load, които запазват и четат цялото съдържание на документа в [=текстов=] файл с произволен формат. +- методи save и load, които запазват и четат цялото съдържание на документа в {b текстов} файл с произволен формат. ### Задача 11 diff --git a/src/teaching/oop-2023/week12/index.du b/src/teaching/oop-2023/week12/index.du index 537e03b..a7129e3 100644 --- a/src/teaching/oop-2023/week12/index.du +++ b/src/teaching/oop-2023/week12/index.du @@ -1,97 +1,100 @@ -# Задачи - ООП, Седмица 12, 09.05.2024 +'def title Задачи - ООП, Седмица 12, 09.05.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/o7hNz1pr classroom.github.com/a/o7hNz1pr] +GitHub classroom: {url classroom.github.com/a/o7hNz1pr;https://classroom.github.com/a/o7hNz1pr} ### Задача 1 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week12/Exercise1 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week12/Exercise1} .comment Multiple inheritance -Реализирайте клас [`Publication`], който пази: +Реализирайте клас {` Publication}, който пази: .bulleted - низ от максимална дължина 1023, съхраняващ автори и - втори низ с максимална дължина от 255, съхраняващ име на (научно) списание. -Реализирайте клас [`TextDocument`], който пази неоразмеряем низ с текстово съдържание и неговия размер. +Реализирайте клас {` TextDocument}, който пази неоразмеряем низ с текстово съдържание и неговия размер. -Реализирайте наследник на двата класа [`ScientificPaper`], който допълнително пази и низ от максимално 511 знака, съдържащ име на научна дисциплина. +Реализирайте наследник на двата класа {` ScientificPaper}, който допълнително пази и низ от максимално 511 знака, съдържащ име на научна дисциплина. За всички класове реазлизирайте оператор <<. ### Задача 2 -[*Не говорим за нея, условието беше толкова сбъркано, че се наложи да я сваля*] +{i Не говорим за нея, условието беше толкова сбъркано, че се наложи да я сваля} ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week12/Exercise3 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week12/Exercise3} -Реализирайте абстрактен клас [`MobileDevice`], който запазва: +Реализирайте абстрактен клас {` MobileDevice}, който запазва: .bulleted - телефонен номер като цяло неотрицателно число и - масив с максимална дължина от 511 знака за текстово съобщение. Допълнително нека: .bulleted -- класът да задължава имплементацията на метод [`Show`], -- да има член-функция [`CanAccept`], която по подадено "хиперсъобщение" връща дали неговия номер съвпада с този на класа.\n +- класът да задължава имплементацията на метод {` Show}, +- да има член-функция {` CanAccept}, която по подадено "хиперсъобщение" връща дали неговия номер съвпада с този на класа.\n Под "хиперсъобщение" имаме предвид низ, който започва с телефонния номер, след това има шпация и след това е самото съобщение. -- да има член-функция [`Accept`], която по подадено "хиперсъобщение" запазва текстовото съобщение. +- да има член-функция {` Accept}, която по подадено "хиперсъобщение" запазва текстовото съобщение. Ако номерът не съответства тогава хвърля грешка. -Реализирайте негов наследник [`Telephone`], за който [`Show`] изкарва съобщението на екрана. +Реализирайте негов наследник {` Telephone}, за който {` Show} изкарва съобщението на екрана. 'footnote pager От времето без мобилни телефони, хората са си купували пейджъри, които ти пращат нотификация ако някой ти звънне и не вдигнеш. Пейджърите са "заключени" за определени региони, тоест някой ти се обажда, не вдигаш, и всички телекомуникционни кули в региона изпращат съобщение "на теб ти звънна този", и пейджъра като засече сигнала ти писука. Мисля че също можеш да пращаш кратки съобщения. Не е било хич сигурна система, все още се ползва от болници в някои държави. -Реализирайте втори негов наследник [`Pager`] [$pager], който съхранява име на файл (като динамично-заделен низ) и [`Show`] изкарва съобщението в съответния файл. +Реализирайте втори негов наследник {` Pager} {pager}, който съхранява име на файл (като динамично-заделен низ) и {` Show} изкарва съобщението в съответния файл. Разбира се, имплементирайте голяма петица. -Реализирайте клас [`TelecommunicationCompany`], който съхранява динамично-заделен и оразмеряем масив от (указатели към) [`MobileDevice`]. +Реализирайте клас {` TelecommunicationCompany}, който съхранява динамично-заделен и оразмеряем масив от (указатели към) {` MobileDevice}. Имплементирайте всичко от голяма петица. ### Задача 4 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week12/Exercise4 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week12/Exercise4} .comment Multiple inheritance with mixed class types, polymorphic container, and copying -Реализирайте клас [`Employee`], който запазва: +Реализирайте клас {` Employee}, който запазва: .bulleted - заплата като число с плаваща запетая и - производителост също като число с плаваща запетая. Производителността е множител на заплатата, тоест ако има производителност 0.5 значи работи като човек на който му плащат с половината заплата. -Реализирайте абстрактен клас [`Person`], който запазва: +Реализирайте абстрактен клас {` Person}, който запазва: .bulleted - име като низ с произволна дължина и - възраст като цяло неотрицателно число -Допълнително задължава реализацията на член-функция [`Workload`], връщаща стойност с плаваща запетая. +Допълнително задължава реализацията на член-функция {` Workload}, връщаща стойност с плаваща запетая. Разбира се имплементирайте голяма петица. -Реализирайте наследник на двата класа на име [`Developer`], който допълнително запазва: +Реализирайте наследник на двата класа на име {` Developer}, който допълнително запазва: .bulleted - цяло неотрицателно число - брой проекти в които участва, и - второ което е брой проекти на които ще се пуска нова версия. -Реализирайте оператори [`++`] и [`--`], като префиксните променят броя проекти на които ще се пуска нова версия, докато постфиксните променя броя проекти в които участва.\n -За него [`Workload`] се определя като 1.1 по всеки проект и допълнително по 2.3 за всеки проект на който ще се пуска нова версия. +Реализирайте оператори {` ++} и {` --}, като префиксните променят броя проекти на които ще се пуска нова версия, докато постфиксните променя броя проекти в които участва.\n +За него {` Workload} се определя като 1.1 по всеки проект и допълнително по 2.3 за всеки проект на който ще се пуска нова версия. -Реализирайте наследник на двата класа на име [`Manager`], който допълнително запазва динамично-заделен и оразмеряем масив от [`Person`], които менижира. +Реализирайте наследник на двата класа на име {` Manager}, който допълнително запазва динамично-заделен и оразмеряем масив от {` Person}, които менижира. Имплементирайте голяма петица и: .bulleted -- оператори [`==`] и [`!=`], сравняващи хора по име -- член-функция [`StartManaging`], която приема [`Person`] и го запазва, и -- член-функция [`StopManaging`], която приема [`Person`] и го премахва от масива ако съществува в него. +- оператори {` ==} и {` !=}, сравняващи хора по име +- член-функция {` StartManaging}, която приема {` Person} и го запазва, и +- член-функция {` StopManaging}, която приема {` Person} и го премахва от масива ако съществува в него. -[`Workload`] се определя като 0.6 на човек който менижира. +{` Workload} се определя като 0.6 на човек който менижира. -Финално реализирайте клас [`Company`], който запазва масив от 128 указателя [`Person`] в компанията. +Финално реализирайте клас {` Company}, който запазва масив от 128 указателя {` Person} в компанията. Имплементирайте негова член-функция: .bulleted -- [`PaymentDifference`], която връща с колко платената заплата на всички служители се отличава с тази според тяхната производителност +- {` PaymentDifference}, която връща с колко платената заплата на всички служители се отличава с тази според тяхната производителност diff --git a/src/teaching/oop-2023/week13/index.du b/src/teaching/oop-2023/week13/index.du index 5bd0904..913d783 100644 --- a/src/teaching/oop-2023/week13/index.du +++ b/src/teaching/oop-2023/week13/index.du @@ -1,8 +1,11 @@ -# Задачи - ООП, Седмица 13, 16.05.2024 +'def title Задачи - ООП, Седмица 13, 16.05.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/GvV1wrC1 classroom.github.com/a/GvV1wrC1] +GitHub classroom: {url classroom.github.com/a/GvV1wrC1;https://classroom.github.com/a/GvV1wrC1} .warn Навсякъде, където е нужно, реализирайте голяма петица. @@ -10,71 +13,71 @@ GitHub classroom: [url https://classroom.github.com/a/GvV1wrC1 classroom.github. ### Задача 1 - Множествено наследяване -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week13/Exercise1 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week13/Exercise1} -Реализирайте клас [`String`], който запазва динамичен низ с фиксиран размер. +Реализирайте клас {` String}, който запазва динамичен низ с фиксиран размер. -Реализирайте клас [`IndexArray`], който запазва динамичен масив с фиксиран размер от цели числа - индекси. +Реализирайте клас {` IndexArray}, който запазва динамичен масив с фиксиран размер от цели числа - индекси. -.warn [=Не=] правете общ родител, който имплементира динамичен масив! +.warn {b Не} правете общ родител, който имплементира динамичен масив! -Реализирайте наследник на двата класа, [`WordsString`], при който индексите определят началото на всяка дума от запазения низ. +Реализирайте наследник на двата класа, {` WordsString}, при който индексите определят началото на всяка дума от запазения низ. Индексите се дефинират при конструктора. ## Лесни ### Задача 2 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week13/Exercise2 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week13/Exercise2} .comment Диамант -Реализирайте шаблонен клас [`Container`], който съхранява масив с фиксиран размер от елементи с подаден тип. -[=Не=] трябва да реализирате нищо повече от задължителните компоненти (голяма петица). +Реализирайте шаблонен клас {` Container}, който съхранява масив с фиксиран размер от елементи с подаден тип. +{b Не} трябва да реализирате нищо повече от задължителните компоненти (голяма петица). -Реализирайте негов наследник [`Indexable`], който реализира оператор[]. +Реализирайте негов наследник {` Indexable}, който реализира оператор[]. -Реализирайте втори негов наследник [`Resizeable`], който реализира член-функция [`InsertAt`], приемаща елемент и индекс, и която вмъква елемента на даден индекс. +Реализирайте втори негов наследник {` Resizeable}, който реализира член-функция {` InsertAt}, приемаща елемент и индекс, и която вмъква елемента на даден индекс. Разбира се, може да се наложи оразмеряване на масива. -Реализирайте наследник [`Vector`] на [`Indexable`] и [`Resizeable`], който реализира оператор[] и член-функции: +Реализирайте наследник {` Vector} на {` Indexable} и {` Resizeable}, който реализира оператор[] и член-функции: .bulleted -- [`pop_back`], премахваща последния елемент -- [`pop_front`], премахваща първия елемент -- [`push_back`], приемаща елемент който се вкарва в края на масив -- [`push_front`], приемаща елемент който се вкарва в началото на масив +- {` pop_back}, премахваща последния елемент +- {` pop_front}, премахваща първия елемент +- {` push_back}, приемаща елемент който се вкарва в края на масив +- {` push_front}, приемаща елемент който се вкарва в началото на масив .important Не забравяйте за диамантния проблем! ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week13/Exercise3 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week13/Exercise3} .comment Диамант -Реализирайте клас [`User`], който запазва потребителско име и парола като низове с произволна дължина, заедно с булев флаг [`banned`], определящ дали акаунтът може да прави действия. +Реализирайте клас {` User}, който запазва потребителско име и парола като низове с произволна дължина, заедно с булев флаг {` banned}, определящ дали акаунтът може да прави действия. Потребителско име не може да съдържа шпации. -Реализирайте клас [`Thread`], който запазва масив с произволна дължина, от низове с произволна дължина. +Реализирайте клас {` Thread}, който запазва масив с произволна дължина, от низове с произволна дължина. Имплементирайте член-функция: .bulleted -- [`PostMessage`], която приема потребител и негово съобщение и добавя съобщението с потребителското име като един низ. - Ако потребителя е [`banned`], тогава хвърлете грешка. +- {` PostMessage}, която приема потребител и негово съобщение и добавя съобщението с потребителското име като един низ. + Ако потребителя е {` banned}, тогава хвърлете грешка. -Реализирайте наследник [`ThreadModerator`] на [`User`], който може да променя [`Thread`] обекти, без да се нуждае от публични член-функции в [`Thread`]. +Реализирайте наследник {` ThreadModerator} на {` User}, който може да променя {` Thread} обекти, без да се нуждае от публични член-функции в {` Thread}. Имплементирайте методи: .bulleted -- [`RemoveMessage`], който приема [`Thread`] и индекс на съобщение и премахва съответното съобщение -- [`RemoveByUser`], който приема [`Thread`] и потребител, и премахва всички съобщения, направени от дадения потребител +- {` RemoveMessage}, който приема {` Thread} и индекс на съобщение и премахва съответното съобщение +- {` RemoveByUser}, който приема {` Thread} и потребител, и премахва всички съобщения, направени от дадения потребител -Реализирайте наследник [`UserModerator`] на [`User`], който може да променя [`User`] обекти, без да се нуждае от публични член-функции в [`User`]. +Реализирайте наследник {` UserModerator} на {` User}, който може да променя {` User} обекти, без да се нуждае от публични член-функции в {` User}. Имплементирайте методите: .bulleted -- [`BanUser`], който приема потребител и вдига [`banned`] флага -- [`UnbanUser`], който приема потребител и сваля [`banned`] флага +- {` BanUser}, който приема потребител и вдига {` banned} флага +- {` UnbanUser}, който приема потребител и сваля {` banned} флага -Реализирайте наследник [`Administrator`] на [`ThreadModerator`] и [`UserModerator`], който може да прави всичко, което и родителите могат. +Реализирайте наследник {` Administrator} на {` ThreadModerator} и {` UserModerator}, който може да прави всичко, което и родителите могат. .important Не забравяйте за диамантния проблем! @@ -82,7 +85,7 @@ GitHub classroom: [url https://classroom.github.com/a/GvV1wrC1 classroom.github. ### Задача 4 -Реализирайте абстрактен клас [`ShopLocation`], който съхранява член-данни: +Реализирайте абстрактен клас {` ShopLocation}, който съхранява член-данни: .bulleted - адрес като низ с максимална дължина от 511 знака. Всеки адрес съдържа произволни символи и задължително завършва на число, определящо неговия район. @@ -90,24 +93,24 @@ GitHub classroom: [url https://classroom.github.com/a/GvV1wrC1 classroom.github. Имплементирате методи: .bulleted -- [`IsOpen`], който връща по подаден час дали локацията е отворена -- [`InCenter`], който връща дали локацията се намира в центъра на града. +- {` IsOpen}, който връща по подаден час дали локацията е отворена +- {` InCenter}, който връща дали локацията се намира в центъра на града. Всички адреси с регион, по-малък от 11, се намират в центъра. -Реализирайте шаблонен клас [`Inventory`], който съхранява [=фиксиран=] брой елементи и техните неотрицателни бройки (количества). +Реализирайте шаблонен клас {` Inventory}, който съхранява {b фиксиран} брой елементи и техните неотрицателни бройки (количества). Имплементирайте член-функции: .bulleted - оператор[], който връща елемент на дадения индекс - оператор(), който връща бройка на елемент на дадения индекс -- [`Stock`], приемащ индекс на елемент и бройка (положителна/отрицателна) с която бройката на дадения елемент се променя. +- {` Stock}, приемащ индекс на елемент и бройка (положителна/отрицателна) с която бройката на дадения елемент се променя. Бройката може да бъде най-малко 0. -- [`List`], който връща всички елементи и техните индекси +- {` List}, който връща всички елементи и техните индекси -Реализирайте абстрактен шаблонен наследник [`DeliverableInventory`] на [`Inventory`], който е инвентар с максимум 2048 елемента и допълнително задължава имплементацията на: +Реализирайте абстрактен шаблонен наследник {` DeliverableInventory} на {` Inventory}, който е инвентар с максимум 2048 елемента и допълнително задължава имплементацията на: .bulleted -- [`ShippingDelay`], който приема адрес и връща времето в което ще може да се достави обекта +- {` ShippingDelay}, който приема адрес и връща времето в което ще може да се достави обекта -Реализирайте наследник на [`DeliverableInventory`], склад [`Warehouse`], който допълнително запазва разстояние от града в километри и имплементира [`ShippingDelay`] по следната логика: +Реализирайте наследник на {` DeliverableInventory}, склад {` Warehouse}, който допълнително запазва разстояние от града в километри и имплементира {` ShippingDelay} по следната логика: .bulleted - доставки в центъра отнемат един ден + регионът в който се доставя - доставки извън центъра отнемат толкова време, колкото е нужно да се стигне до града ако пътува с 80 километра в час + времето което ще отнеме да се измине номер на региона на брой километри при скорост от 20 километра в час @@ -115,27 +118,27 @@ GitHub classroom: [url https://classroom.github.com/a/GvV1wrC1 classroom.github. Доставка не може да се случи преди 9 сутринта и след 18 вечерта. Ако попадне в този диапазон, тогава се отлага за най-скорошния следващ възможен час. -Реализирайте шаблонен наследник магазин [`Shop`] на [`ShopLocation`] и [`Inventory`], който е инвентар с максимум 256 елемента, запазващ: +Реализирайте шаблонен наследник магазин {` Shop} на {` ShopLocation} и {` Inventory}, който е инвентар с максимум 256 елемента, запазващ: .bulleted -- [=оразмеряем=] масив от низове с произволен размер, всеки низ който е "отчет на продажба" +- {b оразмеряем} масив от низове с произволен размер, всеки низ който е "отчет на продажба" - общо бройка продажби и който имплементира методи: .bulleted -- [`SellItems`], който приема масив от идентификатори на обекти, намалява бройката на всеки от тях и създава нов отчет. +- {` SellItems}, който приема масив от идентификатори на обекти, намалява бройката на всеки от тях и създава нов отчет. Отчета е в произволен формат, но трябва да съдържа идентификаторите и бройките на всеки обект. Ако за някой обект няма достатъчно бройки или изобщо не се пази, хвърлете грешка. -Реализирайте шаблонен клас [`WebStore`], който запазва оразмеряеми масиви от [`Shop`] и [`Warehouse`]. +Реализирайте шаблонен клас {` WebStore}, който запазва оразмеряеми масиви от {` Shop} и {` Warehouse}. Имплементирайте: .bulleted - оператор<<, който изкарва всички уникални (unique) обекти от всички магазини и складове, с индекс до тях -- [`GetEstimate`], който приема индекс на уникален обект от всички магазини и складове, сегашно време и адрес, и изкарва на екрана всички магазини които са отворени в дадения час и кое е най-скорошното време в което може обектът да се достави от склад. +- {` GetEstimate}, който приема индекс на уникален обект от всички магазини и складове, сегашно време и адрес, и изкарва на екрана всички магазини които са отворени в дадения час и кое е най-скорошното време в което може обектът да се достави от склад. Ако няма отворени магазини, ако няма магазин с наличност и так. нат. изкарайте съответно съобщение. -Последно реализирайте клас [`Book`], който запазва заглавие на книга и име на автор като низове с максимална дължина от 127 знака. +Последно реализирайте клас {` Book}, който запазва заглавие на книга и име на автор като низове с максимална дължина от 127 знака. Имплементирайте оператор<<, който изкарва съответната книга в произволен формат. -В главната функция реализирайте [`WebStore`] от книги, заедно с набор от книги, магазини и складове по ваш избор. +В главната функция реализирайте {` WebStore} от книги, заедно с набор от книги, магазини и складове по ваш избор. Нека в началото на програмата да приемате от потребителя сегашното време и адрес, след това изкарайте на екрана всички ункални книги с индекси. Накрая потребителя може да въведе индекс на книга и да получи информация кои отворени сега магазини имат съответната книга и кога най-скоро може да бъде доставена от склад. diff --git a/src/teaching/oop-2023/week14/index.du b/src/teaching/oop-2023/week14/index.du index d9c827a..0885c58 100644 --- a/src/teaching/oop-2023/week14/index.du +++ b/src/teaching/oop-2023/week14/index.du @@ -1,8 +1,11 @@ -# Задачи - ООП, Седмица 14, 23.05.2024 +'def title Задачи - ООП, Седмица 14, 23.05.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/K0XomKEP classroom.github.com/a/K0XomKEP] +GitHub classroom: {url classroom.github.com/a/K0XomKEP;https://classroom.github.com/a/K0XomKEP} ## Задача @@ -37,7 +40,7 @@ GitHub classroom: [url https://classroom.github.com/a/K0XomKEP classroom.github. и имплементира метод: .bulleted -- [`NewSemester`], който приема учебна година и тип, и връща нов обект от семестър с попълнени данни +- {` NewSemester}, който приема учебна година и тип, и връща нов обект от семестър с попълнени данни Имаме потребители, като всеки си има роля, определяща неговите способности в системата. Ролята може да бъде студент, преподавател или администратор, като при конкретизиране в условието на някои от тях трябва да се извършат съответните проверки. diff --git a/src/teaching/oop-2023/week15/index.du b/src/teaching/oop-2023/week15/index.du index 55ee303..d23e7bd 100644 --- a/src/teaching/oop-2023/week15/index.du +++ b/src/teaching/oop-2023/week15/index.du @@ -1,8 +1,11 @@ -# Задачи - ООП, Седмица 15, 30.05.2024 +'def title Задачи - ООП, Седмица 15, 30.05.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/z2QadyEE classroom.github.com/a/z2QadyEE] +GitHub classroom: {url classroom.github.com/a/z2QadyEE;https://classroom.github.com/a/z2QadyEE} ## Задача @@ -19,7 +22,7 @@ GitHub classroom: [url https://classroom.github.com/a/z2QadyEE classroom.github. - линк (хипервръзка) като текст и (уеб) адрес - време: дата и час -Всеки тип трябва да имплементира [`Print`] член-функция, която изкарва текстово съдържание на съобщението. +Всеки тип трябва да имплементира {` Print} член-функция, която изкарва текстово съдържание на съобщението. За текстово съобщение това е самия текст, за локация това е низ във формата "[ДЪРЖАВА] ГРАД(ОБЛАСТ) УЛИЦА NoНОМЕР НА УЛИЦА", за линк е самия текст и за време е "ЧАС:МИНУТИ ДЕН.МЕСЕЦ.ГОДИНА". Реализирайте потребители, като за всеки потребител имаме потребителско име и парола. diff --git a/src/teaching/oop-2023/week16/index.du b/src/teaching/oop-2023/week16/index.du index 604c746..bc142e2 100644 --- a/src/teaching/oop-2023/week16/index.du +++ b/src/teaching/oop-2023/week16/index.du @@ -1,8 +1,11 @@ -# Задачи - ООП, Седмица 16, 06.06.2024 +'def title Задачи - ООП, Седмица 16, 06.06.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/BWjw2dUC classroom.github.com/a/BWjw2dUC] +GitHub classroom: {url classroom.github.com/a/BWjw2dUC;https://classroom.github.com/a/BWjw2dUC} ## Задача @@ -13,7 +16,7 @@ GitHub classroom: [url https://classroom.github.com/a/BWjw2dUC classroom.github. Разбира се, отдолу няма истински файлове които се запазват в харддиск (примерно), просто ОС превежда всички тези операции върху файлове със съответни действия към устройството. Реализирайте подобна система. -Първо трябва ни обща схема за файлове, за всеки файл имаме [`Read`] и [`Write`] методи, и пазим името на файла. +Първо трябва ни обща схема за файлове, за всеки файл имаме {` Read} и {` Write} методи, и пазим името на файла. За всяко устройство само по себе си знаем, че трябва да използваме определен драйвър (по име) и че то има малко информация за себе си: марка като низ и модел като цяло число. По-конкретно разглежаме два основни типа устройства: индексируемо и поточно (streamable). diff --git a/src/teaching/oop-2023/week2/index.du b/src/teaching/oop-2023/week2/index.du index ade800c..9cecfd6 100644 --- a/src/teaching/oop-2023/week2/index.du +++ b/src/teaching/oop-2023/week2/index.du @@ -1,14 +1,17 @@ -# Задачи - ООП, Седмица 2, 29.02.2024 +'def title Задачи - ООП, Седмица 2, 29.02.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/3qPsfyyI classroom.github.com/a/3qPsfyyI] +GitHub classroom: {url classroom.github.com/a/3qPsfyyI;https://classroom.github.com/a/3qPsfyyI} ## Задача 0 - Преговорна -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise0.cpp Решения] +.solution-link {url Решения;https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise0.cpp} -Ще работим върху N-мерен [url https://en.wikipedia.org/wiki/Tic-tac-toe морски шах], тоест ще имаме дъска за морски шах, която може да е по-голяма от 3 на 3 (примерно 5 на 5, 7 на 7 и т.н.). +Ще работим върху N-мерен {url морски шах;https://en.wikipedia.org/wiki/Tic-tac-toe}, тоест ще имаме дъска за морски шах, която може да е по-голяма от 3 на 3 (примерно 5 на 5, 7 на 7 и т.н.). Няма да се занимаваме с проверки дали (и кой) е спечелил след даден ход, интересуваме се само от запазването на данни. Основната логика е следната, като във всяка подточка правила по имплементацията са зададени. @@ -23,9 +26,10 @@ GitHub classroom: [url https://classroom.github.com/a/3qPsfyyI classroom.github. За всеки играч трябва съответно да изкарате общия брой X-ове или броя O-та в цялата дъска, както и дължината на най-дългата последователност от Х-ове или О-та в един реда на дъската (примерно за първия играч, търсим реда с най-много последователни X-ове, и изкарваме тяхната бройка). -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -46,54 +50,55 @@ Emil Petkov: Total - 13, Longest - 4 BoburaBG: Total - 12, Longest - 3 + ### а) без структури -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise0.cpp#L3-L83 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise0.cpp#L3-L83} -.important Решете подточката [=без=] структури, тоест без знания по ООП +.important Решете подточката {b без} структури, тоест без знания по ООП -Имплементирайте [=функция=] [`boardCounts`], която приема дъската и връща по някакъв начин нужните бройки: общ брой X-ове, общ брой O-та, брой X-ове в най-дългата последователност от X-ове в ред, брой O-та в най-дългата последователност от O-та в ред. +Имплементирайте {b функция} {` boardCounts}, която приема дъската и връща по някакъв начин нужните бройки: общ брой X-ове, общ брой O-та, брой X-ове в най-дългата последователност от X-ове в ред, брой O-та в най-дългата последователност от O-та в ред. -След това имплементирайте фукция [`printResult`], която приема имената на двата играча, както и бройките, върнати от [`boardCounts`], и изкарва на екрана съобщенията във формата от примера. +След това имплементирайте фукция {` printResult}, която приема имената на двата играча, както и бройките, върнати от {` boardCounts}, и изкарва на екрана съобщенията във формата от примера. ### б) структура за board -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise0.cpp#L85-L166 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise0.cpp#L85-L166} "Слепете" в една съвкупност (структура) указателя към самата дъска за морски шах, както и нейния размер N. -Нека името на структурата да бъде [`GameBoard`]. +Нека името на структурата да бъде {` GameBoard}. -Обновете [`boardCounts`], така че вместо да приема дъската и размера ѝ чрез две променливи, да ги приема чрез една променлива от тип [`GameBoard`]. +Обновете {` boardCounts}, така че вместо да приема дъската и размера ѝ чрез две променливи, да ги приема чрез една променлива от тип {` GameBoard}. ### в) структура за числата -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise0.cpp#L168-L255 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise0.cpp#L168-L255} -"Слепете" в една съвкупност (структура) на име [`BoardCounts`] четирите променливи, които [`boardCounts`] връща. +"Слепете" в една съвкупност (структура) на име {` BoardCounts} четирите променливи, които {` boardCounts} връща. -Обновете [`boardCounts`] да връща една стойност от тип [`BoardCounts`], вместо да връща четирите бройки като отделни числа. -Обновете [`printResult`] да приема стойност от тип [`BoardCounts`], вместо да приема четирите бройки като отделни числа. +Обновете {` boardCounts} да връща една стойност от тип {` BoardCounts}, вместо да връща четирите бройки като отделни числа. +Обновете {` printResult} да приема стойност от тип {` BoardCounts}, вместо да приема четирите бройки като отделни числа. ### г) структура за цялата игра -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise0.cpp#L257-L300 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise0.cpp#L257-L300} -Сега "слепете" предходните две структури, заедно с имената на нашите играчи, в една голяма обща структура за цялата игра на име [`Game`]. -Тоест, всичките ни данни: дъската, бройките и имената на играчите, да се намират в [`Game`]. +Сега "слепете" предходните две структури, заедно с имената на нашите играчи, в една голяма обща структура за цялата игра на име {` Game}. +Тоест, всичките ни данни: дъската, бройките и имената на играчите, да се намират в {` Game}. -.important Искам да [*композирате*], тоест искам да използвате [`GameBoard`] и [`BoardCounts`] структурите в [`Game`] структурата. +.important Искам да {i композирате}, тоест искам да използвате {` GameBoard} и {` BoardCounts} структурите в {` Game} структурата. -Обновете [`boardCounts`] и [`printResult`], така че да използват тази структура. +Обновете {` boardCounts} и {` printResult}, така че да използват тази структура. ## Задача 1 - Основи от материала -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise1.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise1.cpp} Работите върху система за инвентар на книжарница. -.warn Не е задължително, но е препоръчително да си направите и една структура [`String`] с конструктор и деструктор +.warn Не е задължително, но е препоръчително да си направите и една структура {` String} с конструктор и деструктор -Създайте структура [`Book`] със скрити (private) данни за: +Създайте структура {` Book} със скрити (private) данни за: .bulleted - заглавие, като един низ - автори, като масив от низове @@ -108,60 +113,60 @@ Set-ърите трябва да записват стойности в данн - годината на публикация не може да надвишава 2024, не може да е по-малка от -2100 (2100 п.н.е.) и не може да бъде нула - цената не може да е отрицателна -Всеки от мутаторите трябва да връща булева стойност, [`true`] ако проверките са изпълнени (и запазването на данни е извършено) и [`false`] ако съответната проверка не е изпълнена (и няма промяна в данните). +Всеки от мутаторите трябва да връща булева стойност, {` true} ако проверките са изпълнени (и запазването на данни е извършено) и {` false} ако съответната проверка не е изпълнена (и няма промяна в данните). Създайте съответните конструктори и деструктори. -След това направете структура [`Library`], която държи масив от книги и бройката за всяка книга (отново като скрити данни). +След това направете структура {` Library}, която държи масив от книги и бройката за всяка книга (отново като скрити данни). Най-лесния вариант е да имате втори масив, като за всеки индекс в масива с книги, на същия индекс в масива за бройки се намира съответната бройка. -Можете и да го направите чрез структура [`Pair`] и да имате един масив. +Можете и да го направите чрез структура {` Pair} и да имате един масив. -Като публични методи на [`Library`] имплементирайте [`AddBook`], която вмъква нова книга в масива, и [`RemoveBook`] която съответно "премахва" книга по заглавие и година. -Допълнително направете член-функция [`StockBook`], която приема заглавие на книга, годината ѝ, и цяло число с което наличната бройка се увеличава. -Аналогично направете и [`SellBook`]. +Като публични методи на {` Library} имплементирайте {` AddBook}, която вмъква нова книга в масива, и {` RemoveBook} която съответно "премахва" книга по заглавие и година. +Допълнително направете член-функция {` StockBook}, която приема заглавие на книга, годината ѝ, и цяло число с което наличната бройка се увеличава. +Аналогично направете и {` SellBook}. За всики тези методи трябва да имате съответните проверки: .bulleted -- ако напълно идентична книга вече съществува, [`AddBook`] не трябва да я добавя на ново -- [`RemoveBook`] не трябва да "гърми" ако книгата не съществува -- бройката на добавени/продадени книги, подадени на [`SellBook`] и [`StockBook`], трябва да бъдат положителни, както и книгите да съществуват +- ако напълно идентична книга вече съществува, {` AddBook} не трябва да я добавя на ново +- {` RemoveBook} не трябва да "гърми" ако книгата не съществува +- бройката на добавени/продадени книги, подадени на {` SellBook} и {` StockBook}, трябва да бъдат положителни, както и книгите да съществуват -Аналогично като при [`Book`], тези функции трябва да връщат булева стойност, дали проверките са изпълнени. +Аналогично като при {` Book}, тези функции трябва да връщат булева стойност, дали проверките са изпълнени. Не забравяйте за конструктор и деструктор! .question Можете ли да си улесните работата, ако използвате скрити член-функции? -Не е нужно да правите потребителски вход/изход, но тествайте ръчно кода си в [`main`]. +Не е нужно да правите потребителски вход/изход, но тествайте ръчно кода си в {` main}. ## Задача 2 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise2.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise2.cpp} Работите върху система за Excel-ски таблици. Една клетка може да съдържа някаква числена стойност, или проста формула която определя тази стойност. -Създайте структура [`Cell`], която запазва (скрито) целочислена стойност, знак, който определя опреацията във формулата, и два указателя на [`Cell`] към двете страни на оператора. -Оператора (знака) може да бъде [`+`], [`-`], [`*`] или [`/`]. +Създайте структура {` Cell}, която запазва (скрито) целочислена стойност, знак, който определя опреацията във формулата, и два указателя на {` Cell} към двете страни на оператора. +Оператора (знака) може да бъде {` +}, {` -}, {` *} или {` /}. Идеята е, че ако клетката само запазва стойност, тогава оператора ще бъде нещо празно (терминираща нула например). Обаче ако се определя от формула, тогава оператора и указателите също ще са попълнени, а запазената стойност ще действа като кеш, тоест вместо всеки път да преизчисляваме стойността когато я искаме, преизчислили сме я веднъж и я запазваме. -За тази цел имплементирайте публична член-функция [`evaluate`], ако не е запазена формула, тя не прави нищо, ако е, прави съответното изчисление и запазва резултата. -Разбира се, направете и мутатори [`setValue`] и [`setFormula`], със съответните проверки. +За тази цел имплементирайте публична член-функция {` evaluate}, ако не е запазена формула, тя не прави нищо, ако е, прави съответното изчисление и запазва резултата. +Разбира се, направете и мутатори {` setValue} и {` setFormula}, със съответните проверки. Не забравяйте за конструктор и деструктор. -Сега направете структура [`Table`], която пази (скрито) двумерен масив от клетки. -Имплементирайте селектор [`getCell`], който връща указател на клетка по координати и мутатор [`setCell`], който приема клетка и координати в масива. +Сега направете структура {` Table}, която пази (скрито) двумерен масив от клетки. +Имплементирайте селектор {` getCell}, който връща указател на клетка по координати и мутатор {` setCell}, който приема клетка и координати в масива. .question Какъв ще е типа на подадената клетка и стойностите в масива? -Направете метод [`updateCell`], чрез която стойностите на клетка по координати могат да бъдат променени, и след това всички клетки в таблицата се преизчисляват. +Направете метод {` updateCell}, чрез която стойностите на клетка по координати могат да бъдат променени, и след това всички клетки в таблицата се преизчисляват. -Последно, имплементирайте и член-функция [`printTable`], която изкарва на екрана цялата таблица, като клетката на индекси 0,0 се намира в горния ляв ъгъл, всички клетки са разделени с [`|`]. +Последно, имплементирайте и член-функция {` printTable}, която изкарва на екрана цялата таблица, като клетката на индекси 0,0 се намира в горния ляв ъгъл, всички клетки са разделени с {` |}. -Не е нужно да правите потребителски вход/изход, но тествайте ръчно кода си в [`main`]. +Не е нужно да правите потребителски вход/изход, но тествайте ръчно кода си в {` main}. ## Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise3.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise3.cpp} Изграждате "симулация" за трафик върху секция от магистрала. @@ -185,7 +190,7 @@ Set-ърите трябва да записват стойности в данн Ако една кола успешно "излиза" от участака на магистралата, тоест тя се опитва да се придвижи някъде след края ѝ, зачитаме че успешно е минала пътя и спираме да я разглеждаме. Сами определете как ще изглеждат структурите за колата и магистралата, както и нужните методи. -Имайте предвид, че трябва цялата логика да присъства в тези структури, тоест в [`main`] трябва да присъства само някакъв инициализиращ код. +Имайте предвид, че трябва цялата логика да присъства в тези структури, тоест в {` main} трябва да присъства само някакъв инициализиращ код. .important Не е позволено магистралата да бъде двумерна матрица, координатите на всяка кола се пазят в самата кола. @@ -194,7 +199,7 @@ Set-ърите трябва да записват стойности в данн ## Задача 4 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise4.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week02/Exercise4.cpp} Имате фабрика, цялата ѝ структура се разглежда като един конвейер, тоест като една редица машини, всяка от които приема някакъв материал и връща този материал преобразуван. @@ -207,7 +212,7 @@ Set-ърите трябва да записват стойности в данн Типовете на материалите са отделни стойности от идентификационните номера, тоест като е подаден материал, той се превръща в крайния тип, и трябва да намерите на кой материал точва число е началния тип. Всички тези данни трябва да са скрити, трябва за съответните структури да присъстват конструктори и деструктори. -Допълнително при машините трябва да има член-функция [`convertMaterial`], която получава идентификационен номер на материал и бройка, и връща колко от резултатния материал е успяла да създаде (спрямо ефикасността, закръглена надолу, и дали се нуждае от ремонт по средата на работата). +Допълнително при машините трябва да има член-функция {` convertMaterial}, която получава идентификационен номер на материал и бройка, и връща колко от резултатния материал е успяла да създаде (спрямо ефикасността, закръглена надолу, и дали се нуждае от ремонт по средата на работата). Ще получите данни за всички материали и машини, както и задачи, тоест идентификационни номера на начален и краен материал, както и бройката на началния материал. Трябва да намерите редицата от машини, които ще създадат възможно най-много краен материал. diff --git a/src/teaching/oop-2023/week3/index.du b/src/teaching/oop-2023/week3/index.du index 9617d36..663b70b 100644 --- a/src/teaching/oop-2023/week3/index.du +++ b/src/teaching/oop-2023/week3/index.du @@ -1,16 +1,19 @@ -# Задачи - ООП, Седмица 3, 07.03.2024 +'def title Задачи - ООП, Седмица 3, 07.03.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/KPMqXsFp classroom.github.com/a/KPMqXsFp] +GitHub classroom: {url classroom.github.com/a/KPMqXsFp;https://classroom.github.com/a/KPMqXsFp} ## Преговорни ### Задача 1 - Структури -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise1.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise1.cpp} -Имплементирайте структура [`Lightbulb`], която запазва идентифициращите данни за една крушка: +Имплементирайте структура {` Lightbulb}, която запазва идентифициращите данни за една крушка: .bulleted - диаметър и дължина: и двете са целочислени стойности - тип: низ с максимална дължина от 100 знака @@ -18,9 +21,9 @@ GitHub classroom: [url https://classroom.github.com/a/KPMqXsFp classroom.github. ### Задача 2 - Капсулация -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise2.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise2.cpp} -Имплементирайте структура [`Alarm`], която съдържа следните [=скрити=] данни: +Имплементирайте структура {` Alarm}, която съдържа следните {b скрити} данни: .bulleted - име на модел: низ с максимална дължина от 1024 знака - пин код: целочислено число @@ -38,57 +41,57 @@ GitHub classroom: [url https://classroom.github.com/a/KPMqXsFp classroom.github. ### Задача 3 - Капсулация с динамична памет -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise3.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise3.cpp} -Имплементирайте структура [`Person`], която запазва двете имена на човек, възраст като целочислено число и неговия имейл. +Имплементирайте структура {` Person}, която запазва двете имена на човек, възраст като целочислено число и неговия имейл. Имената и имейла са низвое с произволна дължина. -Направете конструктор, който приема възрастта и тези три низа, и [=копира=] стойностите им в динамичната памет. +Направете конструктор, който приема възрастта и тези три низа, и {b копира} стойностите им в динамичната памет. Също напишете и деструктор, който коректно трие нужните данни. ### Задача 4 - Динамично-заделени структури в други структури -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise4.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise4.cpp} -Имплементирайте структура [`Bus`], която публично запазва капацитета хора и километража на един автобус. +Имплементирайте структура {` Bus}, която публично запазва капацитета хора и километража на един автобус. -Имплементирайте структура [`BusWarehouse`], която запазва динамично-заделен масив от автобуси. -В конструктора се въвежда максималния брой автобуси, който може един [`BusWarehouse`] да съдържа. +Имплементирайте структура {` BusWarehouse}, която запазва динамично-заделен масив от автобуси. +В конструктора се въвежда максималния брой автобуси, който може един {` BusWarehouse} да съдържа. Имплементирайте конструктор, който само инициализира нужните данни, и деструктор който трие каквото трябва. -Имплементирайте член-функция [`AddBus`], която добавя автобус в инстанция на [`BusWarehouse`], ако има място за него. +Имплементирайте член-функция {` AddBus}, която добавя автобус в инстанция на {` BusWarehouse}, ако има място за него. ## Лесни задачи ### Задача 5 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise5.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise5.cpp} -Имплементирайте структура [`Car`], всяка кола пази скрито своя модел като низ с произволна дължина, брой врати и брой седалки като целочислени числа. +Имплементирайте структура {` Car}, всяка кола пази скрито своя модел като низ с произволна дължина, брой врати и брой седалки като целочислени числа. Направете съответните get-ъри, set-ъри, конструктор и деструктор. -Имплементирайте структура [`TrafficJam`], която пази произволно дълга редица коли в задръстване. -Направете и член-функция [`AddCar`], която вмъква кола в края на редицата. +Имплементирайте структура {` TrafficJam}, която пази произволно дълга редица коли в задръстване. +Направете и член-функция {` AddCar}, която вмъква кола в края на редицата. Тази функция може да се извиква произволен брой пъти, затова имплементирайте и оразмеряване на вътрешната редица. -[`TrafficJam`] трябва да има конструктор, деструктор и тази член-функция. +{` TrafficJam} трябва да има конструктор, деструктор и тази член-функция. ### Задача 6 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise6.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise6.cpp} Ще работите с N-мерна шахматна дъска. -Направете структура [`ChessPiece`], която запазва цвета и типа на фигурата от шах, като първото е целочислена стойност, второто е буква. +Направете структура {` ChessPiece}, която запазва цвета и типа на фигурата от шах, като първото е целочислена стойност, второто е буква. -Направете структура [`ChessBoard`], която по подадено N в конструктора създава шахматна дъска с размер NxN с [=указатели=] към съответните фигури на дъската. +Направете структура {` ChessBoard}, която по подадено N в конструктора създава шахматна дъска с размер NxN с {b указатели} към съответните фигури на дъската. Разбира се, някои от тези указатели трябва да сочат към някакви създадени шахматни фигури. При създаване на дъската, трябва да подредите фигурите. На най-долните два реда присъстват белите фигури, на най-горните два - черните. За дъска 8х8, фигурите са подредени както нормално: -[image https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/The_chess_board_from_Chess.jpg/1024px-The_chess_board_from_Chess.jpg?20210610045654] +{img https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/The_chess_board_from_Chess.jpg/1024px-The_chess_board_from_Chess.jpg?20210610045654} При по-големи дъски започвате да повтаряте редиците, докато при по-малките ги режете, от дясната страна. Тоест в дъска 10x10 първите 8 колони изглеждат като на картинката, на 9та колона (отгоре-надолу) имате черен топ, черна пешка, 6 празни места, бяла пешка, бял топ и на последната колона са черен кон, черна пешка, 6 празни места, бяла пешка, бял кон. @@ -98,22 +101,22 @@ GitHub classroom: [url https://classroom.github.com/a/KPMqXsFp classroom.github. ### Задача 7 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise7.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise7.cpp} Имате затворени интервали от целочислени числа. Разглеждаме смесване на интервали: .bulleted -- смеската на допиращи се интервали е тяхното слепване, тоест смеската на [`[0, 3]`] и [`[3, 5]`] е [`[0, 5]`] -- смеската на препокриващи се интервали е тяхното обединение, тоест смеската на [`[0, 5]`] и [`[3, 8]`] е [`[0, 8]`] +- смеската на допиращи се интервали е тяхното слепване, тоест смеската на {` [0, 3]} и {` [3, 5]} е {` [0, 5]} +- смеската на препокриващи се интервали е тяхното обединение, тоест смеската на {` [0, 5]} и {` [3, 8]} е {` [0, 8]} -В противен случай не можем да смесим интервалите (примерно не можем да смесим [`[0, 3]`] и [`[4, 8]`]). +В противен случай не можем да смесим интервалите (примерно не можем да смесим {` [0, 3]} и {` [4, 8]}). Започвайки от някакво множество с интервали, смесете колкото се може повече от тях и изкарайте всичките резултатни интервали, които не могат повече да се смесят. Използвайте структури и член-функции. ### Задача 8 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise8.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week03/Exercise8.cpp} "Моделирайте" (тоест сами се сетете за типовете данни и нужните структури) един град със следните харакетристики. @@ -125,7 +128,7 @@ GitHub classroom: [url https://classroom.github.com/a/KPMqXsFp classroom.github. Градът трябва да пази всички отделни сгради, като допълнително за всяка жилищна трябва да съхранява общата бройка жители, a за всяка търговска - общата бройка отворени магазини. Освен това трябва да се съхрани и нещо като карта на всичките сгради: допускаме Старозагоско/Манхатънско подреждане на сградите, тоест всички сгради се намират върху някаква "решетка". -.question Познавате ли структурата [`Pair`]? +.question Познавате ли структурата {` Pair}? Имплементирайте възможност за построяване и събаряне на сгради. Направете нужните проверки на всички данни: цената да не е отрицателна, бройката жители да не надвишава капацитета на сградата и так. нат. @@ -153,25 +156,25 @@ GitHub classroom: [url https://classroom.github.com/a/KPMqXsFp classroom.github. Винаги започваме с една празна начална директория. Двете функции, за създаване и изтриване, трябва да приемат масив от низове, който определя път от директории към желания файл, започвайки от началния файл. -Тоест, ако бяха подадени низовете [`Documents`], [`Personal`], [`Health`], [`receipt.txt`], тогава от началния файл намираме името [`Documents`] и "влизаме" в директорията със съответния идентификационен номер, в нея намираме името [`Personal`] и так. нат. +Тоест, ако бяха подадени низовете {` Documents}, {` Personal}, {` Health}, {` receipt.txt}, тогава от началния файл намираме името {` Documents} и "влизаме" в директорията със съответния идентификационен номер, в нея намираме името {` Personal} и так. нат. ### Задача 10 -Намираме се в равнината, при която всички (двуизмерни) координати са [=целочислени=]. +Намираме се в равнината, при която всички (двуизмерни) координати са {b целочислени}. В нея имаме стъклени панели (прави отсечки), дефинирани с координатите на двете им крайни точки. Допълнително всеки панел си има свой цвят (като проценти, между 0 и 1, от цветовете червено, зелено и синьо) и прозрачност (като процент, между 0 и 1). Също имаме и един лъч, той се характеризира с началния си координат и единичен двуизмерен вектор, определящ неговата посока на движение. -Този лъч не се пречупва и винаги се движи напред (преместването на лъча се извършва чрез [`позиция = позиция + посока`]). +Този лъч не се пречупва и винаги се движи напред (преместването на лъча се извършва чрез {` позиция = позиция + посока}). Чрез този лъч трябва да изкарате композитния цвят, след като лъча е минал през всички стъклени панели пред него. Нека също композитния цвят винаги да има 100% прозрачност. -Примерно, ако лъча премине през един панел с цветови проценти [`0,1,0`] и прозрачност [`0.5`] и още един панел с цветови проценти [`0,1,1`] и прозрачност [`0.5`], тогава композитния цвят е [`0,1,0.5`]. +Примерно, ако лъча премине през един панел с цветови проценти {` 0,1,0} и прозрачност {` 0.5} и още един панел с цветови проценти {` 0,1,1} и прозрачност {` 0.5}, тогава композитния цвят е {` 0,1,0.5}. .question Колко структури ще ви трябват? ## Признания -Изображението на шахматната дъска от chess.com, направено от Hfjhjoiijklij4 за [url https://commons.wikimedia.org/w/index.php?curid=106440749 Уикипедия] под лиценз CC BY-SA 4.0 +Изображението на шахматната дъска от chess.com, направено от Hfjhjoiijklij4 за {url Уикипедия;https://commons.wikimedia.org/w/index.php?curid=106440749} под лиценз CC BY-SA 4.0 diff --git a/src/teaching/oop-2023/week4/index.du b/src/teaching/oop-2023/week4/index.du index 3b2c19f..d25085a 100644 --- a/src/teaching/oop-2023/week4/index.du +++ b/src/teaching/oop-2023/week4/index.du @@ -1,16 +1,19 @@ -# Задачи - ООП, Седмица 4, 14.03.2024 +'def title Задачи - ООП, Седмица 4, 14.03.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/qa_FfWeG classroom.github.com/a/qa_FfWeG] +GitHub classroom: {url classroom.github.com/a/qa_FfWeG;https://classroom.github.com/a/qa_FfWeG} ## Преговорни ### Задача 1 - Капсулация -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week04/Exercise1.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week04/Exercise1.cpp} -Имплементирайте структура [`Smartphone`], която запазва [=скрито=]: +Имплементирайте структура {` Smartphone}, която запазва {b скрито}: .bulleted - марка, низ с максимална дължина от 128 знака - модел, низ с максимална дължина от 512 знака @@ -27,11 +30,11 @@ GitHub classroom: [url https://classroom.github.com/a/qa_FfWeG classroom.github. ### Задача 2 - Капсулация с динамична памет -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week04/Exercise2.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week04/Exercise2.cpp} -Имплементирайте структура [`Bee`], която запазва възрастта на пчела чрез число с плаваща запетая и типа пчела с буква. +Имплементирайте структура {` Bee}, която запазва възрастта на пчела чрез число с плаваща запетая и типа пчела с буква. -Имплементирайте структура [`BeeHive`], която запазва динамично-заделен масив с всички реещи се пчели и друг динамично-заделен масив с всички яйца в кошера. +Имплементирайте структура {` BeeHive}, която запазва динамично-заделен масив с всички реещи се пчели и друг динамично-заделен масив с всички яйца в кошера. Размерите на двата масива се подават на конструктора. Имплементирайте нужните конструктор и деструктор. @@ -39,47 +42,47 @@ GitHub classroom: [url https://classroom.github.com/a/qa_FfWeG classroom.github. ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week04/Exercise3.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week04/Exercise3.cpp} -Имплементирайте структура [`Paper`], която запазва своето текстово съдържание като низ от максимум 1024 знака и положително цяло число, определящо номера на страницата. +Имплементирайте структура {` Paper}, която запазва своето текстово съдържание като низ от максимум 1024 знака и положително цяло число, определящо номера на страницата. -От входа получавате на един ред цялото текстото съдържание за един обект от тип [`Paper`] и на следващия ред - бройките копия [`N`] на дадения обект. +От входа получавате на един ред цялото текстото съдържание за един обект от тип {` Paper} и на следващия ред - бройките копия {` N} на дадения обект. -Създайте [`Paper`] обект със съответното съдържание и номер на страницата [`1`]. -Създайте динамично-заделен масив от [`Paper`] с размер [`N`], като първия му елемент е новосъздадения обект, докато останалите са [=копия=] на първия обект. +Създайте {` Paper} обект със съответното съдържание и номер на страницата {` 1}. +Създайте динамично-заделен масив от {` Paper} с размер {` N}, като първия му елемент е новосъздадения обект, докато останалите са {b копия} на първия обект. При всяко копие, трябва да увеличите номера на страницата. Имплементирейте логиката чрез копиращ конструктор. ### Задача 4 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week04/Exercise4.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week04/Exercise4.cpp} -Създайте структура [`DynamicString`], чиито конструктор приема низ с терминираща нула, заделя точно толкова динамична памет, колкото е нужно да се запази целия низ и копира буквите на низа в тази памет. +Създайте структура {` DynamicString}, чиито конструктор приема низ с терминираща нула, заделя точно толкова динамична памет, колкото е нужно да се запази целия низ и копира буквите на низа в тази памет. Имплементирайте оператор равно. -.question Какви данни трябва [`DynamicString`] да запазва скрито? +.question Какви данни трябва {` DynamicString} да запазва скрито? :question -Какво трябва оператор равно да направи, ако записваме в [`DynamicString`] с вече заделена памет?\n +Какво трябва оператор равно да направи, ако записваме в {` DynamicString} с вече заделена памет?\n Тоест ако имахме:\n -[`DynamicString s1("Hello"); DynamicString s2("World"); s2 = s1;`] +{` DynamicString s1("Hello"); DynamicString s2("World"); s2 = s1;} ### Задача 5 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week04/Exercise5.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week04/Exercise5.cpp} -Имплементирайте структура [`TVProgram`], която запазва името на предаването като низ от максимум 1024 знака, начало на излъчване и край на излъчване като неотрицателни целочислени числа (като примерно 1347 е един часа и 47 минути следобед). +Имплементирайте структура {` TVProgram}, която запазва името на предаването като низ от максимум 1024 знака, начало на излъчване и край на излъчване като неотрицателни целочислени числа (като примерно 1347 е един часа и 47 минути следобед). Имплементирайте конструктор, деструктор, оператор равно и копиращ конструктор. -Имплементирайте структура [`TVChannel`], която запазва динамично заделен масив от [`TVProgram`], размера на динамично заделената памет и броя "ненулеви" елементи (програми, добавени с [`AddProgram`]). +Имплементирайте структура {` TVChannel}, която запазва динамично заделен масив от {` TVProgram}, размера на динамично заделената памет и броя "ненулеви" елементи (програми, добавени с {` AddProgram}). -Имплементирайте нейн метод [`AddProgram`], който приема [`TVProgram`] [=по копие=] и го вмъква на последната свободна позиция в масива. +Имплементирайте нейн метод {` AddProgram}, който приема {` TVProgram} {b по копие} и го вмъква на последната свободна позиция в масива. Ако масива е пълен, трябва да го "оразмерите" (да направите нов, по-голям масив, да копирате данните от стария в новия, да изтриете стария и да обновите указателя да сочи към новия). -.question Кога използвате копиращия конструктор на [`TVProgram`] и кога използвате оператор равно? +.question Кога използвате копиращия конструктор на {` TVProgram} и кога използвате оператор равно? ## Трудни задачи @@ -92,9 +95,9 @@ GitHub classroom: [url https://classroom.github.com/a/qa_FfWeG classroom.github. Гравитационното привличане на звезда в своя център се определя от ъгъла θ<sub>max</sub> (в градуси). Планетата се върти около една звезда, използвайки стандартната матрица за ротация: -[image ./img/Rotation_matrix.png] +{img ./img/Rotation_matrix.png} -Ъгълът на въртене θ, спрямо разстоянието до една звезда, се определя чрез [url https://en.wikipedia.org/wiki/Inverse-square_law закона на обратните квадрати], тоест в зависимост от разстоянието [`d`] между центъра на звездата и центъра на планетата, то истинският ъгъл на завъртане е θ = θ<sub>max</sub> * 1 / d^2. +Ъгълът на въртене θ, спрямо разстоянието до една звезда, се определя чрез {url закона на обратните квадрати;https://en.wikipedia.org/wiki/Inverse-square_law}, тоест в зависимост от разстоянието {` d} между центъра на звездата и центъра на планетата, то истинският ъгъл на завъртане е θ = θ<sub>max</sub> * 1 / d^2. Допълнително, ако имаме повече от една звезда, тогава ще използваме θ' = max(θ<sub>i</sub> - average(θ<sub>1</sub>, ..., θ<sub>n</sub>)), където θ<sub>i</sub> е намереният ъгъл θ за i-тата звезда и имаме n на брой звезди. @@ -105,11 +108,11 @@ GitHub classroom: [url https://classroom.github.com/a/qa_FfWeG classroom.github. Имплементирайте структури: .bulleted -- [`Matrix2x2`] и [`Matrix2x1`], чиито стойности са числа с плаваща запетая, и с член функции за събиране и умножение (не оператор+, оператор\*) -- [`Coordinate`], която запазва ([=не наследява=]) точките в пространството като [`Matrix2x1`] и имплементира събиране, умножение и разстояние между координати и матрици -- [`Star`], запазваща координатата на своя център ([`Matrix2x1`]) и ъгълът θ<sub>max</sub> като число с плаваща запетая. +- {` Matrix2x2} и {` Matrix2x1}, чиито стойности са числа с плаваща запетая, и с член функции за събиране и умножение (не оператор+, оператор\*) +- {` Coordinate}, която запазва ({b не наследява}) точките в пространството като {` Matrix2x1} и имплементира събиране, умножение и разстояние между координати и матрици +- {` Star}, запазваща координатата на своя център ({` Matrix2x1}) и ъгълът θ<sub>max</sub> като число с плаваща запетая. Имплементирайте и метод, който приема планета и връща ъгълът θ. -- [`Planet`], запазваща своите координати ([`Matrix2x1`]) и изминалото време (тоест колко пъти се е движела от началото на симулацията). - Имплементирайте метод [`OrbitPlanet`], която приема планета и ъгъл θ', и се завърта около нея. -- [`Universe`], запазваща всички звездите и планетата. - Имплементирайте метод [`FullOrbit`], която връща звездата около която планетата е успяла да извърши пълна ротация и времето за което това се е случило. +- {` Planet}, запазваща своите координати ({` Matrix2x1}) и изминалото време (тоест колко пъти се е движела от началото на симулацията). + Имплементирайте метод {` OrbitPlanet}, която приема планета и ъгъл θ', и се завърта около нея. +- {` Universe}, запазваща всички звездите и планетата. + Имплементирайте метод {` FullOrbit}, която връща звездата около която планетата е успяла да извърши пълна ротация и времето за което това се е случило. diff --git a/src/teaching/oop-2023/week5/index.du b/src/teaching/oop-2023/week5/index.du index 265e4f7..2ee73ba 100644 --- a/src/teaching/oop-2023/week5/index.du +++ b/src/teaching/oop-2023/week5/index.du @@ -1,37 +1,40 @@ -# Задачи - ООП, Седмица 5, 21.03.2024 +'def title Задачи - ООП, Седмица 5, 21.03.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/42ZZ56Mg classroom.github.com/a/42ZZ56Mg] +GitHub classroom: {url classroom.github.com/a/42ZZ56Mg;https://classroom.github.com/a/42ZZ56Mg} ## Преговорни ### 1 задача - Капсулация с динамична памет -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise1.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise1.cpp} Пациент в болница се характеризира с идентификационен номер (неотрицателно целочислено число) и име (низ от максимум 1024 знака). Една болница има максимален капацититет на болни, които може да държи (максимален брой легла за тях). Конструктора за болницата приема максималния капацитет, като структурата за болницата пази всичките си пациенти. -Имплементирайте методи [`AddPatient`], който добавя нов пациент и [`RemovePatient`], който го премахва от болницата. +Имплементирайте методи {` AddPatient}, който добавя нов пациент и {` RemovePatient}, който го премахва от болницата. Не е нужно данните за пациентите да са скрити, но данните в болницата трябва да са. ### 2 задача - Копиращ конструктор и оператор= -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise2.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise2.cpp} -Имплементирайте структура [`FloatArray`], която запазва динамично-заделен масив от [`float`] стойности. +Имплементирайте структура {` FloatArray}, която запазва динамично-заделен масив от {` float} стойности. Размерът на масива се подава в конструктора. -Имплементирайте копиращ конструктор, оператор= и get-ър/set-ър за елемент на индекс [`i`]. +Имплементирайте копиращ конструктор, оператор= и get-ър/set-ър за елемент на индекс {` i}. ## Лесни задачи ### 3 задача -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise3.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise3.cpp} Имейл се характеризира с две стойности: адресът от който е изпратен (низ с максимална дължина от 128 знака) и съдържание (низ с неограничен размер). Съобщението се подава като указател към знак, и трябва да заделите точно толкова динамична памет, колкото ви трябва за целия текст. @@ -40,7 +43,7 @@ GitHub classroom: [url https://classroom.github.com/a/42ZZ56Mg classroom.github. ### 4 задача -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise4.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise4.cpp} Имплементирайте структура за касов бон, която запазва скрит динамично-заделен масив от цени (числа с плаваща запетая). Можете да добавяте неограничен брой цени в края на касовия бон (ако масива е пълен, създавате по-голям и пренасяте стойностите). @@ -51,7 +54,7 @@ GitHub classroom: [url https://classroom.github.com/a/42ZZ56Mg classroom.github. ### 5 задача -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise5.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise5.cpp} Един контролен списък (checklist) пази няколко неща: булева стойност, дали е избран или не, текстово съдържание (низ с "произволна" дължина) и масив от контролни списъци (всеки списък от този масив ще наричам "подсписък" за удобство). Нека текстовото съдържание да не може да се редактира (задава се в конструктора и няма set-ър). @@ -61,31 +64,31 @@ GitHub classroom: [url https://classroom.github.com/a/42ZZ56Mg classroom.github. ### 6 задача -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise6.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise6.cpp} Имате телефонен указател, който запазва масив от имена (низове). В началото винаги започва празен. Имплементирайте голяма четворка. -Имплементирайте метод [`InsertPerson`], който вмъква ново име в указателя, като вмъкването запазва сортировка по азбучен ред. -Тоест ако указателя беше [`{ "Atanas", "Yavor" }`], тогава след вмъкване на [`Boris`] ще имаме [`{ "Atanas", "Boris", "Yavor" }`]. +Имплементирайте метод {` InsertPerson}, който вмъква ново име в указателя, като вмъкването запазва сортировка по азбучен ред. +Тоест ако указателя беше {` { "Atanas", "Yavor" }}, тогава след вмъкване на {` Boris} ще имаме {` { "Atanas", "Boris", "Yavor" }}. .important Имплементирайте вмъкване, запазващо "сортираност" без функция за сортиране! ### 7 задача -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise7.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week05/Exercise7.cpp} Имплементирайте структура водомер, която скрито запазва отчетеното количество вода (double). -Има [=единствено=] конструктор по подразбиране, при който отчетеното количество е нула, метод [`AddWater`], който увеличава брояча с подаденото количество вода и метод [`Print`], който изкарва стойността на брояча на екрана. +Има {b единствено} конструктор по подразбиране, при който отчетеното количество е нула, метод {` AddWater}, който увеличава брояча с подаденото количество вода и метод {` Print}, който изкарва стойността на брояча на екрана. Имплементирайте голяма четворка (когато е нужно). Имплементирайте структура сграда, която има инсталирани подаден брой водомери. -Имплементирайте метод [`SimulateDay`], който "симулира" ден в сградата - към всички датчици се добавят между 0 и 0.42 вода (разглеждаме само числа с максимум 3 цифри след запетаята). +Имплементирайте метод {` SimulateDay}, който "симулира" ден в сградата - към всички датчици се добавят между 0 и 0.42 вода (разглеждаме само числа с максимум 3 цифри след запетаята). Количеството е случайно за всеки ден. -Имплементирайте метод [`SimulateMonth`], който "симулира" 30 дена в сградата, като на всеки 5 дена се прави "отчет" - всичките водомери се [=копират=] и запазват във вътрешен масив. +Имплементирайте метод {` SimulateMonth}, който "симулира" 30 дена в сградата, като на всеки 5 дена се прави "отчет" - всичките водомери се {b копират} и запазват във вътрешен масив. На края на месеца изкарайте на екрана, на един ред, всичките водомери от първите дни (първи ден на първи отчет, първи ден на втори отчет, ...), вторите дни, ... ### 8 задача @@ -93,15 +96,15 @@ GitHub classroom: [url https://classroom.github.com/a/42ZZ56Mg classroom.github. Една интернет заявка се характеризира с тип (низ от максимум 4 знака), версия на протокола (положително число с плаваща запетая) и идентификатор (буква). Нека тези данни да са скрити, като единствено могат да се set-нат от конструктора (тоест няма set-ъри, но има get-ъри) и е имлементирана голяма четворка (когато е нужно). -Интернет сървър обработва интернет заявки, като всяка получена заявка я запазва в нормалните логове (динамично-заделен масив със заявки) [=и=] в логовете за грешки (друг динамично-заделен масив със заявки). +Интернет сървър обработва интернет заявки, като всяка получена заявка я запазва в нормалните логове (динамично-заделен масив със заявки) {b и} в логовете за грешки (друг динамично-заделен масив със заявки). -Разглеждаме четири типа заявки: [`GET`], [`HEAD`], [`POST`] и [`PUT`]. +Разглеждаме четири типа заявки: {` GET}, {` HEAD}, {` POST} и {` PUT}. За всяка сървърът съдържа динамично-заделен масив от низове. Имплементирайте методи за добавяне на низ към всеки тип. Ако съответния масив от низове е пълен, тогава трябва да го уголемите. -Имплементирайте метод [`HandleRequest`], който приема интернет заявка [=по копие=], запазва я в нормалните логове и връща първия низ от масива на съответния тип, който започва с идентификатор-буквата. -Ако такъв низ не съществува, тогава връща низа "Bad request" и добавя заявката [=и=] в логовете за грешки. +Имплементирайте метод {` HandleRequest}, който приема интернет заявка {b по копие}, запазва я в нормалните логове и връща първия низ от масива на съответния тип, който започва с идентификатор-буквата. +Ако такъв низ не съществува, тогава връща низа "Bad request" и добавя заявката {b и} в логовете за грешки. Размерите на логовете се подават на конструктора. По принцип добавяте нови заявки в края на лога. diff --git a/src/teaching/oop-2023/week6/index.du b/src/teaching/oop-2023/week6/index.du index 2662f2c..5eee7f9 100644 --- a/src/teaching/oop-2023/week6/index.du +++ b/src/teaching/oop-2023/week6/index.du @@ -1,8 +1,11 @@ -# Задачи - ООП, Седмица 6, 28.03.2024 +'def title Задачи - ООП, Седмица 6, 28.03.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/rzSTn5pu classroom.github.com/a/rzSTn5pu] +GitHub classroom: {url classroom.github.com/a/rzSTn5pu;https://classroom.github.com/a/rzSTn5pu} .warn В задачите за файлове имплементирайте всички нужни проверки и затваряния @@ -10,17 +13,17 @@ GitHub classroom: [url https://classroom.github.com/a/rzSTn5pu classroom.github. ### 1 задача - Копиращ конструктор и оператор= -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise01.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise01.cpp} -Имплементирайте структура [`WoodenPlank`], която скрито запазва ширина, дължина и височина на дъската (целочислено), цената ѝ (число с плаваща запетая) и типа дърво (низ с максимум 1024 знака). +Имплементирайте структура {` WoodenPlank}, която скрито запазва ширина, дължина и височина на дъската (целочислено), цената ѝ (число с плаваща запетая) и типа дърво (низ с максимум 1024 знака). Имплементирайте get-ъри, set-ъри, копиращ конструктор, оператор= ### 2 задача - Голяма четворка -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise02.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise02.cpp} -Имплементирайте структура [`DynamicString`], която скрито запазва указател към низ (в динамичната памет) и неговия размер. +Имплементирайте структура {` DynamicString}, която скрито запазва указател към низ (в динамичната памет) и неговия размер. Имплементирайте голяма четворка. @@ -28,37 +31,37 @@ GitHub classroom: [url https://classroom.github.com/a/rzSTn5pu classroom.github. ### 3 задача -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise03.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise03.cpp} Имплементирайте програма, която отваря файл (създава го, ако вече не е създаден) и вкарва текста "Hello World!" във файла. Името на файла се подава от стандартния вход на един ред. ### 4 задача -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise04.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise04.cpp} Имплементирайте програма, която приема име на файл от стандартния вход. Изкарайте последния ред от файла. -Редовете са разделени със знака [`\\n`]. +Редовете са разделени със знака {` \\n}. ### 5 задача -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise05.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise05.cpp} Имплементирайте програма, която приема име на файл от стандартния вход. Изкарайте броя редове и броя думи във файла. ### 6 задача -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise06.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise06.cpp} От стандартния вход получавате, на два отделни реда, две имена на файлове. Вмъкнете съдържанието на втория файл по средата на първия файл. ### 7 задача -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise07.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise07.cpp} От стандартния вход получавате числата m и n, както и името на файл (на свой си ред). Изкарайте на екрана от m-тата до n-тата буква (включително) от всеки ред във файла. @@ -66,9 +69,9 @@ GitHub classroom: [url https://classroom.github.com/a/rzSTn5pu classroom.github. ### 8 задача -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise08.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise08.cpp} -Имплементирайте структура [`FileBuffer`], която в конструктора си приема име на файл, отваря го и запазва (копира) цялото му съдържание в динамичната памет (с указател член-данна). +Имплементирайте структура {` FileBuffer}, която в конструктора си приема име на файл, отваря го и запазва (копира) цялото му съдържание в динамичната памет (с указател член-данна). .question Кога трябва да затворим файла? @@ -76,29 +79,29 @@ GitHub classroom: [url https://classroom.github.com/a/rzSTn5pu classroom.github. ### 9 задача -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise09.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week06/Exercise09.cpp} -Имплементирайте структура [`Person`], която приема име на човек (низ с максимална дължина от 1024 знака) и неговата възраст (целочислена стойност). -Имплементирайте методи [`Save`] и [`Load`], които съответно запазват/прочитат данните в (двоичен) файл с подадено име. +Имплементирайте структура {` Person}, която приема име на човек (низ с максимална дължина от 1024 знака) и неговата възраст (целочислена стойност). +Имплементирайте методи {` Save} и {` Load}, които съответно запазват/прочитат данните в (двоичен) файл с подадено име. ## Трудни задачи ### 10 задача -Имплементирайте структура [`Table`], която запазва произволен брой колони и редове с низови стойности. +Имплементирайте структура {` Table}, която запазва произволен брой колони и редове с низови стойности. Броя редове/колони може да се уразмерява по време на изпълнение. Имплементирайте голяма четворка. -Имплементирайте методи [`AddRow`] и [`AddColumn`], които вмъкват подадените стойности като нов ред/колона на дадения индекс. -Аналогично имплементирайте методи [`RemoveRow`] и [`RemoveColumn`]. -[=Чрез всички тези=] имплементирайте метода [`ModifyValue`], който променя стойността на клетката на дадените индекси. +Имплементирайте методи {` AddRow} и {` AddColumn}, които вмъкват подадените стойности като нов ред/колона на дадения индекс. +Аналогично имплементирайте методи {` RemoveRow} и {` RemoveColumn}. +{b Чрез всички тези} имплементирайте метода {` ModifyValue}, който променя стойността на клетката на дадените индекси. -Имплементирайте методи [`Save`] и [`Load`], които запазват/зреждат таблицата в/от файл с подадено име, в текстовия CSV формат (всеки ред в таблицата е ред във файла, всички стойности в реда от таблицата са разделени със запетая в реда във файла). +Имплементирайте методи {` Save} и {` Load}, които запазват/зреждат таблицата в/от файл с подадено име, в текстовия CSV формат (всеки ред в таблицата е ред във файла, всички стойности в реда от таблицата са разделени със запетая в реда във файла). ### 11 задача -Имплементирайте структура [`City`], която запазва името на даден град (низ с максимална дължина от 1024 знака) и масив от указатели към други градове, които са негови съседи. -Имплементирайте методи [`AddNeighbour`] и [`RemoveNeighbour`] (броя съседи може да се променя), както и голяма четворка. +Имплементирайте структура {` City}, която запазва името на даден град (низ с максимална дължина от 1024 знака) и масив от указатели към други градове, които са негови съседи. +Имплементирайте методи {` AddNeighbour} и {` RemoveNeighbour} (броя съседи може да се променя), както и голяма четворка. -Имплементирайте методи [`Save`] и [`Load`], които запазват/зреждат всичките достижими градове от сегашния в/от (бинарен) файл с подадено име. +Имплементирайте методи {` Save} и {` Load}, които запазват/зреждат всичките достижими градове от сегашния в/от (бинарен) файл с подадено име. Подсказвам, че не можете да запазите указателите ей-така. diff --git a/src/teaching/oop-2023/week7/index.du b/src/teaching/oop-2023/week7/index.du index e3b1044..f64265a 100644 --- a/src/teaching/oop-2023/week7/index.du +++ b/src/teaching/oop-2023/week7/index.du @@ -1,23 +1,26 @@ -# Задачи - ООП, Седмица 7, 04.04.2024 +'def title Задачи - ООП, Седмица 7, 04.04.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/vvZENbkX classroom.github.com/a/vvZENbkX] +GitHub classroom: {url classroom.github.com/a/vvZENbkX;https://classroom.github.com/a/vvZENbkX} ## Преговорни ### Задача 1 - Голяма петица -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week07/Exercise1.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week07/Exercise1.cpp} Една съставка е композирана от низ (с максимална дължина от 511 знака) определящ името ѝ и грамаж (число с плаваща запетая). -Създайте клас [`Recipe`], към който могат да се прибавят и премахват произволен брой съставки. +Създайте клас {` Recipe}, към който могат да се прибавят и премахват произволен брой съставки. Имплементирайте голяма петица (голяма четворка плюс move семантики) за него. ### Задача 2 - Работа с файлове -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week07/Exercise2.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week07/Exercise2.cpp} От един ред на входа получавате името на текстови файл. Изкарайте на екрана средната една трета от файла, като буквите са в обратен ред. @@ -26,25 +29,25 @@ GitHub classroom: [url https://classroom.github.com/a/vvZENbkX classroom.github. ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week07/Exercise3.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week07/Exercise3.cpp} -Имплементирайте клас [`Thermometer`], който запазва максималната и минималната възможна температура за измерване, както и сегашната температура, всичките които са цели неотрицателни числа. +Имплементирайте клас {` Thermometer}, който запазва максималната и минималната възможна температура за измерване, както и сегашната температура, всичките които са цели неотрицателни числа. -Имплементирайте методи [`SaveText`] и [`LoadText`], които съответно записват и четат (тоест член-данните стават равни на тези от файла) данните си в/от [=текстови=] файл с подадено име. -Аналогично имплементирайте [`SaveBinary`] и [`LoadBinary`], които работят с [=двоични=] файлове. +Имплементирайте методи {` SaveText} и {` LoadText}, които съответно записват и четат (тоест член-данните стават равни на тези от файла) данните си в/от {b текстови} файл с подадено име. +Аналогично имплементирайте {` SaveBinary} и {` LoadBinary}, които работят с {b двоични} файлове. ### Задача 4 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week07/Exercise4.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week07/Exercise4.cpp} -Имплементирайте клас [`Street`], който запазва скрито името на улицата като низ с произволна дължина и номер като цяло число. +Имплементирайте клас {` Street}, който запазва скрито името на улицата като низ с произволна дължина и номер като цяло число. Имплементирайте голяма петица. -Имплементирайте методите [`SaveText`], [`LoadText`], [`SaveBinary`], [`LoadBinary`]. +Имплементирайте методите {` SaveText}, {` LoadText}, {` SaveBinary}, {` LoadBinary}. ### Задача 5 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week07/Exercise5.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week07/Exercise5.cpp} За един транспортен билет е нужно скрито да пазим началната и крайната дестинация като динамично-заделени низове с произволна дължина, неговата цена като число с плаваща запетая и идентификационен номер като цяло неотрицателно число. @@ -52,17 +55,17 @@ GitHub classroom: [url https://classroom.github.com/a/vvZENbkX classroom.github. ### Задача 6 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week07/Exercise6.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week07/Exercise6.cpp} -Имплементирайте клас [`Matrix`], който запазва стойностите на матрица 2 на 2. +Имплементирайте клас {` Matrix}, който запазва стойностите на матрица 2 на 2. Предефинирайте операторите за инкрементиране, декрементиране, събиране, изваждане, умножение и вход/изход от/към поток. Имплементирайте четирите функции за записване и четене от файлове. ### Задача 7 -Имплементирайте клас [`Paragraph`], който съдържа текст с много редове в него. -Текстът се запазва като низ с произволна дължина, а редовете се разделят със знака [`'\\n'`]. +Имплементирайте клас {` Paragraph}, който съдържа текст с много редове в него. +Текстът се запазва като низ с произволна дължина, а редовете се разделят със знака {` '\\n'}. Имплементирайте голяма петица. Имплементирайте четирите функции за записване и четене от файлове. @@ -73,7 +76,7 @@ GitHub classroom: [url https://classroom.github.com/a/vvZENbkX classroom.github. ### Задача 8 -Имплементирайте клас [`MatrixNМ`], който запазва стойностите на матрица с N реда и M колони (подадени на конструктор). +Имплементирайте клас {` MatrixNМ}, който запазва стойностите на матрица с N реда и M колони (подадени на конструктор). Имплементирайте голяма петица. Имплементирайте четирите функции за записване и четене от файлове. diff --git a/src/teaching/oop-2023/week8/index.du b/src/teaching/oop-2023/week8/index.du index 4e2270d..c8fc94f 100644 --- a/src/teaching/oop-2023/week8/index.du +++ b/src/teaching/oop-2023/week8/index.du @@ -1,43 +1,46 @@ -# Задачи - ООП, Седмица 8, 11.04.2024 +'def title Задачи - ООП, Седмица 8, 11.04.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/7d0MBjcK classroom.github.com/a/7d0MBjcK] +GitHub classroom: {url classroom.github.com/a/7d0MBjcK;https://classroom.github.com/a/7d0MBjcK} ## Преговорни ### Задача 1 - Голяма петица -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise1.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise1.cpp} -Имплементирайте клас [`StreetList`], който запазва имената на улици (низове с произволна дължина) в динамичен масив. +Имплементирайте клас {` StreetList}, който запазва имената на улици (низове с произволна дължина) в динамичен масив. Може да се добавят нови имена в края на списъка, като съответния (вътрешен) масив трябва да се уголеми. Имплементирайте голяма петица за класа. ### Задача 2 - Файлове и класове -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise2.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise2.cpp} -Имплементирайте клас [`Person`], който запазва трите имена (низове с произволна дължина) и идентификационния номер (цяло неотрицателно число) на човек. +Имплементирайте клас {` Person}, който запазва трите имена (низове с произволна дължина) и идентификационния номер (цяло неотрицателно число) на човек. Имплементирайте голяма петица. -Имплементирайте методи [`SaveText`] и [`LoadText`], които съответно записват и четат (тоест член-данните стават равни на тези от файла) данните си в/от [=текстови=] файл с подадено име. -Аналогично имплементирайте [`SaveBinary`] и [`LoadBinary`], които работят с [=двоични=] файлове. +Имплементирайте методи {` SaveText} и {` LoadText}, които съответно записват и четат (тоест член-данните стават равни на тези от файла) данните си в/от {b текстови} файл с подадено име. +Аналогично имплементирайте {` SaveBinary} и {` LoadBinary}, които работят с {b двоични} файлове. ## Лесни ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise3.hpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise3.hpp} -Имплементирайте шаблонната структура [`Pair`], която приема два типа и запазва по една стойност от всеки тип. +Имплементирайте шаблонната структура {` Pair}, която приема два типа и запазва по една стойност от всеки тип. ### Задача 4 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise4.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise4.cpp} -Имплементирайте клас [`FloatArray`], който съдържа списък с числа с плаваща запетая. +Имплементирайте клас {` FloatArray}, който съдържа списък с числа с плаваща запетая. Може да добавяте нови числа в края на този списък. Имплементирйате голяма петица. @@ -53,16 +56,16 @@ GitHub classroom: [url https://classroom.github.com/a/7d0MBjcK classroom.github. ### Задача 5 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise5.hpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise5.hpp} -Имплементирайте класът и неговите оператори от предходната задача като темплейтен (шаблонен) клас с име [`DynamicArray`]. +Имплементирайте класът и неговите оператори от предходната задача като темплейтен (шаблонен) клас с име {` DynamicArray}. Очевидно шаблонния тип определя типа на списъка с елементи. ### Задача 6 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise6.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise6.cpp} -Имплементирайте клас [`NumberInput`], който запазва целочислена стойност. +Имплементирайте клас {` NumberInput}, който запазва целочислена стойност. В конструктора се подава минимална и максимална възможна стойност, след това (все още в конструктора) се изкарва на екрана съответно съобщение и се приема потребителски вход. Ако той не е валиден или е извън подадения обхват, трябва да хвърлите грешка. @@ -72,26 +75,26 @@ GitHub classroom: [url https://classroom.github.com/a/7d0MBjcK classroom.github. ### Задача 7 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise7.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week08/Exercise7.cpp} -Имплементирайте клас [`UserError`], чиято употреба е да се хвърля като грешка. +Имплементирайте клас {` UserError}, чиято употреба е да се хвърля като грешка. За тази цел нека да запазва два низа, които се приемат в конструктора: името на клас и името на член-данната. Имплементирайте голяма петица и оператор<<, който изкарва съобщение с информация за класа и член-данната в подадения поток. -Следете бройката на създадени [`UserError`] инстанции в самия клас (статична променлива) и имплементирате нужната (статична) член-функция, която връща този брой. +Следете бройката на създадени {` UserError} инстанции в самия клас (статична променлива) и имплементирате нужната (статична) член-функция, която връща този брой. Преобразувайте последната задача, така че да хвърля грешка от този клас. -В края на програмата изкарайте колко грешки са се хвърлили [=използвайки статичните членове на UserError=]. +В края на програмата изкарайте колко грешки са се хвърлили {b използвайки статичните членове на UserError}. ## Трудни задачи ### Задача 8 -Имплементирайте шаблонен клас [`UserInput`], който запазва стойност от подадения тип. +Имплементирайте шаблонен клас {` UserInput}, който запазва стойност от подадения тип. Ако типа е указател, тогава заделяте динамична памет за един такъв елемент. -За проверка на типа използвайте [url https://en.cppreference.com/w/cpp/language/partial_specialization partial template specialization]. +За проверка на типа използвайте {url partial template specialization;https://en.cppreference.com/w/cpp/language/partial_specialization}. -В шаблона ([`template <...>`]) се приема указател към валидираща функция, която приема стойността от съответния тип и връща булева стойност. +В шаблона ({` template <...>}) се приема указател към валидираща функция, която приема стойността от съответния тип и връща булева стойност. В конструктора се приема от входа нужната стойност и ако стойността е неуспешно приета или валидиращата функция върне false, тогава хвърляте грешка. Ако типа е указател, не забравяйте да освободите паметта. @@ -101,7 +104,7 @@ GitHub classroom: [url https://classroom.github.com/a/7d0MBjcK classroom.github. .important В тази задача се изикват помощни класове, прочетете цялото условие преди имплементиране! -Имплементирайте шаблонен клас [`Dictionary`], който запазва два динамично-заделени масива: първия е със стойност от подадения тип, втория е с низове. +Имплементирайте шаблонен клас {` Dictionary}, който запазва два динамично-заделени масива: първия е със стойност от подадения тип, втория е с низове. Низовете ще се използват за индексиране, вместо числа. Разбира се, очаквайте да може да се уразмерява. Имплементирайте голяма петица. @@ -109,12 +112,12 @@ GitHub classroom: [url https://classroom.github.com/a/7d0MBjcK classroom.github. Имплементирайте оператор: :bulleted -- <<=, който вмъква всички стойности от десния [`Dictionary`] в левия +- <<=, който вмъква всички стойности от десния {` Dictionary} в левия - [], който приема низ и връща референция "към" стойността. Ако няма записана стойност на съответния индекс, тогава връщате референция в която може да се запише стойност. - [], който приема число, което се конвертира до низ и работи както предходния оператор - [], който приема низове (или числа), разделени със запетая и връща "масив" само с тези стойности -- delete, който приема стойност, върната от оператор[] и "премахва" съответната стойност от [`Dictionary`] +- delete, който приема стойност, върната от оператор[] и "премахва" съответната стойност от {` Dictionary} - префиксен++, префиксен+ и префиксен-, които ще се използват за итериране. .bulleted - ++ връща инкрементира индекса на сегашната стойност. @@ -124,14 +127,14 @@ GitHub classroom: [url https://classroom.github.com/a/7d0MBjcK classroom.github. - + връща референция към стойността на сегашния индекс - - връща сегашния (низов) индекс -- ->, такъв че можем да правим [`a->(&func1)->(&func2)`] и [`a->[&func3]->[&func4]`].\n +- ->, такъв че можем да правим {` a->(&func1)->(&func2)} и {` a->[&func3]->[&func4]}.\n Върху всяка двойка индекс-стойност се прилагат &func1 и &func2 (приемат индекс и стойност като параметри), които връщат нова стойност, заместваща сегашната.\n &func3, &func4 аналогично приемат индекс и стойност, но връщат нов индекс. В края на задачата трябва да можете да правите: -:code_c++ +````cpp int doubleUp(const char* index, int value) { return value * 2; } diff --git a/src/teaching/oop-2023/week9/index.du b/src/teaching/oop-2023/week9/index.du index ac7892b..ed125c6 100644 --- a/src/teaching/oop-2023/week9/index.du +++ b/src/teaching/oop-2023/week9/index.du @@ -1,37 +1,40 @@ -# Задачи - ООП, Седмица 9, 18.04.2024 +'def title Задачи - ООП, Седмица 9, 18.04.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -На днешното упражнение ще решаваме [url https://learn.fmi.uni-sofia.bg/mod/resource/view.php?id=311448 задачата от Контролно 1], затова задачите ще са в същия дух (макар и да не включват най-новия материал). +На днешното упражнение ще решаваме {url задачата от Контролно 1;https://learn.fmi.uni-sofia.bg/mod/resource/view.php?id=311448}, затова задачите ще са в същия дух (макар и да не включват най-новия материал). -Решението, което писахме по време на практикума, с някои разширения и коментари, може да намерите [url https://github.com/Syndamia/oop-2023-solutions/tree/main/week09/Exam1 тук]. +Решението, което писахме по време на практикума, с някои разширения и коментари, може да намерите {url тук;https://github.com/Syndamia/oop-2023-solutions/tree/main/week09/Exam1}. -GitHub classroom: [url https://classroom.github.com/a/wlL1oUg2 classroom.github.com/a/wlL1oUg2] +GitHub classroom: {url classroom.github.com/a/wlL1oUg2;https://classroom.github.com/a/wlL1oUg2} ## Преговорни ### Задача 1 - Голяма петица -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week09/Exercise1 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week09/Exercise1} Реализирайте клас Printer, който съдържа модел като низ с произволна дължина и брой принтирани страници като неотрицателно цяло число. Имплементирайте голяма петица. ### Задача 2 - Файлове и класове -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week09/Exercise2 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week09/Exercise2} Реализирайте клас Date, който съдържа номера на деня, месеца и годината в три отделни целочислени член-данни. -Имплементирайте член-методи [`storeText`], [`storeBinary`], които съответно запазват данните в текстов файл (във формата "YEAR MONTH DAY") и в двоичен файл с подадени имена. -Аналогично имплементирайте [`loadText`] и [`loadBinary`], които презаписват член-данните с тези от подадените (имена на) файлове. +Имплементирайте член-методи {` storeText}, {` storeBinary}, които съответно запазват данните в текстов файл (във формата "YEAR MONTH DAY") и в двоичен файл с подадени имена. +Аналогично имплементирайте {` loadText} и {` loadBinary}, които презаписват член-данните с тези от подадените (имена на) файлове. -В главната функция създайте 5 дати, запазете всяка в [=един и същ текстов файл=], след това прочетете датите в [=нови=] 5 променливи и изкарайте датите в обратен ред. +В главната функция създайте 5 дати, запазете всяка в {b един и същ текстов файл}, след това прочетете датите в {b нови} 5 променливи и изкарайте датите в обратен ред. ## Лесни ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2023-solutions/blob/main/week09/Exercise3 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2023-solutions/blob/main/week09/Exercise3} Реализирайте клас Train, който съдържа: .bulleted @@ -45,10 +48,10 @@ GitHub classroom: [url https://classroom.github.com/a/wlL1oUg2 classroom.github. Имплементирайте методите: .bulleted - от голямата петица -- [`TransferNextRegion`], който променя сегашната локация на следващата по ред в текстовия файл (чието име е подадено в конструктор). +- {` TransferNextRegion}, който променя сегашната локация на следващата по ред в текстовия файл (чието име е подадено в конструктор). Ако няма следващо по ред, тогава локацията да си остане същата и да се хвърли грешка. Ако се срещнат проблеми с файла, хвърлете грешка. -- [`SwitchRailLine`], който приема идентификационен номер на релсовата линия и име на текстов файл, и променя вътрешните стойности. +- {` SwitchRailLine}, който приема идентификационен номер на релсовата линия и име на текстов файл, и променя вътрешните стойности. Съответно локацията трябва да бъде първата в подадения файл. Ако се срещнат проблеми с файла, хвърлете грешка. @@ -59,19 +62,19 @@ GitHub classroom: [url https://classroom.github.com/a/wlL1oUg2 classroom.github. За този клас имплементирайте методите: .bulleted -- [`HaveCollided`], който приема индекс на два влака и връща дали са се блъснали. +- {` HaveCollided}, който приема индекс на два влака и връща дали са се блъснали. Това се случва ако в една и съща релсова линия и един и същи регион, когато регионът не е последния възможен. -- [`RunTrains`], който придвижва напред всички влакове, докато не стигнат финалната си възможна дестинация. +- {` RunTrains}, който придвижва напред всички влакове, докато не стигнат финалната си възможна дестинация. Влакове които са се ударили не се придвижват напред. Връщате броя ударили се влакове. Да се имплементира главна функция, в която приемате име на двоичен файл от потребителя. В този файл имате някакъв брой редици с идентификационен номер на релсова линия, брой локации върху съответната линия и всички локации като нормални низове, разделени с нови редове. -Допълнително в главната функция приемайте от потребителя влаковете, като имената на текстовите файлове се избират от програмата ([=НЕ=] от потребителя) според идентификационния номер на релсовата линия и информацията във файла с редиците. -[=Не може да променяте Train класа!=] +Допълнително в главната функция приемайте от потребителя влаковете, като имената на текстовите файлове се избират от програмата ({b НЕ} от потребителя) според идентификационния номер на релсовата линия и информацията във файла с редиците. +{b Не може да променяте Train класа!} -Последно в главната функция създайте обект от тип TrainNetwork и изкарайте резултата от [`RunTrains`] на екрана. +Последно в главната функция създайте обект от тип TrainNetwork и изкарайте резултата от {` RunTrains} на екрана. ## Трудни @@ -87,11 +90,11 @@ GitHub classroom: [url https://classroom.github.com/a/wlL1oUg2 classroom.github. Имплементирайте методи: .bulleted - от голямата петица -- [`AddPassenger`], който добавя нов човек на дадения индекс на седалка -- [`RemovePassenger`], който премахва човека от дадения индекс -- [`TotalHunger`], който връща общото количество гладност в колата -- [`StoreData`], който запазва всички данни от колата в [=двоичен=] файл с подадено име -- [`LoadData`], който презаписва всички данни с тези от подадения по име [=двоичен=] файл +- {` AddPassenger}, който добавя нов човек на дадения индекс на седалка +- {` RemovePassenger}, който премахва човека от дадения индекс +- {` TotalHunger}, който връща общото количество гладност в колата +- {` StoreData}, който запазва всички данни от колата в {b двоичен} файл с подадено име +- {` LoadData}, който презаписва всички данни с тези от подадения по име {b двоичен} файл Реализирайте клас DriveThrough, в който се запазват: .bulleted @@ -101,14 +104,14 @@ GitHub classroom: [url https://classroom.github.com/a/wlL1oUg2 classroom.github. Имплементирайте методи: .bulleted - от голяма петица -- [`QueueUp`], който приема кола и я вкарва в края на опашката. +- {` QueueUp}, който приема кола и я вкарва в края на опашката. Разбира се, масивът се уголемява ако е нужно. -- [`Serve`], който изпълнява поръчката на най-предната кола в опашката. +- {` Serve}, който изпълнява поръчката на най-предната кола в опашката. За единица глад, ресторанта може да сготви достатъчно храна (за да нахрани клиента с "единица" храна) за единици време между половината от дължината на името на ресторанта и три пъти дължината на името на ресторанта време.\n Максималното възможно количество време за изпълнение на поръчката варира и според броя коли в опашка: ако са под 6 на брой, тогава тогава се увеличава с 10%, а ако са над 10 тогава се намалява с по 5% за всяка кола след десетата. -- [`EfficiencyService`], който изпълнява поръчките на всички коли в опашката и връща средно колко време е отнело на поръчка. -- [`StoreData`], който запазва всички данни в [=текстов=] файл с подадено име -- [`LoadData`], който презаписва всички данни с тези от подадения по име [=текстов=] файл +- {` EfficiencyService}, който изпълнява поръчките на всички коли в опашката и връща средно колко време е отнело на поръчка. +- {` StoreData}, който запазва всички данни в {b текстов} файл с подадено име +- {` LoadData}, който презаписва всички данни с тези от подадения по име {b текстов} файл Имплементирайте главна функция, в която от потребителския вход приемате име на текстов файл. -Създайте обект от тип DriveThrough, който да запълни своите стойности с тези от подадения файл и изкарайте на екрана стойността от [`EfficiencyService`]. +Създайте обект от тип DriveThrough, който да запълни своите стойности с тези от подадения файл и изкарайте на екрана стойността от {` EfficiencyService}. diff --git a/src/teaching/oop-2025/index.du b/src/teaching/oop-2025/index.du index 6ca7131..5933359 100644 --- a/src/teaching/oop-2025/index.du +++ b/src/teaching/oop-2025/index.du @@ -1,21 +1,25 @@ -# Обектно-ориентирано програмиране - практикум, Компютърни науки, 5 група +'def title Обектно-ориентирано програмиране - практикум, Компютърни науки, 5 група +'def desc Материали на проведените през 2025/2026 практикуми по Обектно-ориентирано програмиране на Компютърни науки (2 поток), 5 група. + +# {title} Материали на проведените през 2025/2026 практикуми по Увод в програмирането на Компютърни науки (2 поток), 5 група. -[=Зала:=] ФМИ 309 [$dbarsep] -[=Време:=] 10:00 - 12:00 [$dbarsep] -[=Ден:=] Сряда +{b Зала:} ФМИ 309 {dbarsep} +{b Време:} 10:00 - 12:00 {dbarsep} +{b Ден:} Сряда -[=Директни връзки:=] -[url ../upp-2025/week01/introduction.html?a#section-3 Контакт с мен] -| [url https://github.com/Syndamia/oop-2025-solutions Решения на задачи] -| [url https://github.com/18ivan18/ObjectOrientedProgramming2026 Материали от семинари] -| [url https://learn.fmi.uni-sofia.bg/course/view.php?id=12155 Курс в мудъл] +{b Директни връзки:} +{url Контакт с мен;../upp-2025/week01/introduction.html?a#section-3} +| {url Решения на задачи;https://github.com/Syndamia/oop-2025-solutions} +| {url Материали от семинари;https://github.com/18ivan18/ObjectOrientedProgramming2026} +| {url Курс в мудъл;https://learn.fmi.uni-sofia.bg/course/view.php?id=12155} -[=Допълнителни ресурси:=] -[url ./oop-notes Бележки по ООП при C++] +{b Допълнителни ресурси:} +{url Бележки по ООП при C++;./oop-notes} -:table_3 +:table +:3 |= № |= Дата |= Материали @@ -27,13 +31,13 @@ |: |: |: -[url ./week01/intro.html?a Уводни бележки] +{url Уводни бележки;./week01/intro.html?a} |: |: |: -[url ./week01 Задачи] -|| [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week01 Решения] +{url Задачи;./week01} +|| {url Решения;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week01} |: 2 |: 25.02.2026 @@ -42,8 +46,8 @@ |: |: |: -[url ./week02 Задачи] -|| [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02 Решения] +{url Задачи;./week02} +|| {url Решения;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02} |: 3 |: 04.03.2026 @@ -52,8 +56,8 @@ |: |: |: -[url ./week03 Задачи] -|| [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week03 Решения] +{url Задачи;./week03} +|| {url Решения;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week03} |: 4 |: 11.03.2026 @@ -62,8 +66,8 @@ |: |: |: -[url ./week04 Задачи] -|| [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week04 Решения] +{url Задачи;./week04} +|| {url Решения;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week04} |: 5 |: 18.03.2026 @@ -72,8 +76,8 @@ |: |: |: -[url ./week05 Задачи] -|| [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week05 Решения] +{url Задачи;./week05} +|| {url Решения;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week05} |: 6 |: 25.03.2026 @@ -82,8 +86,8 @@ |: |: |: -[url ./week06 Задачи] -|| [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06 Решения] +{url Задачи;./week06} +|| {url Решения;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06} |: 7 |: 01.04.2026 @@ -92,8 +96,8 @@ |: |: |: -[url ./week07 Задачи] -|| [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week07 Решения] +{url Задачи;./week07} +|| {url Решения;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week07} |: 8 |: 08.04.2026 @@ -102,8 +106,8 @@ |: |: |: -[url ./week08 Задачи] -|| [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week08 Решения] +{url Задачи;./week08} +|| {url Решения;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week08} |: 9 |: 15.04.2026 @@ -112,8 +116,8 @@ |: |: |: -[url ./week09 Задачи] -|| [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week09 Решения] +{url Задачи;./week09} +|| {url Решения;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week09} |: 10 |: 22.04.2026 @@ -122,8 +126,8 @@ |: |: |: -[url ./week10 Задачи] -|| [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week10 Решения] +{url Задачи;./week10} +|| {url Решения;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week10} |: 11 |: 29.04.2026 @@ -132,8 +136,8 @@ |: |: |: -[url ./week11 Задачи] -|| [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11 Решения] +{url Задачи;./week11} +|| {url Решения;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11} |: 12 |: 13.05.2026 @@ -142,7 +146,7 @@ |: |: |: -[url ./week12 Задачи] +{url Задачи;./week12} |: 13 |: 20.05.2026 @@ -151,7 +155,7 @@ |: |: |: -[url ./week13 Задачи] +{url Задачи;./week13} |: 14 |: 27.05.2026 @@ -160,7 +164,7 @@ |: |: |: -[url ./week14 Задачи] +{url Задачи;./week14} |: 15 |: 03.06.2026 @@ -169,4 +173,4 @@ |: |: |: -[url ./week15 Задачи] +{url Задачи;./week15} diff --git a/src/teaching/oop-2025/oop-notes/index.du b/src/teaching/oop-2025/oop-notes/index.du index c3641fa..4b11a5d 100644 --- a/src/teaching/oop-2025/oop-notes/index.du +++ b/src/teaching/oop-2025/oop-notes/index.du @@ -1,48 +1,48 @@ -# Бележки по ООП при C++ - ООП, КН, 2025-2026 +'def title Бележки по ООП при C++ - ООП, КН, 2025-2026 +'def desc Полезна информация и детайли относно обектно-ориентираното програмиране при C++ -'define expected-reading 2 min -'define created 18 March 2026 -'define edited 18 March 2026 -[$pagenav] +# {title} + +{pagenav 2 min;18 March 2026;18 March 2026} Този документ съдържа редица полезна информация и детайли относно обектно-ориентираното програмиране при C++. ## Голяма петица формат -```c++ -'include ./RuleOfFive.cpp +```cpp +'snippet 1 $ ./RuleOfFive.cpp -## [`&&A`], rvalue и rvalue reference +## {` &&A}, rvalue и rvalue reference -[`lvalue`] е всяка стойност, която има "име". +{` lvalue} е всяка стойност, която има "име". Това са аргументи на функции, променливи, ... -[`rvalue`] е всяка стойност за която нямаме "име". +{` rvalue} е всяка стойност за която нямаме "име". Най-често срещаните са върнатите стойноти от функция/оператор. -Тези стойности са временни и идеята е че ще бъдат изтрити (и на практика, данните им ще бъдат копирани/пренесени в нещо с име, [`lvalue`]). +Тези стойности са временни и идеята е че ще бъдат изтрити (и на практика, данните им ще бъдат копирани/пренесени в нещо с име, {` lvalue}). -Можем да правим референции върху [`rvalue`]: -```c++ +Можем да правим референции върху {` rvalue}: +```cpp A&& rvalueRef = functionWhichReturnsA(); -Обаче, тези референции дават (временно) име към [`rvalue`]-то. -Това означава, че те самите стават [`lvalue`]. +Обаче, тези референции дават (временно) име към {` rvalue}-то. +Това означава, че те самите стават {` lvalue}. -Поради тази прична не можем да имаме повече от една [`rvalue`] референция към едно [`rvalue`]: -```c++ +Поради тази прична не можем да имаме повече от една {` rvalue} референция към едно {` rvalue}: +```cpp A&& ref1 = functionWhichReturnsA(); A&& ref2 = ref1; // Грешка! -И не можем да подаваме аргумент [`rvalue`] на друга функция: -```c++ +И не можем да подаваме аргумент {` rvalue} на друга функция: +```cpp void foo(A&& ref1) { - ... + \... } void bar(A&& ref2) { foo(ref2); // Грешка! } \n\n -[*Съпътстващи ресурси:*] +{i Съпътстващи ресурси:} .bulleted -- [url https://web.archive.org/web/20200627194253/https://thbecker.net/articles/rvalue_references/section_05.html https://thbecker.net/articles/rvalue_references/section_05.html] +- {url https://thbecker.net/articles/rvalue_references/section_05.html;https://web.archive.org/web/20200627194253/https://thbecker.net/articles/rvalue_references/section_05.html} diff --git a/src/teaching/oop-2025/week01/index.du b/src/teaching/oop-2025/week01/index.du index 8279b83..10d9b08 100644 --- a/src/teaching/oop-2025/week01/index.du +++ b/src/teaching/oop-2025/week01/index.du @@ -1,23 +1,23 @@ -# Задачи - ООП, Седмица 1, 18.02.2026 +'def title Задачи - ООП, Седмица 1, 18.02.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 2 min -'define created 17 February 2026 -'define edited 22 February 2026 -[$pagenav] +# {title} -.warn Както винаги, [=НЕ=] може да използвате външни библиотеки и (почти) всичко от стандартната библиотека! +{pagenav 2 min;17 February 2026;22 February 2026} -.important [*(22.02.2026)*] По-подробни условия, оправени някои грешки в условията. +.warn Както винаги, {b НЕ} може да използвате външни библиотеки и (почти) всичко от стандартната библиотека! + +.important {i (22.02.2026)} По-подробни условия, оправени някои грешки в условията. ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week01/Exercise01 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week01/Exercise01} Реализирайте следните функции: -```c++ +```cpp // Създава нова динамично-заделена матрица int** newMatrix(unsigned rows, unsigned cols); // Изтрива динамично-заделена матрица @@ -25,13 +25,14 @@ void deleteMatrix(int**& matrix, unsigned rows); // Запишете nullptr в // Връща сумата на всички елементи в матрицата int sumMatrix(const int** matrix, unsigned rows, unsigned cols); -Поставете техните имплементации във файл [`matrix.cpp`] и техните дефиниции в [`matrix.h`]. -Естествено, главната функция [=трябва да се намира извън [`matrix.cpp`]!=] +Поставете техните имплементации във файл {` matrix.cpp} и техните дефиниции в {` matrix.h}. +Естествено, главната функция {b трябва да се намира извън {` matrix.cpp}!} От входа получавате размерите и стойностите на две матрици с цели числа. Изкарайте разликата, между сумата на елементите на първата матрица и на втората матрица. -:table_2 +:table +:2 |= Вход |= Изход @@ -52,13 +53,14 @@ int sumMatrix(const int** matrix, unsigned rows, unsigned cols); .comment 45 - 163 = -118 + ### Задача 2 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week01/Exercise02 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week01/Exercise02} Реализирайте следните функции: -```c++ +```cpp // Сума на стойностите в elements int sum(const int* elements, unsigned length); // Средно аритметично на стойностите в elements @@ -70,17 +72,18 @@ int smallest(const int* elements, unsigned length); // Връща индекса на първото срещане на elementToSearch unsigned findIndex(const int* elements, unsigned length, int elementToSearch); -Поставете техните имплементации в [`arrmath.cpp`] и техните дефиниции в [`arrmath.h`]. +Поставете техните имплементации в {` arrmath.cpp} и техните дефиниции в {` arrmath.h}. Направете всички нужни проверки за коректност на аргументите на функциите! -От входа получавате цяло неотрицателно число [`N`] и след това [`N`] на брой цели числа. +От входа получавате цяло неотрицателно число {` N} и след това {` N} на брой цели числа. -Трябва да изкарате средното аритметично на всички елементи [*между*] най-малкия и най-големия (включително). +Трябва да изкарате средното аритметично на всички елементи {i между} най-малкия и най-големия (включително). Ако най-големия и/или най-малкия се среща повече от един път, използвайте неговото първо срещане. -Използвайте максимално функциите от [`arrmath`]! +Използвайте максимално функциите от {` arrmath}! -:table_2 +:table +:2 |= Вход |= Изход @@ -94,13 +97,14 @@ unsigned findIndex(const int* elements, unsigned length, int elementToSearch); |: 2.8 + ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week01/Exercise03 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week01/Exercise03} -Реализирайте следните функции във файлове [`stringHelpers.cpp`] и [`stringHelpers.h`]: +Реализирайте следните функции във файлове {` stringHelpers.cpp} и {` stringHelpers.h}: -```c++ +```cpp // Създава динамично-заделен низ по подадената дължина char* newString(unsigned length); // Създава динамично-заделен низ, копие на подадения низ @@ -111,9 +115,9 @@ char* concatStrings(const char* first, const char* second, const char* separator // Освобождава паметта на динамичо-заделен низ void deleteString(char*& string); // Запишете nullptr в string! -Реализирайте следните функции във файлове [`ioHelpers.cpp`] и [`ioHelpers.h`]: +Реализирайте следните функции във файлове {` ioHelpers.cpp} и {` ioHelpers.h}: -```c++ +```cpp // Прочита от потребителския вход цяло число между min и max включително, // като предоставя prompt преди въведената стойност // При невалидна стойност, пита пак за вход @@ -127,44 +131,44 @@ double readDouble(const char* prompt, double min, double max); // При невалидна стойност, пита пак за вход char* readString(const char* prompt); -За реализацията им използвайте [`stringHelpers`]! +За реализацията им използвайте {` stringHelpers}! Реализирате система за запазване на ученици. -Всеки ученик има две имена и оценка (по шестобалната система, между [`2.0`] и [`6.0`]). +Всеки ученик има две имена и оценка (по шестобалната система, между {` 2.0} и {` 6.0}). -Използвайки [`ioHelpers`], поискайте от потребителя брой ученици. +Използвайки {` ioHelpers}, поискайте от потребителя брой ученици. След това, за всеки ученик, поискайте неговото име, фамилия и оценка (поотделно). -За всеки ученик запазаете името му като един низ във формата [`"<ИМЕ> <ФАМИЛИЯ>"`]. +За всеки ученик запазаете името му като един низ във формата {` "<ИМЕ> <ФАМИЛИЯ>"}. Не запазвайте име и фамилия като отделни стойности! Накрая изкарайте данните за всички ученици. -[=Смесен вход/изход:=] [*(удебеления текст е изкаран от програмата, останалото е въведено от потребителя)*] +{b Смесен вход/изход:} {i (удебеления текст е изкаран от програмата, останалото е въведено от потребителя)} ``` -[=Number of students:=] 4 -[=First name:=] Ivan -[=Last name:=] Koprivan -[=Grade:=] 5.5 -[=First name:=] Dimitar -[=Last name:=] Stoianov -[=Grade:=] 3.15 -[=First name:=] Hari -[=Last name:=] Seldon -[=Grade:=] 6 -[=First name:=] Richard -[=Last name:=] Stallman -[=Grade:=] 4.53 -[=Ivan Koprivan has grade 5.5=] -[=Dimitar Stoianov has grade 3.15=] -[=Hari Seldon has grade 6=] -[=Richard Stallman has grade 4.53=] +{b Number of students:} 4 +{b First name:} Ivan +{b Last name:} Koprivan +{b Grade:} 5.5 +{b First name:} Dimitar +{b Last name:} Stoianov +{b Grade:} 3.15 +{b First name:} Hari +{b Last name:} Seldon +{b Grade:} 6 +{b First name:} Richard +{b Last name:} Stallman +{b Grade:} 4.53 +{b Ivan Koprivan has grade 5.5} +{b Dimitar Stoianov has grade 3.15} +{b Hari Seldon has grade 6} +{b Richard Stallman has grade 4.53} ## За самоподготовка -Пререшете следните задачи от УП [=без да гледате решенията=]: +Пререшете следните задачи от УП {b без да гледате решенията}: .bulleted -- [url ../../upp-2025/week13/#-21 Седмица 13, Задача 21] -- [url ../../upp-2025/week10/#-7 Седмица 10, Задача 7] -- [url ../../upp-2025/week12/#-6 Седмица 12, Задача 6] +- {url Седмица 13, Задача 21;../../upp-2025/week13/#-21} +- {url Седмица 10, Задача 7;../../upp-2025/week10/#-7} +- {url Седмица 12, Задача 6;../../upp-2025/week12/#-6} diff --git a/src/teaching/oop-2025/week01/intro.du b/src/teaching/oop-2025/week01/intro.du index 474ffb2..4b3bc6c 100644 --- a/src/teaching/oop-2025/week01/intro.du +++ b/src/teaching/oop-2025/week01/intro.du @@ -1,11 +1,11 @@ -# Уводни бележки - ООП, Седмица 1, 18.02.2026 +'def title Уводни бележки - ООП, Седмица 1, 18.02.2026 +'def desc Бележки относно практикума и курса. -'define expected-reading 1 min -'define created 17 February 2026 -'define edited 17 February 2026 -[$pagenav] +# {title} -[$presentation-controller] +{pagenav 1 min;17 February 2026;17 February 2026} + +{presentation-controller} :title_slide35 @@ -16,11 +16,11 @@ ## Уроци от УП -[$br2] +{br2} :unordered -- [=Решавайте задачи!=] +- {b Решавайте задачи!} .unordered - По УП са давани >200 задачи (да, много не бяха доизпипани) - Решения ca качвани на >150 задачи @@ -34,7 +34,7 @@ ## Относно ООП практикум -[$br3] +{br3} :unordered @@ -42,7 +42,7 @@ .unordered - Дори да не го направите, пак си идвайте -- Ще го караме по същата схема: задачи и [=решаваме=] на живо +- Ще го караме по същата схема: задачи и {b решаваме} на живо .unordered - Ако искате друго, слушам, ще го обсъдим @@ -52,13 +52,13 @@ ## Специфики на ООП в C++ -[$br1] +{br1} :unordered -- ООП не е безплатно! Дори да сте учили [`Java`]/[`C#`]/... +- ООП не е безплатно! Дори да сте учили {` Java}/{` C#}/... -- [`C++`] има много рядко-срещани обектни свойства, като: +- {` C++} има много рядко-срещани обектни свойства, като: :ordered @@ -66,7 +66,7 @@ 2. Множествено наследяване - наследяване на повече от един клас - 3. Шаблони - значително по-силни от generics ([url https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern статичен полиморфизъм], [url https://en.wikipedia.org/wiki/Template_metaprogramming#Compile-time_class_generation compile-time рекурсия], ...) + 3. Шаблони - значително по-силни от generics ({url статичен полиморфизъм;https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern}, {url compile-time рекурсия;https://en.wikipedia.org/wiki/Template_metaprogramming#Compile-time_class_generation}, ...) diff --git a/src/teaching/oop-2025/week02/index.du b/src/teaching/oop-2025/week02/index.du index f33a2fc..5b4d35f 100644 --- a/src/teaching/oop-2025/week02/index.du +++ b/src/teaching/oop-2025/week02/index.du @@ -1,25 +1,26 @@ -# Задачи - ООП, Седмица 2, 25.02.2026 +'def title Задачи - ООП, Седмица 2, 25.02.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 7 min -'define created 24 February 2026 -'define edited 28 February 2026 -[$pagenav] +# {title} + +{pagenav 7 min;24 February 2026;28 February 2026} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02/Exercise01 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02/Exercise01} -Реализирайте структура [`Date`], която съдържа целочислени, неотрицателни полета за ден, месец и година. +Реализирайте структура {` Date}, която съдържа целочислени, неотрицателни полета за ден, месец и година. -Реализирайте функция [`printDate`], която приема обект от тип [`Date`] и изкарва датата във формат "<ДЕН>/<МЕСЕЦ>/<ГОДИНА>", където "<МЕСЕЦ>" е краткото име на месеца (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec). +Реализирайте функция {` printDate}, която приема обект от тип {` Date} и изкарва датата във формат "<ДЕН>/<МЕСЕЦ>/<ГОДИНА>", където "<МЕСЕЦ>" е краткото име на месеца (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec). -Реализирайте функция [`readDate`], която приема от входа три целочислени числа (ден, месец, година), създава обект от тип [`Date`] и връща неговата стойност. +Реализирайте функция {` readDate}, която приема от входа три целочислени числа (ден, месец, година), създава обект от тип {` Date} и връща неговата стойност. -Използвайки [`printDate`] и [`readDate`], прочетете от входа 3 дати и изкарайте всяка от тях. +Използвайки {` printDate} и {` readDate}, прочетете от входа 3 дати и изкарайте всяка от тях. -:table_2 +:table +:2 |= Вход |= Изход @@ -27,22 +28,24 @@ |: 1/Jan/2000 30/Aug/3105 13/Jun/1909 + ### Задача 2 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02/Exercise02 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02/Exercise02} -Реализирайте структура [`Temperature`], която съхранява температура по Целзии, Келвин и Фаренхайт (числа с плаваща запетая). +Реализирайте структура {` Temperature}, която съхранява температура по Целзии, Келвин и Фаренхайт (числа с плаваща запетая). -Реализирайте член-функции [`fromCelsius`], [`fromKelvin`] и [`fromFahrenheit`], където всяка обновява трите температури спрямо подадената температура. -Припомняме, че [`°F = (°C * 1.8) + 32`] и [`°K = °C + 273.15`]. +Реализирайте член-функции {` fromCelsius}, {` fromKelvin} и {` fromFahrenheit}, където всяка обновява трите температури спрямо подадената температура. +Припомняме, че {` °F = (°C * 1.8) + 32} и {` °K = °C + 273.15}. -Реализирайте член-функция [`Sum`], която приема втори обект от тип [`Temperature`] и връща обект от тип [`Temperature`], който е сумата на температурите по целзии (и съответната стойност във Фаренхайт и Келвин) на текущия и подадения обект. +Реализирайте член-функция {` Sum}, която приема втори обект от тип {` Temperature} и връща обект от тип {` Temperature}, който е сумата на температурите по целзии (и съответната стойност във Фаренхайт и Келвин) на текущия и подадения обект. -От входа получавате число с плаваща запетая (температура) и след това буква, обозначаваща типа на температурата - [`K`], [`C`] или [`F`]. +От входа получавате число с плаваща запетая (температура) и след това буква, обозначаваща типа на температурата - {` K}, {` C} или {` F}. След това получавате втора такава двойка стойности. -Изкарайте сумата на двете температури (чрез [`Sum`]) във всички температурни формати. +Изкарайте сумата на двете температури (чрез {` Sum}) във всички температурни формати. -:table_2 +:table +:2 |= Вход |= Изход @@ -53,27 +56,29 @@ |: −73.15 C -99.67 F 200 K + ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02/Exercise03 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02/Exercise03} -Реализирайте структура [`IntArray`], която съдържа целочислен неотрицателен размер на масив и указател към динамично-заделен масив от цели числа. +Реализирайте структура {` IntArray}, която съдържа целочислен неотрицателен размер на масив и указател към динамично-заделен масив от цели числа. Реализирайте: .bulleted -- функция [`newIntArray`], която инициализира обект от типа [`IntArray`] по подаден размер. -- член-функция [`deleteSelf`], която освобождава паметта на масива и занулява размера. -- функция [`deleteIntArray`], която използва [`deleteSelf`], за да "деинициализира" обекта. -- член-функция [`sum`], която връща сумата на всички елементи в масива. +- функция {` newIntArray}, която инициализира обект от типа {` IntArray} по подаден размер. +- член-функция {` deleteSelf}, която освобождава паметта на масива и занулява размера. +- функция {` deleteIntArray}, която използва {` deleteSelf}, за да "деинициализира" обекта. +- член-функция {` sum}, която връща сумата на всички елементи в масива. От входа получавате размер на масив от цели числа и след това толкова на брой цели числа. Изкарайте средното аритметично на елементите в масива. Възползвайте се максимално от реализираните функции! -.important [*(28.02.2026)*] Оправени примери +.important {i (28.02.2026)} Оправени примери -:table_2 +:table +:2 |= Вход |= Изход @@ -87,11 +92,12 @@ |: 5.5 + ### Задача 4 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02/Exercise04 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02/Exercise04} -Реализирайте структура [`Product`], която съдържа целочислено неотрицателно ID, низово име и целочислена неотрицателна бройка стока. +Реализирайте структура {` Product}, която съдържа целочислено неотрицателно ID, низово име и целочислена неотрицателна бройка стока. От входа получавате бройка продукти. След това, за всеки продукт, ще получите ID и (едноредово) име. @@ -99,7 +105,7 @@ Накрая трябва да изкарате, за всеки продукт, неговото име и бройка. -[=Смесен вход/изход:=] [*(удебеления текст е изкаран от програмата, останалото е въведено от потребителя)*] +{b Смесен вход/изход:} {i (удебеления текст е изкаран от програмата, останалото е въведено от потребителя)} ``` 4 92 Apple @@ -110,30 +116,31 @@ 92 49 77 10 20 34 -[=Apple: 49=] -[=Whole Wheat Bread: 34=] -[=Apricot: 30=] -[=Natural Honey: 10=] +{b Apple: 49} +{b Whole Wheat Bread: 34} +{b Apricot: 30} +{b Natural Honey: 10} ### Задача 5 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02/Exercise05 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02/Exercise05} -Реализирайте структура [`Package`] (пакет), която съдържа 10-буквен идентификационен код и число с плаваща запетая - тежест. -Реализирайте функция, която по подаден идентификационен код и тежест от стандартния вход, връща обект от типа [`Package`]. +Реализирайте структура {` Package} (пакет), която съдържа 10-буквен идентификационен код и число с плаваща запетая - тежест. +Реализирайте функция, която по подаден идентификационен код и тежест от стандартния вход, връща обект от типа {` Package}. -Реализирайте структура [`Warehouse`] (склад), която има еднобуквен идентификатор, динамично-заделен масив с [`Package`] обекти, бройка съхранени пакети и капацитет. +Реализирайте структура {` Warehouse} (склад), която има еднобуквен идентификатор, динамично-заделен масив с {` Package} обекти, бройка съхранени пакети и капацитет. -Реализирайте член-функция [`storePackage`], която запазва подадения пакет в текущия склад, ако има място. -Нека функцията да връща [`bool`]: [`true`] ако пакета е успешно съхранен, [`false`] иначе. +Реализирайте член-функция {` storePackage}, която запазва подадения пакет в текущия склад, ако има място. +Нека функцията да връща {` bool}: {` true} ако пакета е успешно съхранен, {` false} иначе. От входа получавате бройка складове и след това, за всеки склад, неговото еднобуквено име и капацитет. След това получавате бройка пакети и за всеки пакет, неговия идентификационен код, тежест и склад в който трябва да се добави. Накрая изкарайте, за всеки склад, неговия еднобуквен идентификатор, колко пакети са съхранени (от максималния капацитет) и след това идентификационните кодове на всички съхранени пакети. -:table_2 +:table +:2 |= Вход |= Изход @@ -162,61 +169,62 @@ KLI18M8401 F 0/20 + ## За самоподготовка ### Задача 6 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02/Exercise06 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week02/Exercise06} -Реализирайте структура [`Time`], която съхранява целочислени неотрицателни час, минути и секунди. +Реализирайте структура {` Time}, която съхранява целочислени неотрицателни час, минути и секунди. -Реализирайте функция, която по подаден брой милисекунди от 00:00:00 часа създава обект от тип [`Time`], който съхранява съответното време. +Реализирайте функция, която по подаден брой милисекунди от 00:00:00 часа създава обект от тип {` Time}, който съхранява съответното време. Припомняме, че 1000 милисекунди са равни на 1 секунда. Закръгляйте времето надолу (тоест 999 милисекунди да съответстват на 00:00:00 часа, 1000 милисекунди на 00:00:01). -Реализирайте член-функция [`Advance`] на [`Time`], която приема обект от тип [`Time`] и добавя към текущия обект времето от подадения обект. +Реализирайте член-функция {` Advance} на {` Time}, която приема обект от тип {` Time} и добавя към текущия обект времето от подадения обект. ### Задача 7 -Реализирайте структура [`IntMatrix`], която съдържа указател към динамично-заделена матрица от числа с плаваща запетая и нейните размери. +Реализирайте структура {` IntMatrix}, която съдържа указател към динамично-заделена матрица от числа с плаваща запетая и нейните размери. -Реализирайте член-функция [`Multiply`], която приема (друга) [`IntMatrix`], прави умоножение на двете матрици (ред по стълб) и връща резултатната матрица. +Реализирайте член-функция {` Multiply}, която приема (друга) {` IntMatrix}, прави умоножение на двете матрици (ред по стълб) и връща резултатната матрица. Ако това умножение не е възможно, да върне занулена матрица (нулеви размери, нулев указател). ### Задача 8 -Реализирайте структура [`BankAccount`], която съдържа целочислен неотрицателен идентификационен код (ID) и число с плаваща запетая - баланс на сметката. +Реализирайте структура {` BankAccount}, която съдържа целочислен неотрицателен идентификационен код (ID) и число с плаваща запетая - баланс на сметката. -Към структурата реализирайте член-функции [`Withdraw`] и [`Deposit`], които съответно позволяват потребител да изтегли и депозира количество пари към сметката си. +Към структурата реализирайте член-функции {` Withdraw} и {` Deposit}, които съответно позволяват потребител да изтегли и депозира количество пари към сметката си. Имплементирайте нужните проверки (не се изтегля повече отколкото е налично, не се депозира отрицателно количество сума, так. нат.). От входа получавате буква, спрямо която трябва да се извърши някакво действие: .bulleted -- [`c`] - създава акаунт с някакво ID (програмата го избира) и нулев баланс. +- {` c} - създава акаунт с някакво ID (програмата го избира) и нулев баланс. Изкарва се на екрана ID-то на акаунта. -- [`w`] - изтегляне на сума от банкова сметка. +- {` w} - изтегляне на сума от банкова сметка. Трябва допълнително да се въведат ID и сума за теглене. При грешни стойности, да се изкара съобщение за грешка и да не се продължи с действието. -- [`d`] - депозиране на сума в банкова сметка. +- {` d} - депозиране на сума в банкова сметка. Трябва допълнително да се въведат ID и сума за теглене. При грешни стойности, да се изкара съобщение за грешка и да не се продължи с действието. -[=Смесен вход/изход:=] [*(удебеления текст е изкаран от програмата, останалото е въведено от потребителя)*] +{b Смесен вход/изход:} {i (удебеления текст е изкаран от програмата, останалото е въведено от потребителя)} ``` c -[=100=] +{b 100} d 100 500 c -[=101=] +{b 101} d 100 13.5 w 101 0.2 -[=Error: withdraw amount is larger than account balance=] +{b Error: withdraw amount is larger than account balance} w 101 -0.2 -[=Error: cannot withdraw a negative amount=] +{b Error: cannot withdraw a negative amount} d 100 -2 -[=Error: cannot deposit a negative amount=] +{b Error: cannot deposit a negative amount} diff --git a/src/teaching/oop-2025/week03/index.du b/src/teaching/oop-2025/week03/index.du index 2686623..7c0006b 100644 --- a/src/teaching/oop-2025/week03/index.du +++ b/src/teaching/oop-2025/week03/index.du @@ -1,15 +1,15 @@ -# Задачи - ООП, Седмица 3, 04.03.2026 +'def title Задачи - ООП, Седмица 3, 04.03.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 4 min -'define created 03 March 2026 -'define edited 03 March 2026 -[$pagenav] +# {title} + +{pagenav 4 min;03 March 2026;03 March 2026} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week03/Exercise01 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week03/Exercise01} Реализирайте система за онлайн магазин. Трябва да имате потребители, администратори и продукти. @@ -17,7 +17,7 @@ Всеки потребител (и администратор) си има потребителско име и парола. Чрез вход и изход, трябва да може потребител да се регистрира, да влезе в акаунта си и да "купи" продукти. -Администраторски акаунти, [=допълнително=], могат да променят дали акаунти са администраторски и да добавят продукти. +Администраторски акаунти, {b допълнително}, могат да променят дали акаунти са администраторски и да добавят продукти. Всеки продукт си има име, бройка и цена. Имената и пароли на потребители, както и имена на продукти не съдържат шпации. @@ -27,115 +27,115 @@ От входа първо се получава буква, която обозначава команда/действие в платформата. Когато няма "логнат" потребител, имаме следните команди налични: .bulleted -- [`l`] - влизане в потребителски акаунт, поискват се потребителско име и парола. +- {` l} - влизане в потребителски акаунт, поискват се потребителско име и парола. Ако не съвпадат на някой регистриран потребител, изкарва се съответното съобщение и процеса се анулира -- [`r`] - регистриране на потребител, поискват се потребителско име и парола. +- {` r} - регистриране на потребител, поискват се потребителско име и парола. Ако потребителско имеа се повтаря с този на вече регистриран потребител, изкарва се съответното съобщение -- [`p`] - изкарване на всички продукти и техните цени. +- {` p} - изкарване на всички продукти и техните цени. Ако няма въведени продукти, тогава да се изкара съответното съобщение. Когато потребител влезе в акаунта си, има достъп към следните команди: .bulleted -- [`p`] - изкарване на всички продукти и техните цени. +- {` p} - изкарване на всички продукти и техните цени. Ако няма въведени продукти, тогава да се изкара съответното съобщение. -- [`e`] - излизане от акаунта си -- [`b`] - купуване на продукти, първо потребителя казва колко (различни) продукта ще си купи и след това въвежда за всеки продукт, неговото име и бройка. +- {` e} - излизане от акаунта си +- {` b} - купуване на продукти, първо потребителя казва колко (различни) продукта ще си купи и след това въвежда за всеки продукт, неговото име и бройка. Ако името е грешно или няма достатъчно количество, изкарва се съответното съобщение и процеса се анулира. При успешно купуване се изкарва общата цена на продуктите и тяхната обща бройка е намалена. Когато администратор влезе в акаунта си, той има всички команди които и нормалния потребител има, заедно с: .bulleted -- [`a`] - променя дали потребител е администратор (прави администратор на нормален или нормален на администратор) -- [`s`] - въвежда име на продукт, бройка и цена. +- {` a} - променя дали потребител е администратор (прави администратор на нормален или нормален на администратор) +- {` s} - въвежда име на продукт, бройка и цена. Ако продукта не съществува, тогава го създава. Ако съществува (със същото име), тогава го обновява: бройката се добавя към текущата и ценята се заменя. -[=Смесен вход/изход:=] [*(удебеления текст е въведен от потребителя, останалото е изкарано от програмата)*] +{b Смесен вход/изход:} {i (удебеления текст е въведен от потребителя, останалото е изкарано от програмата)} ``` -[=r=] -Username: [=gg=] -Password: [=ez=] +{b r} +Username: {b gg} +Password: {b ez} Successfully registered user 'gg'! -[=l=] -Username: [=gogo=] +{b l} +Username: {b gogo} User 'gogo' does not exist! -[=l=] -Username: [=gg=] -Password: [=pie=] +{b l} +Username: {b gg} +Password: {b pie} Incorrect password! -[=l=] -Username: [=gg=] -Password: [=ez=] +{b l} +Username: {b gg} +Password: {b ez} Successful login! -[=p=] +{b p} No products! -[=s=] +{b s} No permissions! -[=e=] +{b e} Logged out! -[=l=] -Username: [=admin=] -Password: [=admin=] +{b l} +Username: {b admin} +Password: {b admin} Successful login! -[=s=] -Name: [=Apple=] -Quantity: [=50=] -Price: [=0.5=] -[=s=] -Name: [=Bread=] -Quantity: [=20=] -Price: [=1.15=] -[=s=] -Name: [=Apple=] -Quantity: [=10=] -Price: [=0.5=] -[=s=] -Name: [=Bread=] -Quantity: [=0=] -Price: [=2=] -[=p=] +{b s} +Name: {b Apple} +Quantity: {b 50} +Price: {b 0.5} +{b s} +Name: {b Bread} +Quantity: {b 20} +Price: {b 1.15} +{b s} +Name: {b Apple} +Quantity: {b 10} +Price: {b 0.5} +{b s} +Name: {b Bread} +Quantity: {b 0} +Price: {b 2} +{b p} Apple 60 0.5 Bread 20 2 -[=b=] -Number of products: [=2=] -Name: [=Apple=] -Quantity: [=100=] +{b b} +Number of products: {b 2} +Name: {b Apple} +Quantity: {b 100} Invalid quantity! -[=b=] -Number of products: [=3=] +{b b} +Number of products: {b 3} Invalid number of products! -[=b=] -Number of products: [=2=] -Name: [=Apple=] -Quantity: [=5=] -Name: [=Bread=] -Quantity: [=1=] +{b b} +Number of products: {b 2} +Name: {b Apple} +Quantity: {b 5} +Name: {b Bread} +Quantity: {b 1} Purchase successful! Total cost: 4.5 -[=p=] +{b p} Apple 55 0.5 Bread 19 2 -[=a=] -Username: [=gogo=] +{b a} +Username: {b gogo} User 'gogo' does not exist! -[=a=] -Username: [=gg=] +{b a} +Username: {b gg} Made user 'gg' into an administrator. -[=e=] +{b e} Logged out! -[=l=] -Username: [=gg=] -Password: [=ez=] +{b l} +Username: {b gg} +Password: {b ez} Successful login! -[=s=] -Name: [=Apple=] -Quantity: [=0=] -Price: [=0.75=] -[=b=] -Number of products: [=1=] -Name: [=Apple=] -Quantity: [=3=] +{b s} +Name: {b Apple} +Quantity: {b 0} +Price: {b 0.75} +{b b} +Number of products: {b 1} +Name: {b Apple} +Quantity: {b 3} Purchase successful! Total cost: 2.25 -[=p=] +{b p} Apple 52 0.75 Bread 19 2 @@ -154,102 +154,102 @@ Bread 19 2 От входа първо се получава буква, която обозначава команда/действие в платформата. Когато няма "логнат" потребител, имаме следните команди налични: .bulleted -- [`l`] - влизане в потребителски акаунт, поискват се потребителско име и парола. +- {` l} - влизане в потребителски акаунт, поискват се потребителско име и парола. Ако не съвпадат на някой регистриран потребител, изкарва се съответното съобщение и процеса се анулира -- [`r`] - регистриране на потребител, поискват се потребителско име и парола. +- {` r} - регистриране на потребител, поискват се потребителско име и парола. Ако потребителско имеа се повтаря с този на вече регистриран потребител, изкарва се съответното съобщение Когато потребител влезе в акаунта си, има достъп към следните команди: .bulleted -- [`e`] - излизане от акаунта -- [`u`] - изреждане на имената на всички регистрирани потребители (включително себе си) -- [`m`] - изпращане на съобщение, поискват се име на потребител и след това самото съобщение -- [`i`] - изкарване на съобщения, изпратени към текущо влезли потребител. +- {` e} - излизане от акаунта +- {` u} - изреждане на имената на всички регистрирани потребители (включително себе си) +- {` m} - изпращане на съобщение, поискват се име на потребител и след това самото съобщение +- {` i} - изкарване на съобщения, изпратени към текущо влезли потребител. Поисква се бройка и след това се изкарват последните толкова на брой съобщения, които са изпратени към нас. Ако се поискат повече съобщения отколкото има, тогава се изкарват всичките. -- [`h`] - изкарва се разговора между нас и даден потребител. +- {` h} - изкарва се разговора между нас и даден потребител. Поисква се име на потребител и след това се изкарват съобщенията които той е изпратил и които ние сме изпратили, в коректен ред. -[=Смесен вход/изход:=] [*(удебеления текст е въведен от потребителя, останалото е изкарано от програмата)*] +{b Смесен вход/изход:} {i (удебеления текст е въведен от потребителя, останалото е изкарано от програмата)} ``` -[=r=] -Username: [=barry=] -Password: [=1234=] +{b r} +Username: {b barry} +Password: {b 1234} Successfully registered user 'barry'! -[=r=] -Username: [=map=] -Password: [=1234=] +{b r} +Username: {b map} +Password: {b 1234} Successfully registered user 'map'! -[=r=] -Username: [=joe=] -Password: [=1234=] +{b r} +Username: {b joe} +Password: {b 1234} Successfully registered user 'joe'! -[=l=] -Username: [=map=] -Password: [=1234=] +{b l} +Username: {b map} +Password: {b 1234} Successful login! -[=u=] +{b u} barry map joe -[=m=] -Username: [=dd=] +{b m} +Username: {b dd} User 'dd' does not exist! -[=m=] -Username: [=barry=] -Message: [=Hello barry!=] -[=m=] -Username: [=barry=] -Message: [=How are you?=] -[=e=] +{b m} +Username: {b barry} +Message: {b Hello barry!} +{b m} +Username: {b barry} +Message: {b How are you?} +{b e} Logged out! -[=l=] -Username: [=joe=] -Password: [=1234=] +{b l} +Username: {b joe} +Password: {b 1234} Successful login! -[=m=] -Username: [=barry=] -Message: [=Are you there?=] -[=e=] +{b m} +Username: {b barry} +Message: {b Are you there?} +{b e} Logged out! -[=l=] -Username: [=barry=] -Password: [=1234=] +{b l} +Username: {b barry} +Password: {b 1234} Successful login! -[=m=] -Username: [=map=] -Message: [=I'm fine=] -[=i=] -Number of messages: [=10=] +{b m} +Username: {b map} +Message: {b I'm fine} +{b i} +Number of messages: {b 10} map: Hello barry! map: How are you? joe: Are you there? -[=e=] +{b e} Logged out! -[=l=] -Username: [=map=] -Password: [=1234=] +{b l} +Username: {b map} +Password: {b 1234} Successful login! -[=m=] -Username: [=barry=] -Message: [=Good to hear!=] -[=e=] +{b m} +Username: {b barry} +Message: {b Good to hear!} +{b e} Logged out! -[=l=] -Username: [=barry=] -Password: [=1234=] +{b l} +Username: {b barry} +Password: {b 1234} Successful login! -[=h=] -Username: [=map=] +{b h} +Username: {b map} map: Hello barry! map: How are you? barry: I'm fine map: Good to hear! -[=m=] -Username: [=barry=] -Message: [=Note to self: do not talk to map=] -[=i=] -Number of messages: [=3=] +{b m} +Username: {b barry} +Message: {b Note to self: do not talk to map} +{b i} +Number of messages: {b 3} joe: Are you there? map: Good to hear! barry: Note to self: do not talk to map diff --git a/src/teaching/oop-2025/week04/index.du b/src/teaching/oop-2025/week04/index.du index 67f083e..5c7e7f5 100644 --- a/src/teaching/oop-2025/week04/index.du +++ b/src/teaching/oop-2025/week04/index.du @@ -1,65 +1,65 @@ -# Задачи - ООП, Седмица 4, 11.03.2026 +'def title Задачи - ООП, Седмица 4, 11.03.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 3 min -'define created 11 March 2026 -'define edited 11 March 2026 -[$pagenav] +# {title} -.warn За всеки клас имплементирайте [=голяма четворка!=] +{pagenav 3 min;11 March 2026;11 March 2026} + +.warn За всеки клас имплементирайте {b голяма четворка!} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week04/Exercise01 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week04/Exercise01} -Реализирайте клас [`Train`], който съдържа брой вагони, брой места за пътници, брой приети пътници, брой спирки които е минал, брой спирки които му остават, цена на билет и печалба от билети. +Реализирайте клас {` Train}, който съдържа брой вагони, брой места за пътници, брой приети пътници, брой спирки които е минал, брой спирки които му остават, цена на билет и печалба от билети. -Реализирайте селектори на всички тези параметри, конструктор с подадени стойности и публична член-функция [`ArriveAtStation`], която приема брой слизащи пътници и брой качващи се пътници. -Освен това реализирайте публична член-функция [`Print`], която изкарва всички стойности на класа. +Реализирайте селектори на всички тези параметри, конструктор с подадени стойности и публична член-функция {` ArriveAtStation}, която приема брой слизащи пътници и брой качващи се пътници. +Освен това реализирайте публична член-функция {` Print}, която изкарва всички стойности на класа. ### Задача 2 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week04/Exercise02 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week04/Exercise02} -Реализирайте клас [`IntArray`], който съдържа указател към масив от [`int`] елементи и капацитет. +Реализирайте клас {` IntArray}, който съдържа указател към масив от {` int} елементи и капацитет. Реализирайте публични член-функции: .unordered -- [`At`] която връща стойността по подаден индекс, -- [`Resize`] която променя размера на масива по подаден такъв. -- [`Concat`] която приема [`IntArray`] обект и слепява всички негови елементи след тези в текущия +- {` At} която връща стойността по подаден индекс, +- {` Resize} която променя размера на масива по подаден такъв. +- {` Concat} която приема {` IntArray} обект и слепява всички негови елементи след тези в текущия ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week04/Exercise03 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week04/Exercise03} -Реализирайте клас [`String`], който съдържа низ [`char*`] и размер. +Реализирайте клас {` String}, който съдържа низ {` char*} и размер. Напомняме, че низа пак трябва да завършва на терминираща нула! Реализирайте конструктори: .unordered -- по подразбиране, в който се запазва низа [`""`] -- приемащ [`const char*`] -- приемащ [`String`] +- по подразбиране, в който се запазва низа {` ""} +- приемащ {` const char*} +- приемащ {` String} Реализирайте публични член-функции: .unordered -- селектор [`GetLength`], който връща размера на низа -- константен селектор [`GetStr`], който връща константен указател към низа -- [`Substring`] който връща нов [`String`] обект със съдържание, което е под-низ по подадените индекси -- [`Concat`] който връща нов [`String`] обект със съдържание, което е слепения (конкатениран) низ между текущия и подадения [`String`] +- селектор {` GetLength}, който връща размера на низа +- константен селектор {` GetStr}, който връща константен указател към низа +- {` Substring} който връща нов {` String} обект със съдържание, което е под-низ по подадените индекси +- {` Concat} който връща нов {` String} обект със съдържание, което е слепения (конкатениран) низ между текущия и подадения {` String} ### Задача 4 -Реализирайте клас [`Matrix`], който съдържа матрица от реални числа и нейния размер. +Реализирайте клас {` Matrix}, който съдържа матрица от реални числа и нейния размер. Реализирайте конструктор, който приема размери и масив и попълва матрицата от ляво на дясно, от горе на долу. Реализирайте член-функции: .unordered -- [`InsertRow`], която приема индекс и масив от реални числа и вмъква елементите като нов ред в матрицата -- [`InsertCol`], което приема индекс и масив от реални числа и вмъква елементите като нова колона в матрицата -- [`Sum`], която приема втора матрица и връща [`Matrix`] обект, който е сумата на текущата и подадената матрица -- [`Multiply`], която приема втора матрица и връща [`Matrix`] обект, който е умножението на текущата и подадената матрица (ред по стълб) -- [`Transpose`], която връща [`Matrix`] обект, който е транспонираната матрица на текущата +- {` InsertRow}, която приема индекс и масив от реални числа и вмъква елементите като нов ред в матрицата +- {` InsertCol}, което приема индекс и масив от реални числа и вмъква елементите като нова колона в матрицата +- {` Sum}, която приема втора матрица и връща {` Matrix} обект, който е сумата на текущата и подадената матрица +- {` Multiply}, която приема втора матрица и връща {` Matrix} обект, който е умножението на текущата и подадената матрица (ред по стълб) +- {` Transpose}, която връща {` Matrix} обект, който е транспонираната матрица на текущата diff --git a/src/teaching/oop-2025/week05/index.du b/src/teaching/oop-2025/week05/index.du index 0469fe4..e7de9e3 100644 --- a/src/teaching/oop-2025/week05/index.du +++ b/src/teaching/oop-2025/week05/index.du @@ -1,116 +1,116 @@ -# Задачи - ООП, Седмица 5, 18.03.2026 +'def title Задачи - ООП, Седмица 5, 18.03.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 6 min -'define created 18 March 2026 -'define edited 18 March 2026 -[$pagenav] +# {title} -.warn За всеки клас имплементирайте [=голяма петица!=] Това включва "move" семантики! +{pagenav 6 min;18 March 2026;18 March 2026} + +.warn За всеки клас имплементирайте {b голяма петица!} Това включва "move" семантики! ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week05/Exercise01 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week05/Exercise01} -Реализирайте клас [`NumSeries`], който съхранява динамично-заделен масив от числа с плаваща запетая, техния размер и индекса на последния елемент. +Реализирайте клас {` NumSeries}, който съхранява динамично-заделен масив от числа с плаваща запетая, техния размер и индекса на последния елемент. -Класа трябва да има публични методи, [=достъпни и за константни обекти=]: +Класа трябва да има публични методи, {b достъпни и за константни обекти}: .unordered -- [`Push`], който слага подадения елемент на последната позиция. +- {` Push}, който слага подадения елемент на последната позиция. Това е единствения начин да се добавят елементи. Ако цялата заделена памет е запълнена, масива да се уголеми. -- [`At`], който по подаден индекс връща елемент. - Да има проверка дали индекса е валиден (дали елемент на този индекс е бил [`Push`]-нат). - При невалиден индекс върнете [url https://en.cppreference.com/w/cpp/numeric/math/NAN.html NaN]. -- [`Length`], който връща броя [`Push`]-нати елементи +- {` At}, който по подаден индекс връща елемент. + Да има проверка дали индекса е валиден (дали елемент на този индекс е бил {` Push}-нат). + При невалиден индекс върнете {url NaN;https://en.cppreference.com/w/cpp/numeric/math/NAN.html}. +- {` Length}, който връща броя {` Push}-нати елементи ### Задача 2 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week05/Exercise02 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week05/Exercise02} -Реализирайте клас [`String`], който съхранява динамично-заделен низ. +Реализирайте клас {` String}, който съхранява динамично-заделен низ. -Допълнително, реализирайте конструктор, приемащ [`const char*`] и публичи методи, [=достъпни за константни обекти=] (когато смислено): +Допълнително, реализирайте конструктор, приемащ {` const char*} и публичи методи, {b достъпни за константни обекти} (когато смислено): .unordered -- [`Substring`], който връща нов низ, който е под-низ на текущия. +- {` Substring}, който връща нов низ, който е под-низ на текущия. Като аргументи приема начален индекс и дължина. -- [`Concat`], който приема низ и го "слепва" в края на текущия низ. +- {` Concat}, който приема низ и го "слепва" в края на текущия низ. -Реализирайте клас [`Text`], който съхранява динамично-заделена последователност от редове текст ([`String`]-ове). -Реализирайте публични методи, [=достъпни за константни обекти=] (когато смислено): +Реализирайте клас {` Text}, който съхранява динамично-заделена последователност от редове текст ({` String}-ове). +Реализирайте публични методи, {b достъпни за константни обекти} (когато смислено): .unordered -- [`LineCount`], който връща броя редове в текста -- [`WordCount`], който връща броя думи в текста. +- {` LineCount}, който връща броя редове в текста +- {` WordCount}, който връща броя думи в текста. Дума за нашите цели е всяка последователност от букви, която не съдържа шпация. -- [`SubText`], който по подадени начален и краен ред, и начална и крайна колона, връща [`Text`], съдържащ само тези (части от) низове +- {` SubText}, който по подадени начален и краен ред, и начална и крайна колона, връща {` Text}, съдържащ само тези (части от) низове ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week05/Exercise03 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week05/Exercise03} -Реализирайте клас [`Person`], който съхранява трите имена, телефонен номер, имейл, година на раждане и ЕГН (personal number) на човек. -Препоръчително е да използвате [`String`] клас, подобен на този от предходната задача ([=но имплементиран от Вас=]). +Реализирайте клас {` Person}, който съхранява трите имена, телефонен номер, имейл, година на раждане и ЕГН (personal number) на човек. +Препоръчително е да използвате {` String} клас, подобен на този от предходната задача ({b но имплементиран от Вас}). Реализирайте конструктор, който приема тези данни. -Реализирайте клас [`TaxReport`], който съхранява ЕГН, година, сума приходи и процент данък от приходите. +Реализирайте клас {` TaxReport}, който съхранява ЕГН, година, сума приходи и процент данък от приходите. Реализирайте конструктор, който приема тези данни. -Реализирайте клас [`TaxDatabase`], който съхранява динамичо-заделени количества от [`Person`] и [`TaxReport`] обекти. -Реализирайте публични методи, [=достъпни за константни обекти=] (когато смислено): +Реализирайте клас {` TaxDatabase}, който съхранява динамичо-заделени количества от {` Person} и {` TaxReport} обекти. +Реализирайте публични методи, {b достъпни за константни обекти} (когато смислено): .unordered -- [`RegisterPerson`], който добавя човек. - Нека да връща [`bool`], дали успешно е добавен човек. +- {` RegisterPerson}, който добавя човек. + Нека да връща {` bool}, дали успешно е добавен човек. ЕГН-тата, имейлите и телефонните номера трябва да са различни между всички потребители. Количеството хора е неограничено, вътрешната памет трябва да се реоразмерява. -- [`LogTagReport`], който добавя данъчна декларация. - Нека да връща [`bool`], дали е успешно добавена. +- {` LogTagReport}, който добавя данъчна декларация. + Нека да връща {` bool}, дали е успешно добавена. Всяка декларация се различава по комбинацията от ЕГН и година. Количеството декларации е неограничено, вътрешната памет трябва да се реоразмерява. -- [`PersonalReports`], който по подадено ЕГН изкарва на екрана всички данни за човека и всички данни за всички негови данъчни декларации -- [`YearlyReports`], който по подадена година изкарва на екрана всички данъчни декларации през подадената година. +- {` PersonalReports}, който по подадено ЕГН изкарва на екрана всички данни за човека и всички данни за всички негови данъчни декларации +- {` YearlyReports}, който по подадена година изкарва на екрана всички данъчни декларации през подадената година. За всяка декларация изкарайте вместо ЕГН, първото име, фамилия и възраст на съответния човек. -- [`YearlyAvgIncome`], който по подадена година връща средния приход на всички потребители -- [`YearlyTaxedIncome`], който по подадена година връща общия приход от данъци на всички потребители -- [`GetReport`], който по подадено ЕГН и година връща съответната декларация -- [`GetReportByAge`], който по подадено ЕГН и възраст връща съответната декларация -- [`GetReports`], който по подадено ЕГН, начална година и крайна година връща [*последователност*] от данъчни декларации. +- {` YearlyAvgIncome}, който по подадена година връща средния приход на всички потребители +- {` YearlyTaxedIncome}, който по подадена година връща общия приход от данъци на всички потребители +- {` GetReport}, който по подадено ЕГН и година връща съответната декларация +- {` GetReportByAge}, който по подадено ЕГН и възраст връща съответната декларация +- {` GetReports}, който по подадено ЕГН, начална година и крайна година връща {i последователност} от данъчни декларации. Ще е нужно да имплементирате помощен клас. -- [`GetReportsByAge`], който по подадено ЕГН, начална възраст и крайна възраст връща [*последователност*] от данъчни декларации +- {` GetReportsByAge}, който по подадено ЕГН, начална възраст и крайна възраст връща {i последователност} от данъчни декларации ## За самоподготовка ### Задача 4 -Реализирайте клас [`User`], който съхранява ЕГН, имейл и парола на потребител. +Реализирайте клас {` User}, който съхранява ЕГН, имейл и парола на потребител. Реализирайте конструктор с всички тези параметри. -Реализирайте клас [`BankAccount`], който съхранява [`AccountId`] и последователност от транзакции. +Реализирайте клас {` BankAccount}, който съхранява {` AccountId} и последователност от транзакции. Всяка транзакция съдържа промяна по баланса (положително число за вложена сума и отрицателна за изтеглена) и дата (ден, месец, година, час, минути, секунди). Реализирайте нужните помощни класове/структури. -Реализирайте публични методи, [=достъпни за константни обекти=] (когато смислено): +Реализирайте публични методи, {b достъпни за константни обекти} (когато смислено): .unordered -- [`Balance`], който връща текущия баланс в акаунта -- [`Balance`], който по подадена дата и час връща баланса към този момент от времето -- [`AddTransaction`], който добавя транзакция към акаунта +- {` Balance}, който връща текущия баланс в акаунта +- {` Balance}, който по подадена дата и час връща баланса към този момент от времето +- {` AddTransaction}, който добавя транзакция към акаунта -Реализирайте структура [`UserBankAccount`], която съхранява ЕГН и [`AccountId`]. +Реализирайте структура {` UserBankAccount}, която съхранява ЕГН и {` AccountId}. -Реализирайте клас [`BankingSystem`], който съхранява последователности от [`User`]-и, [`BankAccount`]-и и [`UserBankAccount`]-и. -[`UserBankAccount`]-ите свързват [`User`]-ите и [`BankAccount`]-ите. +Реализирайте клас {` BankingSystem}, който съхранява последователности от {` User}-и, {` BankAccount}-и и {` UserBankAccount}-и. +{` UserBankAccount}-ите свързват {` User}-ите и {` BankAccount}-ите. -Реализирайте публични методи, [=достъпни за константни обекти=] (когато смислено): +Реализирайте публични методи, {b достъпни за константни обекти} (когато смислено): .unordered -- [`RegisterBankAccount`], който по подадени данни добавя потребител и неговия [`BankAccount`] (сметка). +- {` RegisterBankAccount}, който по подадени данни добавя потребител и неговия {` BankAccount} (сметка). Ако се подаде нов потребител, неговите данни да се запазят. - Ако потребителя вече е записан, единствено да се запише новия [`BankAccount`] (и връзката му с потребителя; един потребител може да има много сметки). -- [`RegisterTransaction`], която по подадено ЕГН, [`AccountId`], сума и време запазва съответната транзакция в акаунта на потребителя -- [`TotalBalance`], която по подадено ЕГН връща общия баланс на всички сметки на потребителя -- [`NegativeBalances`], която по подадено ЕГН и време връща броя сметки, които са имали отрицателен общ баланс към подаденото време -- [`CanBeDeleted`], която по подадено ЕГН връща последователност от [`AccountId`]-та на сметки, които имат баланс 0 (и следователно могат да бъдат изтрити). + Ако потребителя вече е записан, единствено да се запише новия {` BankAccount} (и връзката му с потребителя; един потребител може да има много сметки). +- {` RegisterTransaction}, която по подадено ЕГН, {` AccountId}, сума и време запазва съответната транзакция в акаунта на потребителя +- {` TotalBalance}, която по подадено ЕГН връща общия баланс на всички сметки на потребителя +- {` NegativeBalances}, която по подадено ЕГН и време връща броя сметки, които са имали отрицателен общ баланс към подаденото време +- {` CanBeDeleted}, която по подадено ЕГН връща последователност от {` AccountId}-та на сметки, които имат баланс 0 (и следователно могат да бъдат изтрити). Ще е нужно да имплементирате помощен клас. -- [`SuspiciousAccounts`], която връща всички имейли и [`AccountId`]-та на сметки, които изглеждат съмнителни. +- {` SuspiciousAccounts}, която връща всички имейли и {` AccountId}-та на сметки, които изглеждат съмнителни. Съмнителни са тези сметки, чиито най-скорошни 20 транзакции са се случили за по-малко от минута. Може да е нужно да разширите имплементацията на някой клас. -- [`Debtors`], която връща първо име, фамилия и имейл на всички на всички потребители, чиито сметки имат отрицателен баланс. +- {` Debtors}, която връща първо име, фамилия и имейл на всички на всички потребители, чиито сметки имат отрицателен баланс. Ще е нужно да имплементирате помощен клас. diff --git a/src/teaching/oop-2025/week06/index.du b/src/teaching/oop-2025/week06/index.du index e3cb3b3..01fcbc3 100644 --- a/src/teaching/oop-2025/week06/index.du +++ b/src/teaching/oop-2025/week06/index.du @@ -1,41 +1,41 @@ -# Задачи - ООП, Седмица 6, 25.03.2026 +'def title Задачи - ООП, Седмица 6, 25.03.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 3 min -'define created 24 March 2026 -'define edited 24 March 2026 -[$pagenav] +# {title} + +{pagenav 3 min;24 March 2026;24 March 2026} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise01.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise01.cpp} -Реализирайте програма, която създава [=текстов=] файл "HelloWorld.txt" и записва в него низа [`Hello World!`]. +Реализирайте програма, която създава {b текстов} файл "HelloWorld.txt" и записва в него низа {` Hello World!}. Уверете се че файла се създава и това е неговото съдържание. ### Задача 2 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise02.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise02.cpp} -От входа получавате име на [=текстов=] файл. +От входа получавате име на {b текстов} файл. След това трябва да принтирате съдържанието на този файл. ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise03.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise03.cpp} Реализирайте програма, която приема на първия ред име на файл и след това текст. -Този текст може да е на няколко реда, като [=няма ограничение в дължината на редовете=]! -Знака [`@`] обозначава край на входния текст (и съответно, край на програмата). +Този текст може да е на няколко реда, като {b няма ограничение в дължината на редовете}! +Знака {` @} обозначава край на входния текст (и съответно, край на програмата). -Трябва като резултат да е създаден [=текстов=] файл с подаденото име и съдържание. +Трябва като резултат да е създаден {b текстов} файл с подаденото име и съдържание. ### Задача 4 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise04.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise04.cpp} -От входа получавате име на [=текстов=] файл. +От входа получавате име на {b текстов} файл. Трябва да изкарате всички редове във файла, в обратен ред (последния ред става първи, пред-последния втори и так. нат.). .important @@ -43,60 +43,62 @@ ### Задача 5 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise05.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise05.cpp} От входа получавате на един ред име на файл. -След това неотрицателно цяло число [`N`] и накрая [`N`] на брой 64-битови числа с плаваща запетая. +След това неотрицателно цяло число {` N} и накрая {` N} на брой 64-битови числа с плаваща запетая. -Трябва да запазите всички тези числа в [=двоичен=] файл с подаденото име. +Трябва да запазите всички тези числа в {b двоичен} файл с подаденото име. .question -Каква е разликата между [`<<`] и [`write`]? +Каква е разликата между {` <<} и {` write}? Кое е по-удачно тук? ### Задача 6 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise06.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise06.cpp} -От входа получавате на един ред име на [=двоичен=] файл. +От входа получавате на един ред име на {b двоичен} файл. Този файл съдържа 64-битови числа с плаваща запетая. Изкарайте на екрана всички числа от файла. Изтеглете следните файлове и проверете дали вашата програма изкарва коректен изход: -.table_2 +.table +.2 |= Файл |= Изход -|: [url ./simple.dat simple.dat] +|: {url simple.dat;./simple.dat} |: 1.1 2.2 3.3 4.4 5.5 -|: [url ./empty.dat empty.dat] -|: [*нищо, файла е празен*] -|: [url ./constants.dat constants.dat] +|: {url empty.dat;./empty.dat} +|: {i нищо, файла е празен} +|: {url constants.dat;./constants.dat} |: 2.71828 3.14159 1.61803 0.57721 ### Задача 7 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise07.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise07.cpp} -Реализирайте структура [`Smartphone`], която съдържа цяло 16-битово число за номер на версията на операционната система, неотрицателно 64-битово число за сериен номер, 32-битово число с плаваща запетая за [url https://www.gsmarena.com/glossary.php3?term=sar SAR] и буква за ревизия на хардуера, [=в този ред=]. +Реализирайте структура {` Smartphone}, която съдържа цяло 16-битово число за номер на версията на операционната система, неотрицателно 64-битово число за сериен номер, 32-битово число с плаваща запетая за {url SAR;https://www.gsmarena.com/glossary.php3?term=sar} и буква за ревизия на хардуера, {b в този ред}. -От входа получавате неотрицателно цяло число [`N`] и след това данни за [`N`] на брой смартфона. -Трябва да запишете всички тези стойности в [=двоичен=] файл. +От входа получавате неотрицателно цяло число {` N} и след това данни за {` N} на брой смартфона. +Трябва да запишете всички тези стойности в {b двоичен} файл. ### Задача 8 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise08.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week06/Exercise08.cpp} -Реализирайте структура [`Smartphone`] със същите полета като в предходната задача. +Реализирайте структура {` Smartphone} със същите полета като в предходната задача. -От входа получавате на един ред името на [=двоичен=] файл. +От входа получавате на един ред името на {b двоичен} файл. Трябва да изкарате на екрана (стойностите на) всички смартофони във файла. Изтеглете следните файлове и проверете дали вашата програма изкарва коректен изход: -.table_2 +.table +.2 |= Файл |= Изход -|: [url ./galaxyS26Ultra.dat galaxyS26Ultra.dat] +|: {url galaxyS26Ultra.dat;./galaxyS26Ultra.dat} |: 16 83001852 1.09 B -|: [url ./oneplus15.dat oneplus15.dat] +|: {url oneplus15.dat;./oneplus15.dat} |: 16 55929 1.17 A\n16 95200 1.17 T\n16 110999 1.08 R diff --git a/src/teaching/oop-2025/week07/index.du b/src/teaching/oop-2025/week07/index.du index 86fc97b..3314b0c 100644 --- a/src/teaching/oop-2025/week07/index.du +++ b/src/teaching/oop-2025/week07/index.du @@ -1,17 +1,17 @@ -# Задачи - ООП, Седмица 7, 01.04.2026 +'def title Задачи - ООП, Седмица 7, 01.04.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 4 min -'define created 01 April 2026 -'define edited 01 April 2026 -[$pagenav] +# {title} -.warn За всеки клас имплементирайте [=голяма петица!=] +{pagenav 4 min;01 April 2026;01 April 2026} + +.warn За всеки клас имплементирайте {b голяма петица!} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week07/Exercise01 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week07/Exercise01} Реализирайте система за менажиране на онлайн книги. @@ -21,9 +21,9 @@ - библиотекари, които могат да добавят и махат книги, както и да променят цената им - банкови служители, които одобряват или отказват транзакции -[=Книгите=] имат заглавие, автор, година на издаване, (многоредово) текстово съдържание и цена. +{b Книгите} имат заглавие, автор, година на издаване, (многоредово) текстово съдържание и цена. -[=Потребителите=] имат имейл и парола с които влизат, своя библиотека от книги които могат да достъпват и номер на банкова карта. +{b Потребителите} имат имейл и парола с които влизат, своя библиотека от книги които могат да достъпват и номер на банкова карта. Всеки потребител има възможността да смени своята парола или номер на банкова карта. Номер "0" на банкова карта обозначава, че няма свързана банкова карта (и потребителя може да купува само безплатни книги). @@ -35,9 +35,9 @@ Потребителите могат да виждат всички свои транзакции и техния статус: чакащ одобрение, одобрен, отхвърлен. Допълнително, могат да изкарат справка за купени книги, която е текстов файл, съдържащ всяка (одобрена) транзакция, заглавието и цената на закупената книга. -[=Библиотекарите=] имат библиотекарски номер и парола с които влизат. +{b Библиотекарите} имат библиотекарски номер и парола с които влизат. Те могат да добавят нови книги, където на един ред се въвежда заглавието на книгата, на втори се въвежда автора, на трети година на издаване, на четвърти цената и след това се въвежда съдържанието на книгата. -Това съдържание свършва, когато се въведе знака точка [`.`] на самостоятелен ред. +Това съдържание свършва, когато се въведе знака точка {` .} на самостоятелен ред. За вече съществуващи книги, могат да се редактират заглавието, автора, и цената. Да се има впредвид, че тези всички тези промени, освен върху цената, се разпространяват на потребителите. @@ -50,8 +50,8 @@ Това обозначава дали потребител може да си я купи или не (и дали излиза в списъка с налични книги за купуване; но не променя нищо ако е вече закупена). По подразбиране всяка нова книга е налична и трябва експлитно да бъде "свалена". -[=Банковите служители=] влизат със служителски номер, динамична парола и статична парола. -Статичната парола е текстова, докато динамичната парола е положително число, което трябва да изпълнява тъждеството [`(служителски_номер * динамича_парола) mod 8581 = 0`]. +{b Банковите служители} влизат със служителски номер, динамична парола и статична парола. +Статичната парола е текстова, докато динамичната парола е положително число, което трябва да изпълнява тъждеството {` (служителски_номер * динамича_парола) mod 8581 = 0}. Допълнително, нито служителския номер, нито статичната парола, могат да бъдат числата 0, 1 или 8581. Примери за такива двойки числа са: 27 17162, 572 51486, 901 42905. diff --git a/src/teaching/oop-2025/week08/index.du b/src/teaching/oop-2025/week08/index.du index a57845c..7286af7 100644 --- a/src/teaching/oop-2025/week08/index.du +++ b/src/teaching/oop-2025/week08/index.du @@ -1,26 +1,26 @@ -# Задачи - ООП, Седмица 8, 08.04.2026 +'def title Задачи - ООП, Седмица 8, 08.04.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 3 min -'define created 07 April 2026 -'define edited 08 April 2026 -[$pagenav] +# {title} + +{pagenav 3 min;07 April 2026;08 April 2026} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week08/Exercise01 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week08/Exercise01} .warn -За всеки клас имплементирайте [=голяма петица!=] +За всеки клас имплементирайте {b голяма петица!} Всички методи трябва да достъпни и за константни обекти, когато е възможно. Реализирайте система за менажиране на многостепенни ракети. След изтрелване на ракетата, най-долната "степен" се активира. При изразходване на горивото, тя се откача от другите степени и следващата степен се активира. -[image https://upload.wikimedia.org/wikipedia/commons/d/d6/Black_Brant.jpg]\n -[*В тази ракета, степените са оцветени по различен начин: бяло, червено и черно.*] +{img https://upload.wikimedia.org/wikipedia/commons/d/d6/Black_Brant.jpg}<br/> +{i В тази ракета, степените са оцветени по различен начин: бяло, червено и черно.} Всяка степен си има: .bulleted @@ -34,16 +34,16 @@ Може да зачитаме праволинейно ускорение и да не изчисляваме промяната на количеството гориво. Това означава, че можем да използваме следните формули за дадена степен: -[image ./img/formulas.png] +{img ./img/formulas.png} Където: .bulleted -- [`a`] е ускорението, -- [`v[_0_]`] е началната скорост, +- {` a} е ускорението, +- {` v{_ 0}} е началната скорост, за първата степен тя ще е 0, за втората тя ще е скоростта на първата степен, на третата ще е скоростта на втората степен и так. нат. -- [`x`] е разстояние в метри. +- {` x} е разстояние в метри. Степените се комбинират в ракета. Всяка ракета си има име и неограничен брой степени. @@ -56,10 +56,10 @@ - общото разстояние което ракетата може да измине, в километри - общото време в което ракетата ще гори -Допълнително, имплементирайте методи [`Export`] и [`Import`], чрез които всички данни на една ракета се запазват или вземат в/от двоичен файл. +Допълнително, имплементирайте методи {` Export} и {` Import}, чрез които всички данни на една ракета се запазват или вземат в/от двоичен файл. Неограничено количество ракети и необвързани степени се съхраняват в хангари. -Имплементирайте методи за добавяне на степени в хангара и [*преместване*] на степени в ракети. +Имплементирайте методи за добавяне на степени в хангара и {i преместване} на степени в ракети. Освен това имаме площадки от които ракети могат да се изтрелват. Всяка площадка съдържа: @@ -73,11 +73,11 @@ Реализирайте конзолен интерфейс, който поддържа командите: .bulleted -- [`exit`], която приключва програмата -- [`new_hangar`], която по подадени данни добавя нов хангар -- [`new_launch_site`], която по подадени данни добавя нова площадка -- [`new_rocket_stage`], която по подадени данни добавя нова степен в избран хангар. +- {` exit}, която приключва програмата +- {` new_hangar}, която по подадени данни добавя нов хангар +- {` new_launch_site}, която по подадени данни добавя нова площадка +- {` new_rocket_stage}, която по подадени данни добавя нова степен в избран хангар. Ако такъв не съществува, да се добави в последния добавен хангар. -- [`new_rocket`], която по подадени данни добавя нова ракета в хангар. - Степените ѝ трябва да са "пренесени" от хангар(и), [=не=] да се създадат наново. -- [`can_launch`], която по подадени данни за площадка и ракета, връща дали ракетата може да бъде изтреляна от площадката +- {` new_rocket}, която по подадени данни добавя нова ракета в хангар. + Степените ѝ трябва да са "пренесени" от хангар(и), {b не} да се създадат наново. +- {` can_launch}, която по подадени данни за площадка и ракета, връща дали ракетата може да бъде изтреляна от площадката diff --git a/src/teaching/oop-2025/week09/index.du b/src/teaching/oop-2025/week09/index.du index df7eb1e..d7bd858 100644 --- a/src/teaching/oop-2025/week09/index.du +++ b/src/teaching/oop-2025/week09/index.du @@ -1,20 +1,20 @@ -# Задачи - ООП, Седмица 9, 15.04.2026 +'def title Задачи - ООП, Седмица 9, 15.04.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 5 min -'define created 14 April 2026 -'define edited 26 April 2026 -[$pagenav] +# {title} + +{pagenav 5 min;14 April 2026;26 April 2026} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week09/Exercise01 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week09/Exercise01} .note -[*(26.04.2026)*] Променено от "дата на производство" в "година на производство" +{i (26.04.2026)} Променено от "дата на производство" в "година на производство" -Реализирайте клас [`Locomotive`], който съдържа: +Реализирайте клас {` Locomotive}, който съдържа: .bulleted - идентификационен номер - име на производител @@ -22,7 +22,7 @@ - година на производство - дължина в милиметри - брой цилиндри в двигателя -- дали поддържа връзка с втори локомотив, така че и двата да се управляват от един машинист (так. нар. [url https://en.wikipedia.org/wiki/Multiple_working multiple working]) +- дали поддържа връзка с втори локомотив, така че и двата да се управляват от един машинист (так. нар. {url multiple working;https://en.wikipedia.org/wiki/Multiple_working}) За него реализирайте нужните селектори и мутатори. @@ -40,77 +40,77 @@ Train #9999 ### Задача 2 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week09/Exercise02 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week09/Exercise02} -Реализирайте клас [`Vector`], който съхранява неограничено количество от числа с плаваща запетая. +Реализирайте клас {` Vector}, който съхранява неограничено количество от числа с плаваща запетая. Реализирайте оператори: .bulleted -- [`+`], който покомпонентно събира елементи -- [`-`], който покомпонентно изважда елементи -- [`&`], който връща евклидовата дължина на вектора -- [`*`], който връща умножение на вектор и скалар -- [`*`], който връща точковото (покомпонентно) умножение на два вектора -- [`^`], който връща векторнотно умножение на векторите -- [`||`], който връща дали двата вектора са паралелни -- [`==`], който връща дали двата вектора са равни -- [`!=`], който връща дали двата вектора са различни +- {` +}, който покомпонентно събира елементи +- {` -}, който покомпонентно изважда елементи +- {` &}, който връща евклидовата дължина на вектора +- {` *}, който връща умножение на вектор и скалар +- {` *}, който връща точковото (покомпонентно) умножение на два вектора +- {` ^}, който връща векторнотно умножение на векторите +- {` ||}, който връща дали двата вектора са паралелни +- {` ==}, който връща дали двата вектора са равни +- {` !=}, който връща дали двата вектора са различни -За всички тези оператори реализирайте съотвените оператори за присвояване ([`+=`], [`-=`], ...). +За всички тези оператори реализирайте съотвените оператори за присвояване ({` +=}, {` -=}, ...). Ако единия вектор има повече елементи, нека те да се игнорират/оставят. ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week09/Exercise03 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week09/Exercise03} -Реализирайте клас [`String`], който съхранява низ с неограничен размер. +Реализирайте клас {` String}, който съхранява низ с неограничен размер. Имплементирайте следните оператори: .bulleted -- [`+`], конкатенира (слепва) втория низ в края на първия -- [`==`], [`!=`], [`>`], [`>=`], [`<`], [`<=`], които сравняват двата низа (както [`strcmp`] ги сравнява) -- [`[]`], който връща буква по подаден индекс -- [`[]`], който връща подниза между два индекса (вкл.), разделени със запетая. - Тоест [`text[X(3), 5]`] трябва да върне подниз с начало и край индекси 3 и 5. - [`X`] е помощен клас, наименуван по ваш начин. -- [`<<`], който връща дали левия низ завършва със съдържанието на десния низ -- [`>>`], който връща дали десния низ започва със съдържанието на левия низ +- {` +}, конкатенира (слепва) втория низ в края на първия +- {` ==}, {` !=}, {` >}, {` >=}, {` <}, {` <=}, които сравняват двата низа (както {` strcmp} ги сравнява) +- {` []}, който връща буква по подаден индекс +- {` []}, който връща подниза между два индекса (вкл.), разделени със запетая. + Тоест {` text[X(3), 5]} трябва да върне подниз с начало и край индекси 3 и 5. + {` X} е помощен клас, наименуван по ваш начин. +- {` <<}, който връща дали левия низ завършва със съдържанието на десния низ +- {` >>}, който връща дали десния низ започва със съдържанието на левия низ ### Задача 4 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week09/Exercise04 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week09/Exercise04} -Реализирайте клас [`Rover`], който съхранява координатите на движещ се роувър. -В началото роувъра започва в координати [`(0,0)`] и сочи напред (към [`(0,1)`]) +Реализирайте клас {` Rover}, който съхранява координатите на движещ се роувър. +В началото роувъра започва в координати {` (0,0)} и сочи напред (към {` (0,1)}) Реализирайте следните оператори: .bulleted -- [`<`], роувъра от дясната страна на оператора се придвижва наляво с лявата страна на брой единици -- [`>`], роувъра от лявата страна на оператора се придвижва надясно с дясната страна на брой единици -- [`^`], роувъра от лявата страна на оператора се придвижва напред с дясната страна на брой единици -- [`<<`], роувъра от дясната страна на оператора се завърта обратно на часовниковата стрелка с лявата страна на брой градуси -- [`>>`], роувъра от лявата страна на оператора се завърта по часовниковата стрелка с дясната страна на брой градуси +- {` <}, роувъра от дясната страна на оператора се придвижва наляво с лявата страна на брой единици +- {` >}, роувъра от лявата страна на оператора се придвижва надясно с дясната страна на брой единици +- {` ^}, роувъра от лявата страна на оператора се придвижва напред с дясната страна на брой единици +- {` <<}, роувъра от дясната страна на оператора се завърта обратно на часовниковата стрелка с лявата страна на брой градуси +- {` >>}, роувъра от лявата страна на оператора се завърта по часовниковата стрелка с дясната страна на брой градуси Реализирайте и съответните оператори за вход/изход от/към поток. ### Задача 5 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week09/Exercise05 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week09/Exercise05} -Реализирайте клас [`StringArray`], който съхранява неограничено (и оразмеряемо) количество низове. +Реализирайте клас {` StringArray}, който съхранява неограничено (и оразмеряемо) количество низове. Реализирайте нужните оператори и помощни класове, чрез които следния код е валиден: .note -[*(26.04.2026)*] +{i (26.04.2026)} Обновени конвертирания, така че примера да работи. Променени първите три размери. -```c++ +```cpp StringArray s; s[ Z(7) +++ Z(4) +++ Z(3) ] ("") (X("Hello")|"World") [ Z(4) +++ Z(5) +++ Z(1) ] ("!") [ Z(2) ] (X("Code")|"A"|"B"); -В квадратните скоби се изреждат максимални размери на очаквани низове, разделени с [`+++`]. -В кръглите скоби се подават низове, разделени с [`|`]. -Класовете [`Z`] и [`X`] са класове, наименувани по ваш начин. +В квадратните скоби се изреждат максимални размери на очаквани низове, разделени с {` +++}. +В кръглите скоби се подават низове, разделени с {` |}. +Класовете {` Z} и {` X} са класове, наименувани по ваш начин. .question Защо ни трябва експлицитното конвертиране? @@ -126,7 +126,7 @@ s[ Z(7) +++ Z(4) +++ Z(3) ] ("") (X("Hello")|"World") [ Z(4) +++ Z(5) +++ Z(1) ] - след това допълнително очакваме един низ с размер 2 - след това ни се подават три низа, с размери 4, 1 и 1 -Финално, в [`s`] трябва да имаме низовете [`"", "Hell", "Wor", "!", "Code", "A", "B"`]. +Финално, в {` s} трябва да имаме низовете {` "", "Hell", "Wor", "!", "Code", "A", "B"}. Ако ни се подаде низ с по-голям размер от очаквания, трябва да съхраним само броя знаци, които очакваме. Ако ни се подаде низ, който не очакваме, трябва да го игнорираме. diff --git a/src/teaching/oop-2025/week10/index.du b/src/teaching/oop-2025/week10/index.du index ca1825c..e99f572 100644 --- a/src/teaching/oop-2025/week10/index.du +++ b/src/teaching/oop-2025/week10/index.du @@ -1,71 +1,71 @@ -# Задачи - ООП, Седмица 10, 22.04.2026 +'def title Задачи - ООП, Седмица 10, 22.04.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 3 min -'define created 22 April 2026 -'define edited 29 April 2026 -[$pagenav] +# {title} + +{pagenav 3 min;22 April 2026;29 April 2026} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week10/Exercise01 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week10/Exercise01} -Реализирайте клас [`User`], който съдържа полета за: +Реализирайте клас {` User}, който съдържа полета за: .bulleted - идентификационен код - име - парола - година на създаване на акаунта -И публичен метод [`LogIn`], който по подаден идентификационен код и парола връща дали данните са коректни (и потребителя може да влезе в акаунта си). +И публичен метод {` LogIn}, който по подаден идентификационен код и парола връща дали данните са коректни (и потребителя може да влезе в акаунта си). -Реализирайте наследник [`Student`] на [`User`], който допълнително съдържа полета: +Реализирайте наследник {` Student} на {` User}, който допълнително съдържа полета: .bulleted - дали е завършил или не - година на випуск -И публичен метод [`Graduate`], с който се записва че е завършил. +И публичен метод {` Graduate}, с който се записва че е завършил. -Реализирайте наследник [`Teacher`] на [`User`], който допълнително съдържа полета: +Реализирайте наследник {` Teacher} на {` User}, който допълнително съдържа полета: .bulleted - име на предмет който преподава - брой ученици на които преподава -И публичен метод [`ChangeStudents`], с който се променя бройката студенти на които преподава. +И публичен метод {` ChangeStudents}, с който се променя бройката студенти на които преподава. ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week10/Exercise03 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week10/Exercise03} -Реализирайте клас [`Inventory`], който съдържа неограничено количество продукти. +Реализирайте клас {` Inventory}, който съдържа неограничено количество продукти. За всеки продукт съхранете име и количество. -Реализирайте наследник [`Shop`] на [`Inventory`], който допълнително съхранява неограничено количество продажби. +Реализирайте наследник {` Shop} на {` Inventory}, който допълнително съхранява неограничено количество продажби. Всяка продажба съдържа име на продукт, купено количество и дата (ден, месец, година). -Реализирайте негов метод [`Purchase`], който по подадени данни съхранява нова продажба и намалява инвентарното наличество. +Реализирайте негов метод {` Purchase}, който по подадени данни съхранява нова продажба и намалява инвентарното наличество. -Реализирайте наследник [`Warehouse`] на [`Inventory`], който допълнително съхранява неограничено количество доставки. +Реализирайте наследник {` Warehouse} на {` Inventory}, който допълнително съхранява неограничено количество доставки. Всяка доставка съдържа най-много 8 продукта, датата на доставката (ден, месец, година) и номер за проследяване. -Реализирайте негов метод [`Receive`], който по подадени данни съхранява нова доставката и увеличава инвентарното количество. +Реализирайте негов метод {` Receive}, който по подадени данни съхранява нова доставката и увеличава инвентарното количество. .warn Всички неограничени количества трябва да са имплементирани в самия клас. -Не може да имплементирате [`ProductArray`], който да е член-данна в [`Inventory`] например. +Не може да имплементирате {` ProductArray}, който да е член-данна в {` Inventory} например. ## За любознателните ### Задача 2 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week10/Exercise02 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week10/Exercise02} .warn -[*(29.04.2026)*] +{i (29.04.2026)} Тази задача избързва с материала, затова е преместена тук. -Реализирайте клас [`Vehicle`], който съдържа полета за: +Реализирайте клас {` Vehicle}, който съдържа полета за: .bulleted - модел - година на производство @@ -74,21 +74,20 @@ - тежест в килограми - конски сили -Реализирайте наследник [`CombustionVehicle`] на [`Vehicle`], който съдържа полета за: +Реализирайте наследник {` CombustionVehicle} на {` Vehicle}, който съдържа полета за: .bulleted - брой цилиндри в двигателя - обем на двигателя в литри -Реализирайте наследник [`ElectricVehicle`] на [`Vehicle`], който съдържа полета за: +Реализирайте наследник {` ElectricVehicle} на {` Vehicle}, който съдържа полета за: .bulleted - капацитет на батерия в киловатчаса - пробег в километри - количество поддържано захранване в киловатове -За всички класове реализирайте нужните селектори и мутатори, както и [`operator<<`] и [`operator>>`]. +За всички класове реализирайте нужните селектори и мутатори, както и {` operator<<} и {` operator>>}. От входа получавате цяло неотрицателно число: бройка превозни средства. -След това, за всяко превозно средство получавате буква определяща типа му ([`c`] за [`CombustionVehicle`] и [`e`] за [`ElectricVehicle`]) и след това всички нужни стойности (първо тези от [`Vehicle`], модел, година на производство, ... и след това тези за съответния автомобил). - -Запазете всички превозни средства в [=един=] масив. +След това, за всяко превозно средство получавате буква определяща типа му ({` c} за {` CombustionVehicle} и {` e} за {` ElectricVehicle}) и след това всички нужни стойности (първо тези от {` Vehicle}, модел, година на производство, ... и след това тези за съответния автомобил). +Запазете всички превозни средства в {b един} масив. diff --git a/src/teaching/oop-2025/week11/index.du b/src/teaching/oop-2025/week11/index.du index 7acd8cd..ac154b6 100644 --- a/src/teaching/oop-2025/week11/index.du +++ b/src/teaching/oop-2025/week11/index.du @@ -1,63 +1,63 @@ -# Задачи - ООП, Седмица 11, 29.04.2026 +'def title Задачи - ООП, Седмица 11, 29.04.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 4 min -'define created 28 April 2026 -'define edited 29 April 2026 -[$pagenav] +# {title} + +{pagenav 4 min;28 April 2026;29 April 2026} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11/Exercise01 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11/Exercise01} -Реализирайте шаблонен клас [`Pair`], който пази две стойности от типове [`T`] и [`U`]. +Реализирайте шаблонен клас {` Pair}, който пази две стойности от типове {` T} и {` U}. Реализирайте съотвените мутатори и селектори за константни и неконстантни обекти. ### Задача 2 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11/Exercise02 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11/Exercise02} -Реализирайте шаблонен клас [`Option`], който съхранява стойност от тип [`T`]. +Реализирайте шаблонен клас {` Option}, който съхранява стойност от тип {` T}. -Нека конструкторите да [=не=] са публични. -За създаване на обект, имплементирайте статични методи [`Some`] и [`None`], първия от които приема стойност, а втория не приема нищо. +Нека конструкторите да {b не} са публични. +За създаване на обект, имплементирайте статични методи {` Some} и {` None}, първия от които приема стойност, а втория не приема нищо. -Целта е следната: ако един [`Option`] е създаден чрез [`None`], тогава обозначаваме че няма стойност, а чрез [`Some`] показваме че има стойност. -Идеята е аналогична на това когато един указател е [`nullptr`] или не, но работи в по-общи случаи. +Целта е следната: ако един {` Option} е създаден чрез {` None}, тогава обозначаваме че няма стойност, а чрез {` Some} показваме че има стойност. +Идеята е аналогична на това когато един указател е {` nullptr} или не, но работи в по-общи случаи. Имплементирайте методи: .bulleted -- [`IsSome`], връща дали има стойност -- [`IsNone`], връща дали няма стойност -- [`Unwrap`], връща запазената стойност +- {` IsSome}, връща дали има стойност +- {` IsNone}, връща дали няма стойност +- {` Unwrap}, връща запазената стойност ### Задача 3 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11/Exercise03 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11/Exercise03} -Реализирайте шаблонен клас [`SharedPointer`], който пази динамично-заделен указател към тип [`T`]. -Допълнително, класа следи за бройката свои [*инстанции*]. +Реализирайте шаблонен клас {` SharedPointer}, който пази динамично-заделен указател към тип {` T}. +Допълнително, класа следи за бройката свои {i инстанции}. С други думи, при всяко копиране на създадения обект, увеличаваме бройката, и при всяко унищожаване (извикване на деструктор) намаляваме бройката. Изтриването на паметта (указателя) се случва тогава, и само тогава когато бройката стигне нула. .note -Това е вид [url https://en.wikipedia.org/wiki/Smart_pointer "smart pointer"]: динамично-заделен указател който сам освобождава паметта си, без ние да пишем експлицитен [`delete`]!\n -В C++ има и други видове smart pointer-и, като "unique pointer" (който е описан в [url #-6 Задача 6]). +Това е вид {url "smart pointer";https://en.wikipedia.org/wiki/Smart_pointer}: динамично-заделен указател който сам освобождава паметта си, без ние да пишем експлицитен {` delete}!\n +В C++ има и други видове smart pointer-и, като "unique pointer" (който е описан в {url Задача 6;#-6}). -Добър въведителен ресурс по темата е [url https://courses.cs.washington.edu/courses/cse333/24au/lectures/16-c++-smartptr.pdf този]. +Добър въведителен ресурс по темата е {url този;https://courses.cs.washington.edu/courses/cse333/24au/lectures/16-c++-smartptr.pdf}. -Реализирайте [`operator*`] и [`operator->`], които съответстват на операциите върху запазения указател. -Тоест, [`*x`] трябва да има един и същ ефект върху [`int*`] и върху [`SharedPointer`] от [`int*`]. +Реализирайте {` operator*} и {` operator->}, които съответстват на операциите върху запазения указател. +Тоест, {` *x} трябва да има един и същ ефект върху {` int*} и върху {` SharedPointer} от {` int*}. .question -Как работи [`operator->`]? +Как работи {` operator->}? -Имплементирайте също метод [`RefCount`], който връща броя копия. +Имплементирайте също метод {` RefCount}, който връща броя копия. Примерна употреба: -```c++ +```cpp void inc(SharedPointer<int> val) { // val е копие на y, бройката е 3 *val++; } // val се унищожава, бройката става 2 @@ -72,36 +72,36 @@ int main() { ### Задача 4 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11/Exercise04 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11/Exercise04} -Реализирайте шаблонен клас [`Vector`], който съхранява неограничено и оразмеряемо количество от обекти [`T`]. +Реализирайте шаблонен клас {` Vector}, който съхранява неограничено и оразмеряемо количество от обекти {` T}. Освен голяма петица, реализирайте член-функции: .bulleted -- [`Count`], която връща броя елементи -- [`PushBack`], която добавя елемент в края на последователността. +- {` Count}, която връща броя елементи +- {` PushBack}, която добавя елемент в края на последователността. Ако е нужно, уголемява заделеното количество памет. -- [`operator[]`], който връща референция към обекта на подаден индекс. +- {` operator[]}, който връща референция към обекта на подаден индекс. Да бъде наличен при константни и не-константни обекти. -- [`operator+`] който създава нов [`Vector`] с елементите от първия и след това елементите от втория [`Vector`] -- [`operator+=`], които добавя елементите на десния [`Vector`] в края на левия +- {` operator+} който създава нов {` Vector} с елементите от първия и след това елементите от втория {` Vector} +- {` operator+=}, които добавя елементите на десния {` Vector} в края на левия ## За самоподготовка ### Задача 5 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11/Exercise05 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11/Exercise05} -Реализирайте клас [`DoubleVector`], който съхранява две неограничени и оразмеряеми количества от обекти, съответно от типове [`T`] и [`U`]. +Реализирайте клас {` DoubleVector}, който съхранява две неограничени и оразмеряеми количества от обекти, съответно от типове {` T} и {` U}. -Имплементирайте голяма петица и член-функциите от [url #-4 Задача 4], обаче всяка трябва да е налична и за двете последователности от обекти. +Имплементирайте голяма петица и член-функциите от {url Задача 4;#-4}, обаче всяка трябва да е налична и за двете последователности от обекти. ### Задача 6 -.solution-link [url https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11/Exercise06 Решение] +.solution-link {url Решение;https://github.com/Syndamia/oop-2025-solutions/tree/main/Week11/Exercise06} -Реализирайте шаблонен клас [`UniquePointer`], който пази указател към тип [`T`]. +Реализирайте шаблонен клас {` UniquePointer}, който пази указател към тип {` T}. Класа трябва да осигури, че само един обект има този указател. -С други думи, [=не може да има копия=]! +С други думи, {b не може да има копия}! -Реализирайте [`operator*`] и [`operator->`], които съответстват на операциите върху запазения указател (т.е. [`*x`] трябва да има същия ефект, без значение дали работим с [`int*`] или [`SharedPointer`], който съхранява [`int*`]). +Реализирайте {` operator*} и {` operator->}, които съответстват на операциите върху запазения указател (т.е. {` *x} трябва да има същия ефект, без значение дали работим с {` int*} или {` SharedPointer}, който съхранява {` int*}). diff --git a/src/teaching/oop-2025/week12/index.du b/src/teaching/oop-2025/week12/index.du index 4f34d9c..243ee93 100644 --- a/src/teaching/oop-2025/week12/index.du +++ b/src/teaching/oop-2025/week12/index.du @@ -1,9 +1,9 @@ -# Задачи - ООП, Седмица 12, 13.05.2026 +'def title Задачи - ООП, Седмица 12, 13.05.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 2 min -'define created 13 May 2026 -'define edited 13 May 2026 -[$pagenav] +# {title} + +{pagenav 2 min;13 May 2026;13 May 2026} ## За решаване diff --git a/src/teaching/oop-2025/week13/index.du b/src/teaching/oop-2025/week13/index.du index 77479ed..5ea3f64 100644 --- a/src/teaching/oop-2025/week13/index.du +++ b/src/teaching/oop-2025/week13/index.du @@ -1,66 +1,66 @@ -# Задачи - ООП, Седмица 13, 20.05.2026 +'def title Задачи - ООП, Седмица 13, 20.05.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 3 min -'define created 20 May 2026 -'define edited 20 May 2026 -[$pagenav] +# {title} + +{pagenav 3 min;20 May 2026;20 May 2026} ## За решаване ### Задача 1 -Реализирайте абстрактен клас [`Numeric`], който съдържа чисто виртуални функции: +Реализирайте абстрактен клас {` Numeric}, който съдържа чисто виртуални функции: .bulleted -- [`operator+`] -- унарен [`operator-`] -- бинарен [`operator-`] -- [`operator+=`] -- [`operator-=`] +- {` operator+} +- унарен {` operator-} +- бинарен {` operator-} +- {` operator+=} +- {` operator-=} -Реализирайте негови наследници [`Integer`] и [`Float`], които съответно имплементират операции върху [`int`] и [`float`] стойности. +Реализирайте негови наследници {` Integer} и {` Float}, които съответно имплементират операции върху {` int} и {` float} стойности. ### Задача 2 -Реализирайте клас [`User`], който съхранява идентификационен номер и входен ПИН код. -Имплементирайте (виртуална) член-функция [`LogIn`], която връща дали подадения ѝ ПИН код съответства на запазения. +Реализирайте клас {` User}, който съхранява идентификационен номер и входен ПИН код. +Имплементирайте (виртуална) член-функция {` LogIn}, която връща дали подадения ѝ ПИН код съответства на запазения. -Реализирайте наследник [`Citizen`], който разширява функцията [`LogIn`], така че винаги да отказва числа, които имат повече от 4 цифри. +Реализирайте наследник {` Citizen}, който разширява функцията {` LogIn}, така че винаги да отказва числа, които имат повече от 4 цифри. -Реализирайте наследник (на [`User`]) [`Clerk`], който допълнително съхранява статичен код. -[`LogIn`] в този случай е успешен, когато [`((ВХОДЕН_ПИН + СЪХРАНЕН_ПИН) * СТАТИЧЕН_КОД) % 115249 = 347`]. +Реализирайте наследник (на {` User}) {` Clerk}, който допълнително съхранява статичен код. +{` LogIn} в този случай е успешен, когато {` ((ВХОДЕН_ПИН + СЪХРАНЕН_ПИН) * СТАТИЧЕН_КОД) % 115249 = 347}. Пример за валидни стойности са 700 за съхранен пин, 3141 за входен пин и 47978 за статичен код. -Реализирайте наследник (на [`User`]) [`System`], при който [`LogIn`] е валидно, когато подадения пин е точен квадрат на съхранения пин. +Реализирайте наследник (на {` User}) {` System}, при който {` LogIn} е валидно, когато подадения пин е точен квадрат на съхранения пин. -От входа получавате неотрицателно цяло число [`N`] и след това данни за [`N`] на брой потребителя. -При всеки потребител се поисква буква, определяща неговия тип: [`c`] за [`Citizen`], [`l`] за [`Clerk`] и [`s`] за [`System`]. -Трябва да съхраните всички потребители в [=полиморфен=] масив с елементи от тип [`User*`]. +От входа получавате неотрицателно цяло число {` N} и след това данни за {` N} на брой потребителя. +При всеки потребител се поисква буква, определяща неговия тип: {` c} за {` Citizen}, {` l} за {` Clerk} и {` s} за {` System}. +Трябва да съхраните всички потребители в {b полиморфен} масив с елементи от тип {` User*}. След това от входа ще получавате идентификационен номер и пин код, и трябва да върнете дали подадените данни са валидни за влизане в акаунта. ### Задача 3 -Реализирайте клас [`String`], който съхранява динамично-задлен низ. +Реализирайте клас {` String}, който съхранява динамично-задлен низ. Освен голяма петица, имплементирайте виртуален мутатор и константен селектор към низа. -Реализирайте клас [`Username`], наследник на [`String`], чиито мутатор приема единствено низове, които съдържат само главни и малки латински букви. +Реализирайте клас {` Username}, наследник на {` String}, чиито мутатор приема единствено низове, които съдържат само главни и малки латински букви. -Реализирайте клас [`Match`], наследник на [`String`], който съхранява допълнителен динамично-заделен низ [`pattern`] и бройка [`matches`]. -За [`pattern`] има друг селектор и мутатор. -При всяка промяна на [`pattern`] и оригиналния низ, [`matches`] се обновява с бройката (потенциално препокриващи се) срещания на [`pattern`] в низа. +Реализирайте клас {` Match}, наследник на {` String}, който съхранява допълнителен динамично-заделен низ {` pattern} и бройка {` matches}. +За {` pattern} има друг селектор и мутатор. +При всяка промяна на {` pattern} и оригиналния низ, {` matches} се обновява с бройката (потенциално препокриващи се) срещания на {` pattern} в низа. ### Задача 4 -Реализирайте шаблонен клас [`Indexable`], който съхранява чисто-виртуален не-константен [`operator[]`], и имплементира константен [`operator[]`], базиран на не-константния. +Реализирайте шаблонен клас {` Indexable}, който съхранява чисто-виртуален не-константен {` operator[]}, и имплементира константен {` operator[]}, базиран на не-константния. -Реализирайте клас [`Compareable`], който съхранява чисто-виртуални [`operator<`] и [`operator==`], и имплементира останалите оператори за сравнение ([`<=`], [`>`], [`>=`], [`!=`]), използвайки чисто-виртуалните. +Реализирайте клас {` Compareable}, който съхранява чисто-виртуални {` operator<} и {` operator==}, и имплементира останалите оператори за сравнение ({` <=}, {` >}, {` >=}, {` !=}), използвайки чисто-виртуалните. -Реализирайте клас [`Dynamic`], който въхранява чисто-виртуални не-публични методи [`free`], [`copyFrom`] и [`init`], и имплементира компонентите от голямата петица, използвайки тези методи. +Реализирайте клас {` Dynamic}, който въхранява чисто-виртуални не-публични методи {` free}, {` copyFrom} и {` init}, и имплементира компонентите от голямата петица, използвайки тези методи. -Реализирайте клас [`Vector`], който съхранява динамично-заделен масив от елементи и е наследник и на трите класа. +Реализирайте клас {` Vector}, който съхранява динамично-заделен масив от елементи и е наследник и на трите класа. Сравненията между вектори са спрямо бройката елементи. -Реализирайте клас [`Integer`], който съхранява динамично-заделен [`int`] и наследява [`Compareable`] и [`Dynamic`]. +Реализирайте клас {` Integer}, който съхранява динамично-заделен {` int} и наследява {` Compareable} и {` Dynamic}. -Реализирайте шаблонен клас [`Array`], който съхранява статично-заделен масив, чиито елементи и тяхна бройка се подават като част от типа, и който наследява [`Indexable`] и [`Compareable`]. +Реализирайте шаблонен клас {` Array}, който съхранява статично-заделен масив, чиито елементи и тяхна бройка се подават като част от типа, и който наследява {` Indexable} и {` Compareable}. Сравненията между масиви са спрямо бройката елементи. diff --git a/src/teaching/oop-2025/week14/index.du b/src/teaching/oop-2025/week14/index.du index c01f3b8..bcf8220 100644 --- a/src/teaching/oop-2025/week14/index.du +++ b/src/teaching/oop-2025/week14/index.du @@ -1,27 +1,27 @@ -# Задачи - ООП, Седмица 14, 27.05.2026 +'def title Задачи - ООП, Седмица 14, 27.05.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 2 min -'define created 27 May 2026 -'define edited 27 May 2026 -[$pagenav] +# {title} + +{pagenav 2 min;27 May 2026;27 May 2026} ## За решаване ### Задача -Реализирайте клас [`Sensor`], който съхранява целочислен неотрицателен сериен номер и число с плаваща запетая за напрежение на захранване. +Реализирайте клас {` Sensor}, който съхранява целочислен неотрицателен сериен номер и число с плаваща запетая за напрежение на захранване. Също имплементирайте методи, налични във всички наследници: .bulleted -- [`GetType`], който връща типа на сензора (най-десните 2 цифри от серийния номер). -- [`EnoughSupply`], който приема напрежение, което се подава на сензора и връща дали е достатъчно или не +- {` GetType}, който връща типа на сензора (най-десните 2 цифри от серийния номер). +- {` EnoughSupply}, който приема напрежение, което се подава на сензора и връща дали е достатъчно или не -Реализирайте негови наследници [`CameraSensor`] и [`GyroSensor`]. +Реализирайте негови наследници {` CameraSensor} и {` GyroSensor}. -[`CameraSensor`] съхранява резолюция (височина и ширина) и брой взети снимки. -При класа имплементирайте метод [`TakeSnapshot`], който инкрементира бройката взети снимки. +{` CameraSensor} съхранява резолюция (височина и ширина) и брой взети снимки. +При класа имплементирайте метод {` TakeSnapshot}, който инкрементира бройката взети снимки. -[`GyroSensor`] съхранява скорост на измерване в [`dps`] (ъгли в секунда). -Имплементирайте негов метод [`Rotate`], който по получен ъгъл връща най-малкото количество от време, което е нужно за да може сензора да измере въртенето. +{` GyroSensor} съхранява скорост на измерване в {` dps} (ъгли в секунда). +Имплементирайте негов метод {` Rotate}, който по получен ъгъл връща най-малкото количество от време, което е нужно за да може сензора да измере въртенето. -Реализирайте наследник [`DSLR`] на [`CameraSensor`] и [`GyroSensor`], който допълнително съхранява изходна резолюция (височина и ширина) и скорост на вземане на кадър. -Имплементирайте член-функция [`CorrectedCapture`], която по подаден ъгъл, прави снимка и връща колко кадъра ще отнемат докато въртенето е напълно измерено. +Реализирайте наследник {` DSLR} на {` CameraSensor} и {` GyroSensor}, който допълнително съхранява изходна резолюция (височина и ширина) и скорост на вземане на кадър. +Имплементирайте член-функция {` CorrectedCapture}, която по подаден ъгъл, прави снимка и връща колко кадъра ще отнемат докато въртенето е напълно измерено. diff --git a/src/teaching/oop-2025/week15/index.du b/src/teaching/oop-2025/week15/index.du index 09e7a90..eececaa 100644 --- a/src/teaching/oop-2025/week15/index.du +++ b/src/teaching/oop-2025/week15/index.du @@ -1,9 +1,9 @@ -# Задачи - ООП, Седмица 15, 03.06.2026 +'def title Задачи - ООП, Седмица 15, 03.06.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 3 min -'define created 03 June 2026 -'define edited 03 June 2026 -[$pagenav] +# {title} + +{pagenav 3 min;03 June 2026;03 June 2026} ## За решаване @@ -11,35 +11,35 @@ Ще създадем система за създаване на постове от потребители, нещо подобно на Facebook/Reddit/... -Реализирайте шаблонен клас [`Database`], който съхранява неограничено количество от обекти от тип [`T`] с идентификатор от тип [`K`]. -На всеки обект може да съответства един [*уникален*] идентификатор. -За тип [`K`] можем да допуснем единствено, че поддържа [`operator==`]. +Реализирайте шаблонен клас {` Database}, който съхранява неограничено количество от обекти от тип {` T} с идентификатор от тип {` K}. +На всеки обект може да съответства един {i уникален} идентификатор. +За тип {` K} можем да допуснем единствено, че поддържа {` operator==}. -В [`Database`] трябва да може да се добавят и премахват елементи, спрямо даден идентификатор. -Нека тези член-функции да връщат [`bool`], спрямо това дали операцията е успешна. +В {` Database} трябва да може да се добавят и премахват елементи, спрямо даден идентификатор. +Нека тези член-функции да връщат {` bool}, спрямо това дали операцията е успешна. -Реализирайте клас [`User`], който въхранява имейл, потребителско име и парола. +Реализирайте клас {` User}, който въхранява имейл, потребителско име и парола. .bulleted -- Имейла трябва да е в [url https://en.wikipedia.org/wiki/Email_address#Syntax коректен формат] (не е нужно 100% покритие на всички изисквания, но поне по-значимите ограничения да се проверяват). +- Имейла трябва да е в {url коректен формат;https://en.wikipedia.org/wiki/Email_address#Syntax} (не е нужно 100% покритие на всички изисквания, но поне по-значимите ограничения да се проверяват). - Потребителското име може да съдържа латински бувки, цифри, тире и долна черта, като не може да започва с тире или цифра. - Паролата трябва да бъде поне 8 знака и да съдържа поне една цифра, една буква и един специален знак (нито цифра, нито буква) -Реализирайте клас [`Post`], който съхранява идентификатор на потребител (какъв е типа на този идентификатор ще бъде описано по-късно), текстово съдържание с неограничен размер и контейнер с идентификатори на всички потребители, които са харесали поста. +Реализирайте клас {` Post}, който съхранява идентификатор на потребител (какъв е типа на този идентификатор ще бъде описано по-късно), текстово съдържание с неограничен размер и контейнер с идентификатори на всички потребители, които са харесали поста. -Реализирайте клас [`PostSystem`], който съхранява колекции от потребители и постове (използвайки [`Database`]), като е шаблонен спрямо типа на идентификатора на потребителя. +Реализирайте клас {` PostSystem}, който съхранява колекции от потребители и постове (използвайки {` Database}), като е шаблонен спрямо типа на идентификатора на потребителя. Трябва да поддържа методи за регистриране на нов потребител, изтриване на акаунт, влизане в акаунт и излизане от акаунт. -При влизане в акаунт, системата връща "токен" от тип [`A`], който се използва за всички операции, където е нужна информация на съществуващ потребител. -Разбира се, всеки токен се пази в [`PostSystem`] и при потребителска операция се прави сравнение дали токена съответства на потребителя. +При влизане в акаунт, системата връща "токен" от тип {` A}, който се използва за всички операции, където е нужна информация на съществуващ потребител. +Разбира се, всеки токен се пази в {` PostSystem} и при потребителска операция се прави сравнение дали токена съответства на потребителя. При влизане в акаунт се проверява дали генерирания токен съществува, и ако да, тогава влизането се отказва. -За тип [`A`] единствено можем да допуснем, че поддържа [`operator==`]. +За тип {` A} единствено можем да допуснем, че поддържа {` operator==}. Понеже не знаем типа и следователно не знаем как да се генерира токена, член-функцията за генериране не може да има реализация. Освен тези операции, влязъл потребител може да създаде пост, да изтрие пост и да маркира/отмаркира пост като харесан. -Реализирайте наследник [`SecureForum`], където потребителските идентификатори и токени са целочислени неотрицателни поне 16-битови числа. +Реализирайте наследник {` SecureForum}, където потребителските идентификатори и токени са целочислени неотрицателни поне 16-битови числа. Всеки потребител си има единствен токен след влизане в акаунта (т.е. може да влезе в акаунта само ако е излязъл). -Реализирайте наследник [`StandardForum`], където потребителския идентификатор е целочислено неотрицателно число и токена е низ. +Реализирайте наследник {` StandardForum}, където потребителския идентификатор е целочислено неотрицателно число и токена е низ. Има неограничено количество токени за всеки потребител diff --git a/src/teaching/upp-2023/additional1/index.du b/src/teaching/upp-2023/additional1/index.du index 0356403..9956e2e 100644 --- a/src/teaching/upp-2023/additional1/index.du +++ b/src/teaching/upp-2023/additional1/index.du @@ -1,17 +1,20 @@ -# Допълнително упражнение 1 - УПП, 04.11.2023 +'def title Допълнително упражнение 1 - УПП, 04.11.2023 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github.com/a/nlFuKALw] +GitHub classroom: {url classroom.github.com/a/nlFuKALw;https://classroom.github.com/a/nlFuKALw} -При изображението [image /img/dialog-question.png трябва да спрете, да помислите и да си отговорите на дадения въпрос. +При изображението {img /img/dialog-question.png} трябва да спрете, да помислите и да си отговорите на дадения въпрос. Почти винаги ако не може да отговорите, ще имате проблеми в бъдеще с решаването. Понякога ще ви спираме и ще ви питаме за тези въпроси. ## Задача - База гаднни -.warn [=Нямате=] право да използвате каквито и да е функции, които вие не сте написали, както и неизучаван материал като двуизмерни масиви или динамична памет. -[=Не=] употребявайте търсачки, ако ви трябва информация за нещо, ще може да си я изкарате с една проста тестова програма или калкулатор. +.warn {b Нямате} право да използвате каквито и да е функции, които вие не сте написали, както и неизучаван материал като двуизмерни масиви или динамична памет. +{b Не} употребявайте търсачки, ако ви трябва информация за нещо, ще може да си я изкарате с една проста тестова програма или калкулатор. \n @@ -41,7 +44,7 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. Стойностите от таблица А са винаги ограничени отгоре с най-големия брой битове, които комфортно може да поберем в 7 цифри. Тоест 9999999 не е валидна стойност от таблица А, докато 8388608 e. -.question Колко най-много [*битове*] можем със сигурност да поберем в 7 цифри? +.question Колко най-много {i битове} можем със сигурност да поберем в 7 цифри? Понеже редовете са от 1 до 9, ако в таблица А имаме ред 0 правим нещо специално, но това ще видите в бъдеще. @@ -51,15 +54,16 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. Преди да започнем, трябва да имплементираме функция, която разделя дадения ред от таблица А на трите му компонента (ред, тип и стойност): -[`getRow`] - приема ред от таблица А и указатели към променливи за ред, тип и стойност; не връща нищо\n +{` getRow} - приема ред от таблица А и указатели към променливи за ред, тип и стойност; не връща нищо\n В подадените указатели пази съответните стойности от реда .question Защо приемаме указатели към променливи? Каква е "сигнатурата" на функцията? \n -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Извикване |= Резултат @@ -73,6 +77,7 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. |: row = 1, type = 2, value = 3456789 + ### б) обикновенно число Ако типа е цифрата "0", тогава стойността в базата данни е някакво число с плаваща запетая. @@ -82,13 +87,14 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. Имплементирайте функция: -[`parseNumber`] - приема стойност от таблица А и ред от таблица Б; връща полученото число от тези стойности +{` parseNumber} - приема стойност от таблица А и ред от таблица Б; връща полученото число от тези стойности \n -[=Примери:=] -[*Възможно е отклонението на последния пример да бъде повече от 2 единици*] +{b Примери:} +{i Възможно е отклонението на последния пример да бъде повече от 2 единици} -:table_2 +:table +:2 |= Извикване |= Резултат @@ -105,12 +111,14 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. |: a = 8388607.18446744073709551615 + ### в) числов текст (част едно) Ако типа е "1", тогава стойността в базата данни е някакъв низ (последователност от букви), която е кодирана в числата. Всеки 5 бита в реда (от дясно на ляво) от таблица Б определя буква, като: -:table_3 +:table +:3 |: Битове |: Десетично число |: Буква @@ -137,7 +145,7 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. |: 11010 |: 26 -|: [*шпация*] +|: {i шпация} |: 11011 |: 27 @@ -160,22 +168,24 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. |: ! -Тоест ако в нашия тип данни запазваме само 10 бита, тогава числото "2" ще бъде [`0000000010`] и имаме низа "AC". + +Тоест ако в нашия тип данни запазваме само 10 бита, тогава числото "2" ще бъде {` 0000000010} и имаме низа "AC". Игнорирайте старшите битове, които остават като "остатък" (по-малко от 5 бита ширина). .question Колко бита наистина запазваме в нашия тип данни? Колко бита ще трябва да игнорираме? Колко най-много букви може да поберем? Имплементирайте функция: -[`decodeNumberText`] - приема ред от таблица Б и указател към "низ"; не връща нищо\n +{` decodeNumberText} - приема ред от таблица Б и указател към "низ"; не връща нищо\n Записва декодиран текстът от реда в указателя .question Нарочно има кавички около думата "низ", какъв трябва наистина да е типа на указателя? \n -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Извикване |= Резултат @@ -189,12 +199,13 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. |: decodedText = "!. ,:?!. ,:?" + ### г) числов текст (част две) Дотук добре, обаче не сме свършили съвсем. -От гледна точка на сигурност, искаме дори някой да получи достъп до таблица Б, да не може да разбере текста дори след като е използвал [`decodeNumberText`]. +От гледна точка на сигурност, искаме дори някой да получи достъп до таблица Б, да не може да разбере текста дори след като е използвал {` decodeNumberText}. -Ще използваме [url https://en.wikipedia.org/wiki/Caesar_cipher шифъра на Цезар]: един много прост шифър, където отместваме позицията на всяка буква с няколко места "напред". +Ще използваме {url шифъра на Цезар;https://en.wikipedia.org/wiki/Caesar_cipher}: един много прост шифър, където отместваме позицията на всяка буква с няколко места "напред". Тоест, при отместаване 3, буквата A става D, B става E, и так. нат. Как декодираме? Отместваме буквите назад, тоест ако имаме текста "KHOOR" и ви кажа, че съм го кодирал като съм отместил всяка буква напред с 3 позиции, тогава при декодиране от K става на H, от H става на E, от О става на L и от R става на O. @@ -205,13 +216,14 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. Промененте функцията: -[`decodeNumberText`] - приема ред от таблица Б, стойност от таблица А и указател към "низ"; не връща нищо\n +{` decodeNumberText} - приема ред от таблица Б, стойност от таблица А и указател към "низ"; не връща нищо\n След като декодира текста от реда от Б, дешифрира го със стойността от таблица А \n -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Извикване |= Резултат @@ -237,6 +249,7 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. |: decodedText = "!. ,:?!., :?" + ### д) масив (част едно) Ако типа е "2", тогава в реда от Б сме вложили масив от стойности (числа). @@ -246,13 +259,14 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. Имплементирайте функцията: -[`decodeArray`] - приема ред от таблица Б и указател към масив; не връща нищо\n +{` decodeArray} - приема ред от таблица Б и указател към масив; не връща нищо\n Декодира елементите от реда и ги запазва в указателя \n -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Извикване |= Резултат @@ -260,6 +274,7 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. |: arr = { 0, 11, 11, 15, 0, 10, 9, 10, 0, 0, 15, 5, 3, 11, 15, 0 } + ### е) масив (част две) От гледна точка на сигурност или оптимизране на памет, искаме да "лимитираме" какви стойности са валидни, и всички невалидни да станат някоя друга стойност по подразбиране. @@ -267,21 +282,22 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. В старшите 20 бита от стойността в таблица А ще пазим общо 5 възможни валидни стойности, а в останалите (младши) 3 бита ще пазим индекс към тези стойности, който индекс (започвайки от 1) определя стойността по подразбиране. -Пример: ако имаме побитово [`1111100000100011101101010101`], тогава: +Пример: ако имаме побитово {` 1111100000100011101101010101}, тогава: .bulleted -- валидните числа са [`11111, 00000, 10001, 11011 и 01010`] -- числото по подразбиране е 5-тото ([`101 = 5`]), което е числото [`01010`] -- ако от реда в Б изкараме [`11011`], тогава го запазваме, обаче ако изкараме примерно [`11000`] тогава го превръщаме в стойността по подразбиране, а именно [`01010`] +- валидните числа са {` 11111, 00000, 10001, 11011 и 01010} +- числото по подразбиране е 5-тото ({` 101 = 5}), което е числото {` 01010} +- ако от реда в Б изкараме {` 11011}, тогава го запазваме, обаче ако изкараме примерно {` 11000} тогава го превръщаме в стойността по подразбиране, а именно {` 01010} Разширете функцията: -[`decodeArray`] - приема стойност от таблица А, ред от таблица Б и указател към масив; не връща нищо\n +{` decodeArray} - приема стойност от таблица А, ред от таблица Б и указател към масив; не връща нищо\n Декодира елементите от реда, като всички невалидни стойност се превръщат в стойността по подразбиране, и ги запазва в указателя \n -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Извикване |= Резултат @@ -292,6 +308,7 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. |: arr = { 8, 8, 8, 15, 8, 8, 8, 8, 8, 8, 15, 5, 3, 8, 15, 8 } + ### ж) компресирани стойности Ако редът в таблица А е 0, тогава цялата стойност в базата данни е побрана в стойността на таблица А. @@ -306,15 +323,15 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. .comment 000 001 010 011 100 101 :bulleted -- Kриптографски ред е [`00000, 10101, 11011, 10001, 01101, 10100`] +- Kриптографски ред е {` 00000, 10101, 11011, 10001, 01101, 10100} .bulleted - Индексираме от 0 до 5, което побитово е от 000 до 101 -- Стойност в таблицата А е [`011001000001101101`] +- Стойност в таблицата А е {` 011001000001101101} .bulleted - - Разделяйки го на индекси, това са [`011, 001, 000, 001, 101, 101`] + - Разделяйки го на индекси, това са {` 011, 001, 000, 001, 101, 101} -- Слепвайки от криптографския ред на тези индекси получаваме [`100011010100000101011010010100`] +- Слепвайки от криптографския ред на тези индекси получаваме {` 100011010100000101011010010100} Във вашата програма ще се наложи да направите още една променлива, в която пазите криптографския ред. @@ -326,12 +343,13 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. Напишете функция: -[`decompress`] - приема стойност от таблица А, криптографски ред, указател за запазване на декомпресираната стойност от таблица А и указател за запазване на декомпресирания ред от таблица Б; не връща нищо +{` decompress} - приема стойност от таблица А, криптографски ред, указател за запазване на декомпресираната стойност от таблица А и указател за запазване на декомпресирания ред от таблица Б; не връща нищо \n -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Извикване |= Резултат @@ -342,6 +360,7 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. |: decompA = 8388607, decompB = 18446744073709551615 + ### з) входни данни В началото на програмата получавате броя на редове от таблица А (между 1 и 16), след това толкова "реда". @@ -352,22 +371,22 @@ GitHub classroom: [url https://classroom.github.com/a/nlFuKALw classroom.github. След това получавате команди (знак): .bulleted -- [`g X`]: изкарвате на екрана стойността в базата данни, започвайки с ред X от таблица А -- [`i`]: Връщате информация за базата данни -- [`q`]: спиране на програмата +- {` g X}: изкарвате на екрана стойността в базата данни, започвайки с ред X от таблица А +- {` i}: Връщате информация за базата данни +- {` q}: спиране на програмата ### й) заявки .bulleted -- [`t X`]: връщате броя и след това всички редове от таблица А с тип X -- [`r X`]: връщате броя и всички редове от таблица А, които използват реда Х\n +- {` t X}: връщате броя и след това всички редове от таблица А с тип X +- {` r X}: връщате броя и всички редове от таблица А, които използват реда Х\n Ако реда е 0, тогава трябва да върнете и размера на криптографския ред ### к) презаписване в базата данни .bulleted -- [`w T R V`]: запазвате (презаписвате) стойност V в таблица Т (може да бъде [`A`] или [`B`]) на ред R -- [`s T V`]: запазвате стойност V от тип Т в базата данни\n +- {` w T R V}: запазвате (презаписвате) стойност V в таблица Т (може да бъде {` A} или {` B}) на ред R +- {` s T V}: запазвате стойност V от тип Т в базата данни\n Пробвате се да я запазите, използвайки и двете таблици, но ако Б вече е запълнена, добавяте я като компресирана стойност в таблица А. Ако и А е запълнена, изкарвате съобщение за запълнена база данни и не запазвате стойността. diff --git a/src/teaching/upp-2023/additional2/index.du b/src/teaching/upp-2023/additional2/index.du index 953288a..4a4121d 100644 --- a/src/teaching/upp-2023/additional2/index.du +++ b/src/teaching/upp-2023/additional2/index.du @@ -1,8 +1,11 @@ -# Допълнително упражнение 2 - УПП, 04.12.2023 +'def title Допълнително упражнение 2 - УПП, 04.12.2023 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/CrerXpf6 classroom.github.com/a/CrerXpf6] +GitHub classroom: {url classroom.github.com/a/CrerXpf6;https://classroom.github.com/a/CrerXpf6} .important Следете внимателно дали триете всичката си динамична памет коректно на всяка подточка! @@ -12,7 +15,7 @@ GitHub classroom: [url https://classroom.github.com/a/CrerXpf6 classroom.github. Ще направим един прост текстов редактор. От входа ще получавате редове текст, в общия случай редовете ще бъдат някакво текстово съдъражение, което ще трябва да запазите в паметта. -Определени редове ще имат команди, чрез които ще [*редактирате*] вече въведения текст. +Определени редове ще имат команди, чрез които ще {i редактирате} вече въведения текст. Задачата е сравнително голяма, затова е разделена на подточки, като всяка надгражда предходната. @@ -26,12 +29,13 @@ GitHub classroom: [url https://classroom.github.com/a/CrerXpf6 classroom.github. Използвайте многомерен масив за запазване на редовете, вместо всичко да се запазва в един голям низ. Това е нужно за бъдещи подточки. -[*Само за тестване*], набързо имплементирайте проверка, ако първата буква от реда е [`Q`], тогава програмата да спре да приема вход, да изкара въведения текст до сега и да приключи. +{i Само за тестване}, набързо имплементирайте проверка, ако първата буква от реда е {` Q}, тогава програмата да спре да приема вход, да изкара въведения текст до сега и да приключи. -[=Пример:=] -[*Смесен вход/изход*] +{b Пример:} +{i Смесен вход/изход} -```terminal +'def LANG terminal +``` DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high earth-bank where a little-traveled trail led east through the pine for- @@ -44,7 +48,7 @@ est. It was a high bank, and he paused to breathe at the top. ### б) функция за извеждане на команди -Команда е един ред текст, като първата буква, различна от шпация, е [`:`]. +Команда е един ред текст, като първата буква, различна от шпация, е {` :}. След нея има нула или повече шпации и още една буква, тази буква определя коя команда искаме да използваме. В зависимост от командата, може да имаме параметри, поставени след буквата за командата. Параметрите не съдържат шпации и параметрите са разделени помежду си с поне една шпация. @@ -55,7 +59,7 @@ est. It was a high bank, and he paused to breathe at the top. Командите не се запазват като част от текста. -Имплементирайте функция [`extractCommand`], която приема низ. +Имплементирайте функция {` extractCommand}, която приема низ. Ако низът е команда, тогава връща масив от низове, първия от които съдържа буквата, определяща командата, докато останалите низове са параметрите. Ако низът не е команда, тогава връща празен масив. @@ -65,13 +69,15 @@ est. It was a high bank, and he paused to breathe at the top. .question Как ще върнем масив? Нужно ли е да връщаме бройката елементи? -[*Само за тестване*], след всеки въведен ред, ако е команда, изкарайте извлечените стойности от [`extractCommand`], със запетайки след всяка. -Като при [url #section подточка a)], ако редът започва с [`Q`], спирате приемане на вход и изкарвате запазения текст. +{i Само за тестване}, след всеки въведен ред, ако е команда, изкарайте извлечените стойности от {` extractCommand}, със запетайки след всяка. +Като при {url подточка a);#section}, ако редът започва с {` Q}, спирате приемане на вход и изкарвате запазения текст. -[=Пример:=] -[*Смесен вход/изход*] +{b Пример:} +{i Смесен вход/изход} -```terminal +'def LANG terminal +``` +'emplace DAY HAD DAWNED COLD AND GRAY WHEN :A bcd 012 345 A,bcd,012,345, @@ -91,57 +97,63 @@ DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high earth-bank where a little-traveled trail led east through the pine for- est. It was a high bank, and he paused to breathe at the top. +'endemplace ### в) команда print -Имплементирайте функция [`print`], която приема масив, съдържащ целия запазен текст, и го изкарва на екрана, като преди всеки ред изкарва неговия номер (първи ред има номер 1, втори има номер 2, так. нат.) с [=вмъкнати водещи нули=] (така че всяко число да бъде съставено от един и същ брой знаци). +Имплементирайте функция {` print}, която приема масив, съдържащ целия запазен текст, и го изкарва на екрана, като преди всеки ред изкарва неговия номер (първи ред има номер 1, втори има номер 2, так. нат.) с {b вмъкнати водещи нули} (така че всяко число да бъде съставено от един и същ брой знаци). Ако текстът е празен, не изкарва нищо. -Тоест, ако сме въвели текст от 7 реда, [`print`] ще изкара: +Тоест, ако сме въвели текст от 7 реда, {` print} ще изкара: -```terminal +'def LANG terminal +``` 1 First line 2 Second line -... +\... 7 Last line Ако сме въвели 23 реда: -```terminal +'def LANG terminal +``` 01 First line 02 Second line -... +\... 09 Ninth line 10 Tenth line 11 Eleventh line -... +\... 23 Last line Ако сме въвели 130 реда: -```terminal +'def LANG terminal +``` 001 First line -... +\... 009 Ninth line 010 Tenth line -... +\... 099 99th line 100 100th line -... +\... 130 Last line -Командата, която използва тази функция, се определя с главната буква [`P`] и няма параметри. +Командата, която използва тази функция, се определя с главната буква {` P} и няма параметри. -За всички команди (за момента само [`P`]): +За всички команди (за момента само {` P}): .bulleted - Обновете програмата, така че при валидна команда, да изпълни съответната и функция и да продължи изпълнение. - Ако срещнете недефинирана команда, трябва да изкарате на екрана "; Not an editor command" и изпълнението на програмата да продължи. - Ако срещнете допълнителни/излишни параметри, трябва да изкарате "; Excess parameters", но функцията да се изпълни с коректния брой параметри. -[=Пример:=] -[*Смесен вход/изход*] +{b Пример:} +{i Смесен вход/изход} -```terminal +'def LANG terminal +``` +'emplace DAY HAD DAWNED COLD AND GRAY WHEN :P 1 DAY HAD DAWNED COLD AND GRAY WHEN @@ -160,41 +172,48 @@ DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high earth-bank where a little-traveled trail led east through the pine for- est. It was a high bank, and he paused to breathe at the top. +'endemplace ### г) команда quit -Вече може да премахнете временната функционалност, където ако реда започва с [`Q`] програмата спира и изкарва целия текст. -Добавете командата [`Q`], която изкарва на екрана целия текст (без номера на редове) и спира програмата. +Вече може да премахнете временната функционалност, където ако реда започва с {` Q} програмата спира и изкарва целия текст. +Добавете командата {` Q}, която изкарва на екрана целия текст (без номера на редове) и спира програмата. -[=Примери:=] -[*Смесен вход/изход*] +{b Примери:} +{i Смесен вход/изход} -```terminal +'def LANG terminal +``` +'emplace DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high :Q DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high +'endemplace -```terminal +'def LANG terminal +``` +'emplace DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high :Q 1 2 3 ; Excess parameters DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high +'endemplace ### д) команда delete -Имплементирайте функцията [`deleteRow`], която получава целия текст, въведен до сега, и номер на реда (редовете се индексират от 1 до N). +Имплементирайте функцията {` deleteRow}, която получава целия текст, въведен до сега, и номер на реда (редовете се индексират от 1 до N). Тя променя текста, като премахва реда на дадения номер. -.important Не забравяйте да промените размера на масива с низове! Не е решение просто да промените указателя към дадения ред на [`nullptr`], не искаме да използваме излишна памет. +.important Не забравяйте да промените размера на масива с низове! Не е решение просто да промените указателя към дадения ред на {` nullptr}, не искаме да използваме излишна памет. .question Какъв ще бъде типа на аргумента, който приема целия текст? -Добавете командата [`D`], която приема един параметър - цяло положително число, и го прилага върху функцията [`deleteRow`]. +Добавете командата {` D}, която приема един параметър - цяло положително число, и го прилага върху функцията {` deleteRow}. Ако номера на реда е невалиден, трябва да изкарате съобщение "; Invalid row number". Имплементирайте следните функционалности за всички команди: @@ -203,10 +222,12 @@ the man turned aside from the main Yukon trail. He climbed the high - Ако даден параметър на команда е от невалиден тип (подадени букви, когато се иска число, примерно), изкарайте "; Invalid parameter type". Единствените типове на параметри са цели числа и произволни низове (без шпации). -[=Пример:=] -[*Смесен вход/изход*] +{b Пример:} +{i Смесен вход/изход} -```terminal +'def LANG terminal +``` +'emplace dAY HAD DAWNED COLD AND GRAY WHEN :P 1 dAY HAD DAWNED COLD AND GRAY WHEN @@ -237,21 +258,24 @@ est. It was a high bank, and he paused to breathe at the top. DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high earth-bank where a little-traveled trail led east through the pine for- +'endemplace ### e) команда insert -Имплементирайте функция [`insertRow`], която приема целия текст, низ и номер на реда. -Функцията вмъква низа в целия текст като ред [=над=] този на подадения номер. +Имплементирайте функция {` insertRow}, която приема целия текст, низ и номер на реда. +Функцията вмъква низа в целия текст като ред {b над} този на подадения номер. Ако номерът е над броя въведени редове до сега, редът се вмъква като последен. -Добавете команда [`O`], която приема един параметър - неотрицателен ред. -Следващия написан ред ще се вмъкне преди реда на дадения номер, използвайки функцията [`insertRow`]. +Добавете команда {` O}, която приема един параметър - неотрицателен ред. +Следващия написан ред ще се вмъкне преди реда на дадения номер, използвайки функцията {` insertRow}. Ако номера е невалиден изкарва "; Invalid row number". -[=Пример:=] -[*Смесен вход/изход*] +{b Пример:} +{i Смесен вход/изход} -```terminal +'def LANG terminal +``` +'emplace the man turned aside from the main Yukon trail. He climbed the high :P 1 the man turned aside from the main Yukon trail. He climbed the high @@ -282,24 +306,27 @@ He excused 3 earth-bank where a little-traveled trail led east through the pine for- 4 est. It was a high bank, and he paused to breathe at the top. 5 He excused +'endemplace ### ж) команда join -Имплементирайте функция [`joinRows`], която приема текстът, въведен до сега, и номер на ред N. +Имплементирайте функция {` joinRows}, която приема текстът, въведен до сега, и номер на ред N. Функцията вмъква текста от ред N+1 в края на ред N, като ги разделя с една шпация. Ред N+1 се изтрива. Ако N е 0 или номера на последния ред, не прави нищо. -.important Не забравяйте да промените размера на масива с низове! Не е решение просто да промените указателя към дадения ред на [`nullptr`], не искаме да използваме излишна памет. +.important Не забравяйте да промените размера на масива с низове! Не е решение просто да промените указателя към дадения ред на {` nullptr}, не искаме да използваме излишна памет. -Добавете команда [`J`], която приема номер на ред - положително число. -Следващия ред ще се вмъкне в края на сегашния, с една шпация между тях, използвайки функцията [`joinRows`]. +Добавете команда {` J}, която приема номер на ред - положително число. +Следващия ред ще се вмъкне в края на сегашния, с една шпация между тях, използвайки функцията {` joinRows}. При подаден невалиден ред изкарвате "; Invalid row number". -[=Пример:=] -[*Смесен вход/изход*] +{b Пример:} +{i Смесен вход/изход} -```terminal +'def LANG terminal +``` +'emplace DAY HAD DAWNED COLD AND GRAY WHEN @@ -325,21 +352,24 @@ the man turned aside from the main Yukon trail. He climbed the high :Q DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high +'endemplace ### з) команда word info -Имплементирайте функция [`wordOccurrences`], която приема целия текст и дума (низ без шпации). +Имплементирайте функция {` wordOccurrences}, която приема целия текст и дума (низ без шпации). Тя изкарва на екрана броя на срещания на дадената дума в целия текст, като изхода е във формата "; N occurrences" (където N е броя на срещания). -[*Подсказвам, че за следващата подточка ще е полезно ако първо имплементирате функция, която връща броя срещания на дума в един ред.*] +{i Подсказвам, че за следващата подточка ще е полезно ако първо имплементирате функция, която връща броя срещания на дума в един ред.} -Добавете команда [`n`], която приема един аргумент - низ беш шпации. -Използвайки [`wordOccurrences`] изкарва броя срещания на дадена дума в целия текст. +Добавете команда {` n}, която приема един аргумент - низ беш шпации. +Използвайки {` wordOccurrences} изкарва броя срещания на дадена дума в целия текст. -[=Пример:=] -[*Смесен вход/изход*] +{b Пример:} +{i Смесен вход/изход} -```terminal +'def LANG terminal +``` +'emplace DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high earth-bank where a little-traveled trail led east through the pine for- @@ -357,18 +387,21 @@ DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high earth-bank where a little-traveled trail led east through the pine for- est. It was a high bank, and he paused to breathe at the top. +'endemplace ### и) команда word substitute -Имплементирайте функция [`substituteWord`], която приема целия текст и две думи (низове без шпации). +Имплементирайте функция {` substituteWord}, която приема целия текст и две думи (низове без шпации). В текстът, всяко срещане на първата дума е заменено с втората дума. .question Какво ще стане с размера на един ред, ако някоя дума/някои думи трябва да се заменят? -Добавете команда [`s`], която приема две думи - низове без шпации. -Използвайки функцията [`substituteWord`] замества всяко срещане на първата дума с втората. +Добавете команда {` s}, която приема две думи - низове без шпации. +Използвайки функцията {` substituteWord} замества всяко срещане на първата дума с втората. -```terminal +'def LANG terminal +``` +'emplace DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high earth-bank where a little-traveled trail led east through the pine for- @@ -394,26 +427,29 @@ DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high earth-bank where a little-traveled trail led east through the pine for- est. It was a high bank, and he paused to breathe at the top. +'endemplace ### й) команда word delete -Имплементирайте функция [`deleteWord`], която приема целия текст и дума (низ без шпации). -В текстът, всяко срещане на думата, заедно с [*излишните*] шпации около нея, са премахнати. +Имплементирайте функция {` deleteWord}, която приема целия текст и дума (низ без шпации). +В текстът, всяко срещане на думата, заедно с {i излишните} шпации около нея, са премахнати. Ето в кои случаи шпации са излишни (където "WORD" е подадената дума, която ще изтрием, а "\_" е някаква буква, която не е шпация): .bulleted -- [`WORD _`] (WORD е в началото на реда или има знаци преди нея) - шпацията след думата е излишна, трябва да стане [`_`]. - Отбелязвам, че шпациите в ляво се запазват: [` WORD _`] става [` _`]. -- [`_ WORD`] (WORD е в края на реда или има знаци след нея) - шпацията преди думата е излишна, трябва да стане [`_`]. -- [`_ WORD _`] - шпацията, която следва думата, е излишна, тоест трябва да стане [`_ _`]. - Трябва да отбележа, че шпациите в ляво се запазват така както са: [`_ WORD _`] става [`_ _`]. +- {` WORD _} (WORD е в началото на реда или има знаци преди нея) - шпацията след думата е излишна, трябва да стане {` _}. + Отбелязвам, че шпациите в ляво се запазват: {` WORD _} става {` _}. +- {` _ WORD} (WORD е в края на реда или има знаци след нея) - шпацията преди думата е излишна, трябва да стане {` _}. +- {` _ WORD _} - шпацията, която следва думата, е излишна, тоест трябва да стане {` _ _}. + Трябва да отбележа, че шпациите в ляво се запазват така както са: {` _ WORD _} става {` _ _}. Във всичките случаи, като имам предвид "шпацията е излишна", означава че тази шпация, заедно с всички съседни. -Тоест, [`WORD _`] трябва да стане [`_`], а не [` _`]. +Тоест, {` WORD _} трябва да стане {` _}, а не {` _}. -Добавете команда [`d`], която приема един параметър - дума, низ без шпации. -Използвайки функцията [`deleteWord`] премахва самата дума и излишните шпации. +Добавете команда {` d}, която приема един параметър - дума, низ без шпации. +Използвайки функцията {` deleteWord} премахва самата дума и излишните шпации. -```terminal +'def LANG terminal +``` +'emplace DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail. He climbed the high earth-bank where a little-traveled trail led east through the pine for- @@ -424,3 +460,4 @@ DAY HAD DAWNED COLD AND GRAY WHEN man turned aside from main Yukon trail. He climbed high earth-bank where a little-traveled trail led east through pine for- est. It was a high bank, and he paused to brea at top. +'endemplace diff --git a/src/teaching/upp-2023/index.du b/src/teaching/upp-2023/index.du index 50ced66..4614528 100644 --- a/src/teaching/upp-2023/index.du +++ b/src/teaching/upp-2023/index.du @@ -1,4 +1,7 @@ -# Увод в програмирането - практикум, Компютърни науки, 8 група +'def title Увод в програмирането - практикум, Компютърни науки, 8 група +'def desc Материали на проведените през 2023/2024 практикуми по Увод в програмирането на Компютърни науки (2 поток), 8 група. + +# {title} Материали на проведените през 2023/2024 практикуми по Увод в програмирането на Компютърни науки (2 поток), 8 група. @@ -6,81 +9,82 @@ От сега нататък ще може да продължите да предавате решения след крайния срок в classroom. Не мога да гарантирам кога ще погледна предадени решения след срока, но ще ги погледна! -[=Зала:=] ФМИ 309 || -[=Време:=] 10:15 - 12:00 || -[=Ден:=] Петък -\n -[=Директни връзки:=] -[url ./week1/welcome.html?a#section-4 Контакт с мен] | -[url https://github.com/Syndamia/upp-2023-solutions Решения на задачи] | -[url https://github.com/ivanahristova/introduction-to-programming-2023-2024 Материали от семинари] | -[url https://learn.fmi.uni-sofia.bg/course/view.php?id=9567 Курс в мудъл] +{b Зала:} ФМИ 309 || +{b Време:} 10:15 - 12:00 || +{b Ден:} Петък +<br/> +{b Директни връзки:} +{url Контакт с мен;./week1/welcome.html?a#section-4} | +{url Решения на задачи;https://github.com/Syndamia/upp-2023-solutions} | +{url Материали от семинари;https://github.com/ivanahristova/introduction-to-programming-2023-2024} | +{url Курс в мудъл;https://learn.fmi.uni-sofia.bg/course/view.php?id=9567} -:table_3 +:table +:3 |= № |= Дата |= Материали |: 1 |: 06.10.2023 -|: [url ./week1/welcome.html Добре дошли] \|\| [url ./week1/setup.html?a Конфигуриране на GitHub classroom и Visual Studio] \|\| [url ./week1/?a Задачи] \|\| [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week01 Решения] +|: {url Добре дошли;./week1/welcome.html} || {url Конфигуриране на GitHub classroom и Visual Studio;./week1/setup.html?a} || {url Задачи;./week1/?a} || {url Решения;https://github.com/Syndamia/upp-2023-solutions/tree/main/week01} |: 2 |: 13.10.2023 -|: [url ./week2/revision.html?a Преговор] \|\| [url ./week2 Задачи] \|\| [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week02 Решения] +|: {url Преговор;./week2/revision.html?a} || {url Задачи;./week2} || {url Решения;https://github.com/Syndamia/upp-2023-solutions/tree/main/week02} |: 3 |: 20.10.2023 -|: [url ./week3/revision.html?a Преговор] \|\| [url ./week3 Задачи] \|\| [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week03 Решения] +|: {url Преговор;./week3/revision.html?a} || {url Задачи;./week3} || {url Решения;https://github.com/Syndamia/upp-2023-solutions/tree/main/week03} |: 4 |: 27.10.2023 -|: [url ./week4/revision.html?a Преговор] \|\| [url ./week4 Задачи] \|\| [url https://classroom.github.com/a/jqKaO1ny GitHub classroom] \|\| [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week04 Решения (само 1ва)] +|: {url Преговор;./week4/revision.html?a} || {url Задачи;./week4} || {url GitHub classroom;https://classroom.github.com/a/jqKaO1ny} || {url Решения (само 1ва);https://github.com/Syndamia/upp-2023-solutions/tree/main/week04} |: 5 |: 03.11.2023 -|: [url ./week5/revision.html Преговор] \|\| [url ./week5 Задачи] \|\| [url https://classroom.github.com/a/3KoIQ71H GitHub classroom] \|\| [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week05 Решения] +|: {url Преговор;./week5/revision.html} || {url Задачи;./week5} || {url GitHub classroom;https://classroom.github.com/a/3KoIQ71H} || {url Решения;https://github.com/Syndamia/upp-2023-solutions/tree/main/week05} |: |: 04.11.2023 -|: [url ./additional1/ Допълнително упражнение 1] \|\| [url https://classroom.github.com/a/nlFuKALw GitHub classroom] \|\| [url https://github.com/Syndamia/upp-2023-solutions/blob/main/additional1/exercise.cpp Решение] +|: {url Допълнително упражнение 1;./additional1/} || {url GitHub classroom;https://classroom.github.com/a/nlFuKALw} || {url Решение;https://github.com/Syndamia/upp-2023-solutions/blob/main/additional1/exercise.cpp} |: 6 |: 10.11.2023 -|: [url ./week6 Задачи] \|\| [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week06 Решения] \|\| [url https://classroom.github.com/a/BBLlWMOy GitHub classroom] +|: {url Задачи;./week6} || {url Решения;https://github.com/Syndamia/upp-2023-solutions/tree/main/week06} || {url GitHub classroom;https://classroom.github.com/a/BBLlWMOy} |: 7 |: 17.11.2023 -|: [url ./week7 Задачи] \|\| [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week07 Решения] \|\| [url https://classroom.github.com/a/m5M2_CWD GitHub classroom] +|: {url Задачи;./week7} || {url Решения;https://github.com/Syndamia/upp-2023-solutions/tree/main/week07} || {url GitHub classroom;https://classroom.github.com/a/m5M2_CWD} |: 8 |: 24.11.2023 -|: [url ./week8 Задачи] \|\| [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week08 Решения] \|\| [url https://classroom.github.com/a/Big7FRUG GitHub classroom] +|: {url Задачи;./week8} || {url Решения;https://github.com/Syndamia/upp-2023-solutions/tree/main/week08} || {url GitHub classroom;https://classroom.github.com/a/Big7FRUG} |: 9 |: 01.12.2023 -|: [url ./week9 Задачи] \|\| [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week09 Решения] \|\| [url https://classroom.github.com/a/lGXxCRZO GitHub classroom] +|: {url Задачи;./week9} || {url Решения;https://github.com/Syndamia/upp-2023-solutions/tree/main/week09} || {url GitHub classroom;https://classroom.github.com/a/lGXxCRZO} |: |: 04.12.2023 -|: [url ./additional2/ Допълнително упражнение 2] \|\| [url https://github.com/Syndamia/upp-2023-solutions/tree/main/additional2 Решения] \|\| [url https://classroom.github.com/a/CrerXpf6 GitHub classroom] +|: {url Допълнително упражнение 2;./additional2/} || {url Решения;https://github.com/Syndamia/upp-2023-solutions/tree/main/additional2} || {url GitHub classroom;https://classroom.github.com/a/CrerXpf6} |: 10 |: 15.12.2023 -|: [url ./week10 Задачи] \|\| [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week10 Решения] \|\| [url https://classroom.github.com/a/EJcTQRz4 GitHub classroom] +|: {url Задачи;./week10} || {url Решения;https://github.com/Syndamia/upp-2023-solutions/tree/main/week10} || {url GitHub classroom;https://classroom.github.com/a/EJcTQRz4} |: 11 |: 22.12.2023 -|: [url ./week11 Задачи] \|\| [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week11 Решения] \|\| [url https://classroom.github.com/a/cZRnZj9y GitHub classroom] +|: {url Задачи;./week11} || {url Решения;https://github.com/Syndamia/upp-2023-solutions/tree/main/week11} || {url GitHub classroom;https://classroom.github.com/a/cZRnZj9y} |: 12 |: 05.01.2024 -|: [url ./week12 Задачи] \|\| [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week12 Решения] \|\| [url https://classroom.github.com/a/KEDSxDjl GitHub classroom] +|: {url Задачи;./week12} || {url Решения;https://github.com/Syndamia/upp-2023-solutions/tree/main/week12} || {url GitHub classroom;https://classroom.github.com/a/KEDSxDjl} |: 13 |: 12.01.2024 -|: [url ./week13 Задачи] \|\| [url https://classroom.github.com/a/bgiFD6SB GitHub classroom] +|: {url Задачи;./week13} || {url GitHub classroom;https://classroom.github.com/a/bgiFD6SB} |: 14 |: 19.01.2024 -|: [url ./week14 Задачи] \|\| [url https://classroom.github.com/a/B08TtnnW GitHub classroom] +|: {url Задачи;./week14} || {url GitHub classroom;https://classroom.github.com/a/B08TtnnW} diff --git a/src/teaching/upp-2023/week1/index.du b/src/teaching/upp-2023/week1/index.du index e41a297..0a16843 100644 --- a/src/teaching/upp-2023/week1/index.du +++ b/src/teaching/upp-2023/week1/index.du @@ -1,16 +1,19 @@ -# Задачи - УПП, Седмица 1, 06.10.2023 +'def title Задачи - УПП, Седмица 1, 06.10.2023 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/W7hZDMgC classroom.github.com/a/W7hZDMgC] +GitHub classroom: {url classroom.github.com/a/W7hZDMgC;https://classroom.github.com/a/W7hZDMgC} -Решения: [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week01 GitHub] +Решения: {url GitHub;https://github.com/Syndamia/upp-2023-solutions/tree/main/week01} ### 1 задача - Hello, World! Още от "древни" времена програмистите са си измисляли малки програмки, с които да тестват дали всичко работи. -Традиция в модерното време е да изкараш на екрана съобщението [url https://en.wikipedia.org/wiki/%22Hello,_World!%22_program#History "Hello, World!"]. -Това е главно популяризирано от книгата [url https://en.wikipedia.org/wiki/The_C_Programming_Language The C Programming Language], централния материал върху езика С (един от най-значимите езици за програмиране някога). +Традиция в модерното време е да изкараш на екрана съобщението {url "Hello, World!";https://en.wikipedia.org/wiki/%22Hello,_World!%22_program#History}. +Това е главно популяризирано от книгата {url The C Programming Language;https://en.wikipedia.org/wiki/The_C_Programming_Language}, централния материал върху езика С (един от най-значимите езици за програмиране някога). Изкарайте на екрана съобщението "Hello, World!". @@ -18,9 +21,10 @@ GitHub classroom: [url https://classroom.github.com/a/W7hZDMgC classroom.github. Във входа получавате цифра, трябва да върнете нейната числена стойност, умножена по две. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -31,7 +35,8 @@ GitHub classroom: [url https://classroom.github.com/a/W7hZDMgC classroom.github. |: 16 -[=Упътване:=] + +{b Упътване:} Цифрата е просто знак, и за да извършите коректно умножението трябва да превърнете знака в число. ### 3 задача - От Фаренхайт в Целзий @@ -43,9 +48,10 @@ GitHub classroom: [url https://classroom.github.com/a/W7hZDMgC classroom.github. ``` C = (F - 32) * 5/9 -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход diff --git a/src/teaching/upp-2023/week1/setup.du b/src/teaching/upp-2023/week1/setup.du index 6b22df6..e1d2f30 100644 --- a/src/teaching/upp-2023/week1/setup.du +++ b/src/teaching/upp-2023/week1/setup.du @@ -1,8 +1,11 @@ -# Конфигуриране на GitHub classroom и Visual Studio - УПП, Седмица 1, 06.10.2023 +'def title Конфигуриране на GitHub classroom и Visual Studio - УПП, Седмица 1, 06.10.2023 +'def desc Постъпково упътване към настройване на всичко нужно за практикума + +# {title} \n -[$presentation-controller] +{presentation-controller} :title_slide @@ -30,20 +33,20 @@ ### Git -[$br1] +{br1} .p -git е програма (система) за [url https://en.wikipedia.org/wiki/Distributed_version_control контрол на версиите]. -В един проект, git пази [=списък от всички commit-и=]. -Един commit в себе си [=съдържа какви са точно промените=], кой ги е направил, кога са направени, защо са направени и так. нат. -Този списък, заедно с още неща за които не е нужно да мислите, се нарича [=repository=]. +git е програма (система) за {url контрол на версиите;https://en.wikipedia.org/wiki/Distributed_version_control}. +В един проект, git пази {b списък от всички commit-и}. +Един commit в себе си {b съдържа какви са точно промените}, кой ги е направил, кога са направени, защо са направени и так. нат. +Този списък, заедно с още неща за които не е нужно да мислите, се нарича {b repository}. .p -Обаче, [=commit-ове не се правят автоматично=], не е като историята с промени в един Word файл. -[=Commit се прави от разработчика=], и то за предпочитане на всеки няколко (свързани) промени. +Обаче, {b commit-ове не се правят автоматично}, не е като историята с промени в един Word файл. +{b Commit се прави от разработчика}, и то за предпочитане на всеки няколко (свързани) промени. .p -Така, когато смесваме кода от многото разработчици, ще можем да засечем [=какви точно са различията=] между работата на двама човека.\n +Така, когато смесваме кода от многото разработчици, ще можем да засечем {b какви точно са различията} между работата на двама човека.\n Често промените не си "противоречат" и могат да бъдат смесени директно, понякога се налага ръчно да решим какво точно да се случи с тези парчета код. @@ -51,11 +54,11 @@ git е програма (система) за [url https://en.wikipedia.org/wiki ### GitHub -[$br5] +{br5} .p Всички repository-та трябва да се пазят някъде и да може лесно да се споделят и гледат. -Има много сайтове за тази цел, най-популярния се нарича [url https://github.com GitHub]. +Има много сайтове за тази цел, най-популярния се нарича {url GitHub;https://github.com}. .p Напомням, че git и GitHub са напълно отделни неща, направени от различни хора с различни функционалности. @@ -67,9 +70,9 @@ git е програма (система) за [url https://en.wikipedia.org/wiki ## Сега всички трябва да си направят GitHub акаунти .p -Отивате на [url https://github.com/signup github.com/signup], въвеждате си данните една по една и се регистрирате +Отивате на {url github.com/signup;https://github.com/signup}, въвеждате си данните една по една и се регистрирате -.p [image ./img/github-signup.gif] +.p {img ./img/github-signup.gif} :middle_slide @@ -77,7 +80,7 @@ git е програма (система) за [url https://en.wikipedia.org/wiki .p След това, като влезете в акаунтите си (което става автоматично след регистрация), на заглавната страница ще имате нещо такова: -.width75% [image ./img/github-index.gif] +.width75% {img ./img/github-index.gif} .p В горния десен ъгъл, където е иконката с квадрати на бял фон, след натискане получавате sidebar. @@ -94,24 +97,24 @@ git е програма (система) за [url https://en.wikipedia.org/wiki .p Най-простия начин, който намерих, е да отворите -[url https://support.github.com/contact/reinstatement support.github.com/contact/reinstatement]\n +{url support.github.com/contact/reinstatement;https://support.github.com/contact/reinstatement}\n Ако отгоре пише "Your account has been flagged", тогава имаме проблем. .p -[image ./img/github-support-flagged.gif] +{img ./img/github-support-flagged.gif} :slide ## GitHub classroom -[$br3] +{br3} .p За всеки практикум ще ви направя линк, чрез който след малко кликане ще се създаде ново лично repository за всеки от вас. .p -До 12:20 трябва да сте качили работата си [=по време=] на упражнението в това repository. +До 12:20 трябва да сте качили работата си {b по време} на упражнението в това repository. GitHub предоставя лесни начини да правите промени по файлове директно чрез браузъра, така че за незаинтересуваните, може да го ползвате като усложнен Google Drive. .p @@ -126,14 +129,14 @@ GitHub предоставя лесни начини да правите пром .p За всяко упражнение ще има отделен линк.\n -Този за днеска е: [url https://classroom.github.com/a/W7hZDMgC classroom.github.com/a/W7hZDMgC] +Този за днеска е: {url classroom.github.com/a/W7hZDMgC;https://classroom.github.com/a/W7hZDMgC} -[$br1] +{br1} :row .p След като го отворите, ще видите съобщение за разрешение, авторизирайте го. -.p [image ./img/github-classroom-authorize.gif] +.p {img ./img/github-classroom-authorize.gif} @@ -141,7 +144,7 @@ GitHub предоставя лесни начини да правите пром :row -.width60% [image ./img/join-the-classroom.gif] +.width60% {img ./img/join-the-classroom.gif} :column @@ -158,12 +161,12 @@ GitHub предоставя лесни начини да правите пром .p След това, би трябвало да видите страницата за "Приемане на заданието". -.width40% [image ./img/accept-assignment.gif] +.width40% {img ./img/accept-assignment.gif} .p След като го приемете, на новата страница, изчакайте няколко секунди и презаредете. Трябва да видите това: -.width40% [image ./img/ready-to-go.gif] +.width40% {img ./img/ready-to-go.gif} :middle_slide @@ -188,24 +191,24 @@ GitHub предоставя лесни начини да правите пром Целта е да видя какво правите и да ви помогна, моля проверявайте какво съм ви писал, по подразбиране би трябвало да получавате известия на имейл-а. .centered -.width80% [image ./img/feedback.gif] +.width80% {img ./img/feedback.gif} :slide ## Къде пишем код? -[$br2] +{br2} .p -[=Кодът е чисто и просто текст=], компилаторът е специалната програма, която превръща този текст в нещо, което може компютъра да изпълни. +{b Кодът е чисто и просто текст}, компилаторът е специалната програма, която превръща този текст в нещо, което може компютъра да изпълни. .p -За писане и редактиране на текст ползваме [=текстови редактори=]. +За писане и редактиране на текст ползваме {b текстови редактори}. Програмистите са искали да улеснят работата си, затова модерните текстови редактори поддържат много помощни функционалности: показване на грешки на точния ред, автоматично форматиране, ... .p -За някои и това не е било достатъчно удобно, затова са създадени [=Integrated Development Environment=] (IDE), програми които съдържат в себе си всичко нужно за разработка на код. +За някои и това не е било достатъчно удобно, затова са създадени {b Integrated Development Environment} (IDE), програми които съдържат в себе си всичко нужно за разработка на код. Тоест, те са текстови редактори, но "вградено" могат да компилират код, да менижират сегашното repository, ... @@ -232,20 +235,20 @@ GitHub предоставя лесни начини да правите пром ### Инсталация -[$br1] +{br1} .p Намираме се в компютърна зала, така че всички предоставени компютри би трябвало вече да са налични на предоставените компютри. За ваши лични машини, ще минем набързо през информацията тук. .p -За Visual Studio Code, отивате на [url https://code.visualstudio.com/Download code.visualstudio.com/Download], избирате своята операционна система (за Уиндоус, ако не сте сигурни, изберете "System Installer x64") и инсталирате. +За Visual Studio Code, отивате на {url code.visualstudio.com/Download;https://code.visualstudio.com/Download}, избирате своята операционна система (за Уиндоус, ако не сте сигурни, изберете "System Installer x64") и инсталирате. .p -За Visual Studio, отивате на [url https://visualstudio.microsoft.com/ visualstudio.microsoft.com], скролвате малко надолу, избирате "Download Visual Studio" и след това "Community 2022". +За Visual Studio, отивате на {url visualstudio.microsoft.com;https://visualstudio.microsoft.com/}, скролвате малко надолу, избирате "Download Visual Studio" и след това "Community 2022". .bulleted 'footnote vs-2022-old-win Може би има трикове с които да инсталирате 2022 версията, но те не са официални и затова няма да го преподам -- Ако искате да ползвате по-стара ОС, като Windows 8.1 или Windows 7 ще трябва да използвате "Community 2019"[$vs-2022-old-win], разликата между версиите не е съществена, затова не се притеснявайте. +- Ако искате да ползвате по-стара ОС, като Windows 8.1 или Windows 7 ще трябва да използвате "Community 2019"{vs-2022-old-win}, разликата между версиите не е съществена, затова не се притеснявайте. :slide @@ -258,7 +261,7 @@ GitHub предоставя лесни начини да правите пром Би трябвало да заема към 11 GB памет и в моето тестване се инсталира за 10тина минути. .centered -.width80% [image ./img/vs-install.gif] +.width80% {img ./img/vs-install.gif} :slide @@ -274,9 +277,9 @@ GitHub предоставя лесни начини да правите пром :width75% :row -.p [image ./img/vs-signin.gif] +.p {img ./img/vs-signin.gif} -.p [image ./img/vs-start-env.gif] +.p {img ./img/vs-start-env.gif} @@ -291,7 +294,7 @@ GitHub предоставя лесни начини да правите пром В лявата колона имате скорошни проекти, в дясната имате начини да създадете нов проект. :centered -:width80% [image ./img/vs-open-recent.gif] +:width80% {img ./img/vs-open-recent.gif} @@ -304,7 +307,7 @@ GitHub предоставя лесни начини да правите пром В този курс ще работим само и единствено с "Console App", затова изберете него и кликнете "Next". :centered -:width75% [image ./img/vs-create-project.gif] +:width75% {img ./img/vs-create-project.gif} @@ -316,7 +319,7 @@ GitHub предоставя лесни начини да правите пром Тук единствено може да искате да промените Project Name и Location, другото не е важно. :centered -:width80% [image ./img/vs-configure-project.gif] +:width80% {img ./img/vs-configure-project.gif} @@ -348,7 +351,7 @@ GitHub предоставя лесни начини да правите пром :centered :width60% -.p [image ./img/vs-general.gif] +.p {img ./img/vs-general.gif} @@ -356,7 +359,7 @@ GitHub предоставя лесни начини да правите пром В Solution Explorer имате всички файлове от проекта (Visual Studio позволява да групирате няколко проекта в едно, наречено Solution, не е нужно да се занимавате). .p -Тук [=единственото важно за вас се намира в папката "Source Files"=]. +Тук {b единственото важно за вас се намира в папката "Source Files"}. В нея ще се намира вашия код, всичко останало са допълнителни неща, които са релевантни за по-големи проекти. @@ -369,7 +372,7 @@ GitHub предоставя лесни начини да правите пром :width50% :fright -.p [image ./img/vs-debug-menu.gif] +.p {img ./img/vs-debug-menu.gif} @@ -377,14 +380,14 @@ GitHub предоставя лесни начини да правите пром .p След малко чакане, би трябвало да излезе един прозорец, който изглежда горе-долу така: -.p [image ./img/vs-console.gif] +.p {img ./img/vs-console.gif} :slide ### Как да дебъгваме с Visual Studio -[$br1] +{br1} .p Bug е когато нещо непланирано се случи в кода. @@ -397,7 +400,7 @@ Visual Studio предоставя много функционалности, к .p При компилиране, ще получим съобщение за грешки по време на компилирането. -.p [image ./img/vs-build-errors.gif] +.p {img ./img/vs-build-errors.gif} :slide @@ -412,7 +415,7 @@ Visual Studio предоставя много функционалности, к Той се появява когато при компилиране получим грешки и изчезва когато няма. :centered -:width70% [image ./img/vs-errors.gif] +:width70% {img ./img/vs-errors.gif} @@ -430,9 +433,9 @@ Visual Studio предоставя много функционалности, к Най-елементарния начин: копирате всичко, след това отивате на вашето GitHub repository, кликвате "Add", после "Create new file". .p -Отгоре на "Name your file..." пишете някакво име, което [=моля да завърша на [`.cpp`]!=] +Отгоре на "Name your file..." пишете някакво име, което {b моля да завърша на {` .cpp}!} Това показва, че файла съдържа код на C++. -Също, когато решавате много задачи и създавате много такива файлове, [=напомням че имената на файловете трябва да са различни.=] +Също, когато решавате много задачи и създавате много такива файлове, {b напомням че имената на файловете трябва да са различни.} .p В "Enter file contents here" пействате копирания код. @@ -441,4 +444,4 @@ Visual Studio предоставя много функционалности, к :middle_slide -## Вече имате достатъчно информация да пишете код сами, [url ./ време е за задачи] +## Вече имате достатъчно информация да пишете код сами, {url време е за задачи;./} diff --git a/src/teaching/upp-2023/week1/welcome.du b/src/teaching/upp-2023/week1/welcome.du index 6821e67..03a3eb4 100644 --- a/src/teaching/upp-2023/week1/welcome.du +++ b/src/teaching/upp-2023/week1/welcome.du @@ -1,15 +1,18 @@ -# Добре дошли - УПП, Седмица 1, 06.10.2023 +'def title Добре дошли - УПП, Седмица 1, 06.10.2023 +'def desc Въведителни думи за практикума и ФМИ + +# {title} \n -[$presentation-controller] +{presentation-controller} :title_slide35 # Добре дошли :width65% -[image_url https://upload.wikimedia.org/wikipedia/commons/3/3c/Chimpanzee_seated_at_typewriter.jpg https://en.wikipedia.org/wiki/Infinite_monkey_theorem] +{url {img https://upload.wikimedia.org/wikipedia/commons/3/3c/Chimpanzee_seated_at_typewriter.jpg};https://en.wikipedia.org/wiki/Infinite_monkey_theorem} @@ -17,17 +20,17 @@ ## Кой съм аз -[$br2] +{br2} :font35 Казвам се Камен (моля не ми говорете на Вие), в момента съм третокурсник в КН2.\n -[$br1] +{br1} Ще водя практикуми - давам ви задачи, вие ги решавате и на живо оправяме проблеми.\n -[$br1] +{br1} Също ще проверявам част от домашните и контролните през семестъра. @@ -39,7 +42,7 @@ Айде сега, ред по ред: -[$br3] +{br3} :font35 :bulleted @@ -61,14 +64,14 @@ ## Чисто организационно -[$br3] +{br3} :centered35 Задачи, презентации, ...\n -[url /teaching/upp-2023 syndamia.com/teaching/upp-2023] +{url syndamia.com/teaching/upp-2023;/teaching/upp-2023} -[$br3] +{br3} :unordered - Не сме в училище, ако трябва да излезете за разговор или до тоалетна, просто си излезте (за предпочитане по-тихичко). @@ -93,11 +96,11 @@ - Имейл: .bulleted - <a href="mailto:kamen.d.mladenov@protonmail.com">kamen.d.mladenov@protonmail.com</a> <a class="borderless" href="/files/publickey-kamen.d.mladenov@protonmail.com-62ca52e87475c874b9e6ebf3c4c9f716b6ce4c9d.asc"><img class="borderless unzoomable" src="/img/pgpkey.gif" alt="PGP key"></a> - - <a href="mailto:kamen@syndamia.com">kamen@syndamia.com</a> <a class="borderless" href="/files/publickey-kamen@syndamia.com-0x354C5F95.asc"><img class="borderless unzoomable" src="/img/pgpkey.gif" alt="PGP key"></a> [=(гледайте си спама!)=] - - [url mailto:kdmladenov@uni-sofia.bg kdmladenov@uni-sofia.bg] + - <a href="mailto:kamen@syndamia.com">kamen@syndamia.com</a> <a class="borderless" href="/files/publickey-kamen@syndamia.com-0x354C5F95.asc"><img class="borderless unzoomable" src="/img/pgpkey.gif" alt="PGP key"></a> {b (гледайте си спама!)} + - {url kdmladenov@uni-sofia.bg;mailto:kdmladenov@uni-sofia.bg} -Директни линкове към Facebook и Discord има на [url https://learn.fmi.uni-sofia.bg/user/profile.php?id=23229 профила ми в мудъл].\n +Директни линкове към Facebook и Discord има на {url профила ми в мудъл;https://learn.fmi.uni-sofia.bg/user/profile.php?id=23229}.\n @@ -112,10 +115,10 @@ - Ще гледам винаги да има задачи с връзка към реален софтуер. За любителите, където е възможно, ще добавям външни препратки. -- Давам ви [*много*] повече задачи, отколкото очаквам да решите на живо!\n +- Давам ви {i много} повече задачи, отколкото очаквам да решите на живо!\n Хубаво е да имате с какво още да се упражните след практикума, 2 часа писане на код седмично е малко! -- Ще качвам решения на задачите, заедно с подробно коментари върху тях, тук: [url https://github.com/Syndamia/upp-2023-solutions github.com/Syndamia/upp-2023-solutions]. +- Ще качвам решения на задачите, заедно с подробно коментари върху тях, тук: {url github.com/Syndamia/upp-2023-solutions;https://github.com/Syndamia/upp-2023-solutions}. Това ще се случва в началото на следващия практикум, тоест ще имате една седмица, от деня в който ви давам задачите, през която няма да имате решения. @@ -143,7 +146,7 @@ Ако задачите са трудни, зле направени, ако нещо не обяснявам като хората, изобщо ако нещо не е ок, свържете се с мен, ще го обсъдим. -[$br3] +{br3} ## Помагайте си! @@ -159,15 +162,15 @@ ## Няколко съвета в позицията ми на третокурсник -[$br2] +{br2} :font35 :unordered -- [=НЕ плагиатствайте!=] - [=НЕ си качвайте решенията на контролни или домашни онлайн!=] +- {b НЕ плагиатствайте!} + {b НЕ си качвайте решенията на контролни или домашни онлайн!} Формално плагиатството е незаконно, ако някой Ви направи доклад, възможно е да бъдете изключени. -- [=Следвайте материала, който ви се преподава!=] +- {b Следвайте материала, който ви се преподава!} За хората с опит, ще дойде време когато ще искате да приложите лични знания и практики. Ако не е казано някъде, не го правите и не го обмисляте! @@ -185,11 +188,11 @@ Или защо учим толкова много математика -[$br2] +{br2} :font22 Ще си позволя едно отклонение.\n -Искам да обясня как [=аз лично=] виждам\n +Искам да обясня как {b аз лично} виждам\n математиката в компютърния свят. @@ -200,7 +203,7 @@ :row -.width35% [image ./img/u4-mat-hard.gif] +.width35% {img ./img/u4-mat-hard.gif} :column .bulleted @@ -234,15 +237,15 @@ :row .font35 -[image https://upload.wikimedia.org/wikipedia/commons/9/99/ClaudeShannon_MFO3807.jpg?20190622223728 Claude Shannon] +{img Claude Shannon;https://upload.wikimedia.org/wikipedia/commons/9/99/ClaudeShannon_MFO3807.jpg?20190622223728} :column :unordered -- [=Булева алгебра=]: как работим с истина/лъжа, с 0/1 +- {b Булева алгебра}: как работим с истина/лъжа, с 0/1 .bulleted - - Доказана е [url https://en.wikipedia.org/wiki/A_Symbolic_Analysis_of_Relay_and_Switching_Circuits еквивалентност между ел. вериги и булевата алгебра]. + - Доказана е {url еквивалентност между ел. вериги и булевата алгебра;https://en.wikipedia.org/wiki/A_Symbolic_Analysis_of_Relay_and_Switching_Circuits}. - Много типове данни и математически операции могат да се сведат до булева алгебра и работа с памет. @@ -253,20 +256,20 @@ ### Дискретни структури (продължение) -[$br1] +{br1} :unordered -- [=Теория на множествата=]: множество е някаква съвкупност от обекти +- {b Теория на множествата}: множество е някаква съвкупност от обекти .bulleted - 'footnote importance-of-sets [url https://math.stackexchange.com/a/536172 https://math.stackexchange.com/a/536172] - - Позволява ни да третираме колекция от математически обекти като математически обект[$importance-of-sets]. + 'footnote importance-of-sets {url https://math.stackexchange.com/a/536172;https://math.stackexchange.com/a/536172} + - Позволява ни да третираме колекция от математически обекти като математически обект{importance-of-sets}. Използва се в основата на много математики; колкото са полезни те, толкова са и множествата. -[$br2] +{br2} -'footnote importance-of-combinatorics [url https://math.stackexchange.com/questions/2146051/where-do-combinatorics-play-a-role-in-computer-science https://math.stackexchange.com/questions/2146051/where-do-combinatorics-play-a-role-in-computer-science] -- [=Комбинаторика=] [$importance-of-combinatorics]: изследва бройки на неща +'footnote importance-of-combinatorics {url https://math.stackexchange.com/questions/2146051/where-do-combinatorics-play-a-role-in-computer-science;https://math.stackexchange.com/questions/2146051/where-do-combinatorics-play-a-role-in-computer-science} +- {b Комбинаторика} {importance-of-combinatorics}: изследва бройки на неща .bulleted - Често се ползва за анализ и дизайн на алгоритми и структури от данни @@ -279,13 +282,13 @@ ### Дискретни структури (продължение) -[$br5] +{br5} :unordered -- [=Теория на графите=]: граф е съвкупност от някакви обекти и връзки между тях. +- {b Теория на графите}: граф е съвкупност от някакви обекти и връзки между тях. .bulleted - Позволява моделиране на много естествени структури: интернет мрежите, географски карти (места и пътищата между тях), йерархии, биологически мрежи и так. нат. - - Използва се във важни структури от данни като [url https://en.wikipedia.org/wiki/Heap_%28data_structure%29 heap] (и интересната [url https://www.youtube.com/watch?v=6JxvKfSV9Ns fibonacci heap]) и [url https://en.wikipedia.org/wiki/Trie trie] + - Използва се във важни структури от данни като {url heap;https://en.wikipedia.org/wiki/Heap_%28data_structure%29} (и интересната {url fibonacci heap;https://www.youtube.com/watch?v=6JxvKfSV9Ns}) и {url trie;https://en.wikipedia.org/wiki/Trie} @@ -293,13 +296,13 @@ ### Езици, автомати и изчислимост -[$br5] +{br5} :row :font35 -.width85% [image https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Kleene.jpg/421px-Kleene.jpg?20230630215747] +.width85% {img https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Kleene.jpg/421px-Kleene.jpg?20230630215747} .p Stephen Kleene @@ -317,7 +320,7 @@ :slide -[$br1] +{br1} ### Алгебра 1 @@ -328,7 +331,7 @@ - Основоположна в компютърната графика - Много използвана в machine learning -[$br3] +{br3} ### Диференциално и интегрално смятане @@ -356,7 +359,7 @@ - ... .p -Математиката е [=неразделима=] част от софтуера!\n +Математиката е {b неразделима} част от софтуера!\n Друг е въпросът дали на вас лично ще ви се налага да я използвате... @@ -372,15 +375,15 @@ .p .bulleted -- Най-великият труд на тази дисциплина е постигнат чрез [=синхрон=] между тези три предмета +- Най-великият труд на тази дисциплина е постигнат чрез {b синхрон} между тези три предмета :centered :width60% :row -.p [image https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Black_hole_-_Messier_87_crop_max_res.jpg/600px-Black_hole_-_Messier_87_crop_max_res.jpg] +.p {img https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Black_hole_-_Messier_87_crop_max_res.jpg/600px-Black_hole_-_Messier_87_crop_max_res.jpg} -.p [image https://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Internet_map_1024.jpg/600px-Internet_map_1024.jpg?20121030160606] +.p {img https://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Internet_map_1024.jpg/600px-Internet_map_1024.jpg?20121030160606} @@ -396,13 +399,13 @@ :title_slide35 -# [url ./setup.html Достатъчно философия, сега ще конфигурираме всичко нужно за първото ни упражнение] +# {url Достатъчно философия, сега ще конфигурираме всичко нужно за първото ни упражнение;./setup.html} ### Употреба на изображения -Снимки на [url https://upload.wikimedia.org/wikipedia/commons/9/99/ClaudeShannon_MFO3807.jpg?20190622223728 Claude Shannon] и [url https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Kleene.jpg/421px-Kleene.jpg?20230630215747 Stephen Cole Kleen], предоставени от Konrad Jacobs с авторско право от [url https://opc.mfo.de/ MFO], лицензирано с [url https://creativecommons.org/licenses/by-sa/2.0/de/deed.en CC BY-SA 2.0 DE] в Уикипедия. +Снимки на {url Claude Shannon;https://upload.wikimedia.org/wikipedia/commons/9/99/ClaudeShannon_MFO3807.jpg?20190622223728} и {url Stephen Cole Kleen;https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Kleene.jpg/421px-Kleene.jpg?20230630215747}, предоставени от Konrad Jacobs с авторско право от {url MFO;https://opc.mfo.de/}, лицензирано с {url CC BY-SA 2.0 DE;https://creativecommons.org/licenses/by-sa/2.0/de/deed.en} в Уикипедия. -Снимка на черната дупка Messier 87, предоставена от [url https://www.eso.org/public/ ESO] с лиценз [url https://creativecommons.org/licenses/by/4.0/deed.en CC BY 4.0] в [url https://en.wikipedia.org/wiki/File:Black_hole_-_Messier_87_crop_max_res.jpg Уикипедия]. +Снимка на черната дупка Messier 87, предоставена от {url ESO;https://www.eso.org/public/} с лиценз {url CC BY 4.0;https://creativecommons.org/licenses/by/4.0/deed.en} в {url Уикипедия;https://en.wikipedia.org/wiki/File:Black_hole_-_Messier_87_crop_max_res.jpg}. -Изображение на интернет мрежата направено от [url https://en.wikipedia.org/wiki/User:Matt_Britt Matt Britt] с данни от [url https://www.opte.org/ The Opte Project], лицензирано с [url https://creativecommons.org/licenses/by/2.5/deed.en CC BY 2.5] в [url https://commons.wikimedia.org/wiki/File:Internet_map_1024.jpg Уикипедия]. +Изображение на интернет мрежата направено от {url Matt Britt;https://en.wikipedia.org/wiki/User:Matt_Britt} с данни от {url The Opte Project;https://www.opte.org/}, лицензирано с {url CC BY 2.5;https://creativecommons.org/licenses/by/2.5/deed.en} в {url Уикипедия;https://commons.wikimedia.org/wiki/File:Internet_map_1024.jpg}. diff --git a/src/teaching/upp-2023/week10/index.du b/src/teaching/upp-2023/week10/index.du index 746cacd..6a4bbe1 100644 --- a/src/teaching/upp-2023/week10/index.du +++ b/src/teaching/upp-2023/week10/index.du @@ -1,21 +1,25 @@ -# Задачи - УПП, Седмица 10, 15.12.2023 +'def title Задачи - УПП, Седмица 10, 15.12.2023 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/EJcTQRz4 classroom.github.com/a/EJcTQRz4] +GitHub classroom: {url classroom.github.com/a/EJcTQRz4;https://classroom.github.com/a/EJcTQRz4} -.important Във всички задачи [=трябва=] да използвате рекурсия! +.important Във всички задачи {b трябва} да използвате рекурсия! ## Задача 1 -Най-големия общ делител на числата [`a`] и [`b`] е най-голямото, число което ги дели без остатък. -Евклидовият алгоритъм се базира на факта, че за две положителни числа [`a`] и [`b`], като [`a > b`], НОД на [`a`] и [`b`] е същия като НОД на [`a - b`] и [`b`] и когато [`a = b`], тогава НОД на [`a`] и [`b`] е тяхната стойност. +Най-големия общ делител на числата {` a} и {` b} е най-голямото, число което ги дели без остатък. +Евклидовият алгоритъм се базира на факта, че за две положителни числа {` a} и {` b}, като {` a > b}, НОД на {` a} и {` b} е същия като НОД на {` a - b} и {` b} и когато {` a = b}, тогава НОД на {` a} и {` b} е тяхната стойност. -От входа получавате две цели положителни числа и трябва да изкарате техния НОД, чрез алгоритъма на Евклид [=имплементиран с рекурсия=]. +От входа получавате две цели положителни числа и трябва да изкарате техния НОД, чрез алгоритъма на Евклид {b имплементиран с рекурсия}. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -26,13 +30,15 @@ GitHub classroom: [url https://classroom.github.com/a/EJcTQRz4 classroom.github. |: 6 + ## Задача 2 -От входа получавате неотрицателно число [`N`], което ще бъде някое число на Фибоначи. +От входа получавате неотрицателно число {` N}, което ще бъде някое число на Фибоначи. Трябва да върнете кое по ред е, като 0 е нулевото, 1 е първото, 2 е третото, 3 е четвъртото и так. нат. Напомням, че математически фибоначи се дефинира така: .comment +'emplace \begin{align*} F_n = \left\{ \begin{array}{ll} 0, & n=0 \\ @@ -40,12 +46,14 @@ F_n = \left\{ \begin{array}{ll} F_{n-1} + F_{n-2} & \text{иначе} \\ \end{array} \right. \end{align*} +'endemplace -[image ./img/fib.png F(0) = 0; F(1) = 1; F(n) = F(n-1) + F(n-2)] +{img F(0) = 0\; F(1) = 1\; F(n) = F(n-1) + F(n-2);./img/fib.png} -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -68,43 +76,52 @@ F_{n-1} + F_{n-2} & \text{иначе} \\ |: 24 + ## Задача 3 -От входа получавате положително число [`N`], трябва да изкарате на екрана "рисунка", показваща формата на пясъчен часовник с височина [`2N`] (вижте примерите). +От входа получавате положително число {` N}, трябва да изкарате на екрана "рисунка", показваща формата на пясъчен часовник с височина {` 2N} (вижте примерите). -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход |: 1 |: ``` +'emplace + # +'endemplace |: 2 |: ``` +'emplace +++ + # ### +'endemplace |: 3 |: ``` +'emplace +++++ +++ + # ### ##### +'endemplace |: 5 |: ``` +'emplace +++++++++ +++++++ +++++ @@ -115,16 +132,19 @@ F_{n-1} + F_{n-2} & \text{иначе} \\ ##### ####### ######### +'endemplace + ## Задача 4 -От входа получавате число [`N`], след това тябва да изкарате на нови редове, в нарастващ ред, всички двоични числа, които могат да се представят с [`N`]-бита. -Вкарвате и водещи нули, тоест всяко число е съставено от точно [`N`] букви ([`N`] нули и единици). +От входа получавате число {` N}, след това тябва да изкарате на нови редове, в нарастващ ред, всички двоични числа, които могат да се представят с {` N}-бита. +Вкарвате и водещи нули, тоест всяко число е съставено от точно {` N} букви ({` N} нули и единици). -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -159,26 +179,28 @@ F_{n-1} + F_{n-2} & \text{иначе} \\ ``` 0000 0001 -[*...*] +{i ...} 0111 1000 1001 -[*...*] +{i ...} 1101 1110 1111 + ## Задача 5 -Получавате един ред от терминала, в който ще имате скоби, знакът [`+`] и [`*`], шпации и числа. -Това е прост математически израз, трябва да изкарате резултата след неговото пресмятане, като винаги около [`число + число`] и [`число * число`] има скоби (тоест не е нужно да се притеснявате от приоритет и асоциативност). +Получавате един ред от терминала, в който ще имате скоби, знакът {` +} и {` *}, шпации и числа. +Това е прост математически израз, трябва да изкарате резултата след неговото пресмятане, като винаги около {` число + число} и {` число * число} има скоби (тоест не е нужно да се притеснявате от приоритет и асоциативност). -За удобство спокойно може да ползвате [`atoi`] за конверитране на числовите части от низа в числа. +За удобство спокойно може да ползвате {` atoi} за конверитране на числовите части от низа в числа. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход diff --git a/src/teaching/upp-2023/week11/index.du b/src/teaching/upp-2023/week11/index.du index b0f5be1..3750b01 100644 --- a/src/teaching/upp-2023/week11/index.du +++ b/src/teaching/upp-2023/week11/index.du @@ -1,30 +1,34 @@ -# Задачи - УПП, Седмица 11, 22.12.2023 +'def title Задачи - УПП, Седмица 11, 22.12.2023 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/cZRnZj9y classroom.github.com/a/cZRnZj9y] +GitHub classroom: {url classroom.github.com/a/cZRnZj9y;https://classroom.github.com/a/cZRnZj9y} -.important Във всички задачи [=трябва=] да използвате рекурсия! +.important Във всички задачи {b трябва} да използвате рекурсия! .warn Някои задачи се повтарят с тези от миналия път, ако преди не сте ги решили, сега ги решете ## Алтернативни задачи -Считайте [url https://github.com/ivanahristova/introduction-to-programming-2023-2024/tree/main/sem11#%D0%B7%D0%B0%D0%B4%D0%B0%D1%87%D0%B8 задачите от семинара] като задачи преди тези. +Считайте {url задачите от семинара;https://github.com/ivanahristova/introduction-to-programming-2023-2024/tree/main/sem11#%D0%B7%D0%B0%D0%B4%D0%B0%D1%87%D0%B8} като задачи преди тези. Тоест, за хората които се затрудняват повечко, решете семинарните и след това се върнете тук. Разбира се, ще помагам и със семинарните задачи. ## Задача 1 -От входа получавате неотрицателно число [`N`], което ще бъде някое число на Фибоначи. +От входа получавате неотрицателно число {` N}, което ще бъде някое число на Фибоначи. Трябва да върнете кое по ред е, като 0 е нулевото, 1 е първото, 2 е третото, 3 е четвъртото и так. нат. Напомням, че нормално Фибоначи се дефинира като редица, която започва с числата 0 и 1, и всяко следващо е сумата на предходните две. -Тоест, нулевото число е 0, първото 1, второто е [`0 + 1 = 1`] (понеже 1 се повтаря, зачитаме го за първото число), третото е [`1 + 1 = 2`], четвъртото е [`1 + 2 = 3`] и так. нат. +Тоест, нулевото число е 0, първото 1, второто е {` 0 + 1 = 1} (понеже 1 се повтаря, зачитаме го за първото число), третото е {` 1 + 1 = 2}, четвъртото е {` 1 + 2 = 3} и так. нат. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -47,17 +51,19 @@ GitHub classroom: [url https://classroom.github.com/a/cZRnZj9y classroom.github. |: 24 + ## Задача 2 -От входа получавате положително число [`N`], трябва да изкарате на екрана "рисунка" на триъгълници. +От входа получавате положително число {` N}, трябва да изкарате на екрана "рисунка" на триъгълници. ### a) горен триъгълник -Рисунката е един правоъгълен равнобедрен триъгълник от знака [`+`], като [`N`] определя размера на равнобедрените страни (вижте примерите). +Рисунката е един правоъгълен равнобедрен триъгълник от знака {` +}, като {` N} определя размера на равнобедрените страни (вижте примерите). -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -87,82 +93,101 @@ GitHub classroom: [url https://classroom.github.com/a/cZRnZj9y classroom.github. +++++ + ### б) долен триъгълник -Подобно на предходната подточка, обаче обърнат по хоризонтала, и със знака [`#`]. +Подобно на предходната подточка, обаче обърнат по хоризонтала, и със знака {` #}. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход |: 1 |: ``` +'emplace # +'endemplace |: 2 |: ``` +'emplace ## # +'endemplace |: 3 |: ``` +'emplace ### ## # +'endemplace |: 5 |: ``` +'emplace ##### #### ### ## # +'endemplace + ### в) пълен триъгълник -[=Използвайки само една рекурсивна функция,=] сега трябва да изкарате първо горния триъгълник и след това долния. +{b Използвайки само една рекурсивна функция,} сега трябва да изкарате първо горния триъгълник и след това долния. Ако просто извикате предходните две функции една след друга, задачата се обезсмисля. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход |: 1 |: ``` +'emplace + # +'endemplace |: 2 |: ``` +'emplace + ++ ## # +'endemplace |: 3 |: ``` +'emplace + ++ +++ ### ## # +'endemplace |: 5 |: ``` +'emplace + ++ +++ @@ -173,11 +198,13 @@ GitHub classroom: [url https://classroom.github.com/a/cZRnZj9y classroom.github. ### ## # +'endemplace + ## Задача 3 -Направете програма която разрешава проблема с [url https://en.wikipedia.org/wiki/Ages_of_Three_Children_puzzle възрастта на трите деца]. +Направете програма която разрешава проблема с {url възрастта на трите деца;https://en.wikipedia.org/wiki/Ages_of_Three_Children_puzzle}. Една жена има три деца за които знаем три неща: умножението на техните възрасти, сбора на техните възрасти и факта, че има едно дете, което е най-голямо. Трябва да намерите възрастта на всяко дете, само по тази информация. @@ -185,11 +212,12 @@ GitHub classroom: [url https://classroom.github.com/a/cZRnZj9y classroom.github. Разбира се, от входа получавате две числа, съответно умножението и сбора на възрастите им. Трябва на екрана да изкарате три числа - възрастите на трите деца. -[=Подсказка:=] най-лесното решение е да пробвате всички възможни възрасти, като избягвате техни пермутации +{b Подсказка:} най-лесното решение е да пробвате всички възможни възрасти, като избягвате техни пермутации -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -203,14 +231,16 @@ GitHub classroom: [url https://classroom.github.com/a/cZRnZj9y classroom.github. |: 2 5 35 + ## Задача 4 -От входа получавате число [`N`], след това трябва да изкарате на нови редове, в нарастващ ред, всички двоични числа, които могат да се представят с [`N`]-бита. -Вкарвате и водещи нули, тоест всяко число е съставено от точно [`N`] букви ([`N`] нули и единици). +От входа получавате число {` N}, след това трябва да изкарате на нови редове, в нарастващ ред, всички двоични числа, които могат да се представят с {` N}-бита. +Вкарвате и водещи нули, тоест всяко число е съставено от точно {` N} букви ({` N} нули и единици). -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -245,28 +275,30 @@ GitHub classroom: [url https://classroom.github.com/a/cZRnZj9y classroom.github. ``` 0000 0001 -[*...*] +{i ...} 0111 1000 1001 -[*...*] +{i ...} 1101 1110 1111 + ## Задача 5 -Направете програма която разрешава [url https://en.wikipedia.org/wiki/Takuzu Такузо пъзели]. +Направете програма която разрешава {url Такузо пъзели;https://en.wikipedia.org/wiki/Takuzu}. Започвате с дъска 4х4, в тази дъска може да имате само цифрите 0 и 1, като няколко клетки вече идват с попълнени стойности (но повечето са празни). Обаче, на всяка колона и ред трябва да има еднакъв брой 0ли и 1ци, и не трябва да има повече от две последователни еднакви цифри (в реда или колоната). От входа получавате дъската, като с -1 обозначаваме празна клетка. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход diff --git a/src/teaching/upp-2023/week12/index.du b/src/teaching/upp-2023/week12/index.du index 3fa25ff..ed4dc89 100644 --- a/src/teaching/upp-2023/week12/index.du +++ b/src/teaching/upp-2023/week12/index.du @@ -1,14 +1,17 @@ -# Задачи - УПП, Седмица 12, 05.01.2024 +'def title Задачи - УПП, Седмица 12, 05.01.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/KEDSxDjl classroom.github.com/a/KEDSxDjl] +GitHub classroom: {url classroom.github.com/a/KEDSxDjl;https://classroom.github.com/a/KEDSxDjl} -.important Във всички задачи [=трябва=] да използвате рекурсия! +.important Във всички задачи {b трябва} да използвате рекурсия! ## Алтернативни задачи -Считайте [url https://github.com/ivanahristova/introduction-to-programming-2023-2024/tree/main/sem12 задачите от семинара] и [url ../week11/ тези от миналия път] като част от днешните задачи. +Считайте {url задачите от семинара;https://github.com/ivanahristova/introduction-to-programming-2023-2024/tree/main/sem12} и {url тези от миналия път;../week11/} като част от днешните задачи. Тоест, за хората които се затрудняват повечко, решете ги и след това се върнете тук. Разбира се, ще помагам и с тях. @@ -21,9 +24,10 @@ GitHub classroom: [url https://classroom.github.com/a/KEDSxDjl classroom.github. Накрая получавате максималната обща тежест за раницата. Трябва да изкарате на екрана максималната възможна обща ценност. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -62,11 +66,12 @@ GitHub classroom: [url https://classroom.github.com/a/KEDSxDjl classroom.github. .comment https://people.sc.fsu.edu/~jburkardt/datasets/knapsack_01/knapsack_01.html + ## Задача 2 Получавате N и M, съответно броя редове и колони в дъска. Всяка клетка от дъската е пълна или празна. -След това получавате NxM на брой символа за всяка клетка, като [`-`] означава празна клетка, докато [`#`] означава пълна. +След това получавате NxM на брой символа за всяка клетка, като {` -} означава празна клетка, докато {` #} означава пълна. Накрая получавате две числа - координати (започващи от нула, като 0,0 е горния-ляв ъгъл) в дъската. От подадените координати трябва да запълните "фигурата" в която се намира (фигурата която огражда) дадената плочка. @@ -74,11 +79,12 @@ GitHub classroom: [url https://classroom.github.com/a/KEDSxDjl classroom.github. Оцветяването да се случва само в 4те прави посоки (без диагонали). -[image https://upload.wikimedia.org/wikipedia/commons/7/7e/Recursive_Flood_Fill_4_%28aka%29.gif] +{img https://upload.wikimedia.org/wikipedia/commons/7/7e/Recursive_Flood_Fill_4_%28aka%29.gif} -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -101,6 +107,7 @@ GitHub classroom: [url https://classroom.github.com/a/KEDSxDjl classroom.github. - - # # - - - - - - - + ## Задача 3 Имате шахматна дъска (8 на 8) и върху нея имате 8 царици. @@ -109,14 +116,15 @@ GitHub classroom: [url https://classroom.github.com/a/KEDSxDjl classroom.github. Интересуваме се от такова поставяне на всички царици, че нито една няма да вземе никоя друга царица в един ход. Пример: -[image https://upload.wikimedia.org/wikipedia/commons/6/69/Solution_A_for_8_Queen_Puzzles.png] +{img https://upload.wikimedia.org/wikipedia/commons/6/69/Solution_A_for_8_Queen_Puzzles.png} Напишете програма, която намира броя на възможните такива поставяния на цариците. От входа не получавате нищо. -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -124,45 +132,47 @@ GitHub classroom: [url https://classroom.github.com/a/KEDSxDjl classroom.github. |: 92 -[=Бонус:=] направете програмата да изкарва всяко решение + +{b Бонус:} направете програмата да изкарва всяко решение ## Задача 4 .comment https://mathcenter.oxford.emory.edu/site/cs171/probSetUsingStacks/ -Нормално ние представяме математически операции чрез "инфиксен" запис, тоест операторът е по средата, между нещата върху които работи (пример: [`1 + 2`]). -Обаче, това не е задължително, по обратната полска нотация винаги слагаме оператът след нещата върху които работи (пример: [`1 2 +`]). +Нормално ние представяме математически операции чрез "инфиксен" запис, тоест операторът е по средата, между нещата върху които работи (пример: {` 1 + 2}). +Обаче, това не е задължително, по обратната полска нотация винаги слагаме оператът след нещата върху които работи (пример: {` 1 2 +}). Бонусът на това, е че не ни трябва скобуване и ред на операциите. -В инфиксния израз [`(2 + 3) * (2 ^^ 2)`], без скобите, сбора ще се извърши след умножението и степенуването ще се извърши след умножението. -Обаче, ако искаме да изразим това в обратен полски запис, просто правим [`2 3 + 2 2 ^^ *`]. -А ако искаме оригиналното действие, без скоби, записваме [`2 3 2 * 2 ^^ +`]. +В инфиксния израз {` (2 + 3) * (2 ^^ 2)}, без скобите, сбора ще се извърши след умножението и степенуването ще се извърши след умножението. +Обаче, ако искаме да изразим това в обратен полски запис, просто правим {` 2 3 + 2 2 ^^ *}. +А ако искаме оригиналното действие, без скоби, записваме {` 2 3 2 * 2 ^^ +}. Ако изглежда объркващо, идеята е че всеки оператор работи върху предходните две стойности, изчисляваме изразите от ляво надясно и заместваме веднага. -Тоест, при последния пример, пропускаме първите три числа, стигаме до [`*`], умножаваме последните две и заместваме трите неща ([`3 2 *`]) с резултата, следователно имаме [`2 6 2 ^^ +`], пропускаме две, стигаме до [`^^`] и так.нат. +Тоест, при последния пример, пропускаме първите три числа, стигаме до {` *}, умножаваме последните две и заместваме трите неща ({` 3 2 *}) с резултата, следователно имаме {` 2 6 2 ^^ +}, пропускаме две, стигаме до {` ^^} и так.нат. -Направете програма, която чисто рекурсивно изчислиява изрази в обратен полски запис, който поддържа цели числа и операциите събиране, умножение, деление, изваждане и степенуване (за степенуване ще използваме знакът [`^`]). +Направете програма, която чисто рекурсивно изчислиява изрази в обратен полски запис, който поддържа цели числа и операциите събиране, умножение, деление, изваждане и степенуване (за степенуване ще използваме знакът {` ^}). .important Обаче, за едно извикване на рекурсивната функция, може да пазите само един елемент на израза (число или оператор)! -Изразът винаги завършва на знака [`$`]. +Изразът винаги завършва на знака {` $}. :warn .p -Относно вход/изход, понеже няма как да знаем дали i-тата стойност е число или знак (операция), трябва да използваме функцията [`std::cin.fail()`], която връща булева стойност, която ни казва дали записването на входа е било успешно. +Относно вход/изход, понеже няма как да знаем дали i-тата стойност е число или знак (операция), трябва да използваме функцията {` std::cin.fail()}, която връща булева стойност, която ни казва дали записването на входа е било успешно. .p -Тоест, може винаги да запазвате входа в целочислен тип, когато стигнете до знак [`std::cin.fail()`] ще върне [`true`]. -След това трябва да "забравите" за грешката чрез [`std::cin.clear()`] и може втори път да запазите входа (провалените данни ще се препрочетат) в променлива от знаков тип. +Тоест, може винаги да запазвате входа в целочислен тип, когато стигнете до знак {` std::cin.fail()} ще върне {` true}. +След това трябва да "забравите" за грешката чрез {` std::cin.clear()} и може втори път да запазите входа (провалените данни ще се препрочетат) в променлива от знаков тип. .p -Но това поражда друг проблем, понеже записваме в целочислен тип, когато въведем [`+`] или [`-`], [`std::cin`] ще очаква това да е водещ знак на число, и ще продължи да чака входа докато не въведем друг знак, тоест [`+`] и [`-`] ще бъдат пропуснати. -Като компромисен вариант, просто пред тях винаги ще слагаме [`'`] и в кода ще го пропускаме. +Но това поражда друг проблем, понеже записваме в целочислен тип, когато въведем {` +} или {` -}, {` std::cin} ще очаква това да е водещ знак на число, и ще продължи да чака входа докато не въведем друг знак, тоест {` +} и {` -} ще бъдат пропуснати. +Като компромисен вариант, просто пред тях винаги ще слагаме {` '} и в кода ще го пропускаме. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -173,8 +183,9 @@ GitHub classroom: [url https://classroom.github.com/a/KEDSxDjl classroom.github. |: 35 + ## Attribution .bulleted -- Анимация в [url #2 Задача 2] от André Karwath (Aka) на [url https://commons.wikimedia.org/w/index.php?curid=481651 Уикипедия] под лиценз CC BY-SA 2.5 -- Изображение на шахматна дъска в [url #3 Задача 3] от Encik Tekateki в [url https://commons.wikimedia.org/w/index.php?curid=77832290 Уикипедия] под лиценз CC BY-SA 4.0 +- Анимация в {url Задача 2;#2} от André Karwath (Aka) на {url Уикипедия;https://commons.wikimedia.org/w/index.php?curid=481651} под лиценз CC BY-SA 2.5 +- Изображение на шахматна дъска в {url Задача 3;#3} от Encik Tekateki в {url Уикипедия;https://commons.wikimedia.org/w/index.php?curid=77832290} под лиценз CC BY-SA 4.0 diff --git a/src/teaching/upp-2023/week13/index.du b/src/teaching/upp-2023/week13/index.du index c12c546..8c077db 100644 --- a/src/teaching/upp-2023/week13/index.du +++ b/src/teaching/upp-2023/week13/index.du @@ -1,12 +1,15 @@ -# Задачи - УПП, Седмица 13, 12.01.2024 +'def title Задачи - УПП, Седмица 13, 12.01.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/bgiFD6SB classroom.github.com/a/bgiFD6SB] +GitHub classroom: {url classroom.github.com/a/bgiFD6SB;https://classroom.github.com/a/bgiFD6SB} ## Алтернативни задачи -Считайте [url https://github.com/ivanahristova/introduction-to-programming-2023-2024/tree/main/sem13 задачите от семинара] и [url ../week12/ тези от миналия път] като част от днешните задачи. +Считайте {url задачите от семинара;https://github.com/ivanahristova/introduction-to-programming-2023-2024/tree/main/sem13} и {url тези от миналия път;../week12/} като част от днешните задачи. Тоест, за хората които се затрудняват повечко, решете ги и след това се върнете тук. Разбира се, ще помагам и с тях. @@ -20,9 +23,10 @@ GitHub classroom: [url https://classroom.github.com/a/bgiFD6SB classroom.github. Всяка дума е на нов ред и е съставена от малки латински букви. Ако има няколко думи с еднаква "близкост", изкарайте последната от тях. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -50,6 +54,7 @@ mask |: task + ## 2 задача В началото получавате неотрицателно цяло число N. @@ -59,14 +64,15 @@ mask Редовете са разбъркани, изкарайте първо име и фамилия на хората с най-много продадени продукти. Ако има няколко хора, които са продали най-много продукти, изкарайте имената им в азбучен ред, първо по фамилия, после по име. -Използвайте [=само една функция за сортиране!=] +Използвайте {b само една функция за сортиране!} Като подсказка, използвайте указатели към функции за да променяте как тя работи. .question Какво свойство трябва да е изпълнено за сортиращата функция? -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -86,6 +92,7 @@ Joseph Carmichael Antony Garcia + ## 3 задача Ще дефинираме обвито изречение, като редица от букви, за които са изпълнени следните правила: @@ -121,9 +128,10 @@ A . Изкарайте на конзолата всички обвити изречения в матрицата (редът им няма значение). -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -196,9 +204,10 @@ jumper Big jumper. + ## 4 задача -В префиксния (или полския) запис слагаме оператора за смятане пред (в ляво от) елементите върху които работи (нормален запис - [`1 + 2`], полски запис - [`+ 1 2`]). +В префиксния (или полския) запис слагаме оператора за смятане пред (в ляво от) елементите върху които работи (нормален запис - {` 1 + 2}, полски запис - {` + 1 2}). Ще разглеждаме "многоредови" изрази в полски запис, тоест изрази в които има няколко реда от целочислени стойности, така че трябва да се изчислят няколко израза с еднаква "форма", но различни стойности. Един такъв израз изглежда така: @@ -209,7 +218,7 @@ Big jumper. 5 6 . Точката на края на последния ред задава край на израза. -В този пример ще изчислим [`1 + 2`], [`3 + 4`] и [`5 + 6`], тоест ще "върне" три стойности: 3, 7 и 11. +В този пример ще изчислим {` 1 + 2}, {` 3 + 4} и {` 5 + 6}, тоест ще "върне" три стойности: 3, 7 и 11. Всяка колона в израза е от един и същи "тип", тоест в една колона винаги ще има числова стойност или някакъв знак. С изключение на точката, всеки знак може да се постави на произволен ред (обаче в една колона не може да има повече от един знак). @@ -220,10 +229,10 @@ Big jumper. + 3 4 7 7 5 6 * 8 9 . -Това ще изчисли [`1 + (2 - 2 * 63)`], [`3 + (4 - 7* 7)`] и [`5 + (6 - 8 * 9)`]. +Това ще изчисли {` 1 + (2 - 2 * 63)}, {` 3 + (4 - 7* 7)} и {` 5 + (6 - 8 * 9)}. Израза би направил същото нещо ако примерно всички знаци бяха на първия ред или на последния. -От входа получавате няколко такива израза, докато не получите знака [`$`]. +От входа получавате няколко такива израза, докато не получите знака {` $}. Може да достъпвате стойност от предходни изрази чрез синтаксиса "ИНДЕКС.ИНДЕКС", където индексите са от 0, първия определя номера на израза, докато втория определя коя стойност искаме. Примерно: @@ -238,11 +247,12 @@ Big jumper. Накрая трябва да изкарате всички стойности от последния израз. -.warn Погледнете пояснението за вход/изход от [url ../week12/#4 последната задача от миналия път]. +.warn Погледнете пояснението за вход/изход от {url последната задача от миналия път;../week12/#4}. -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход diff --git a/src/teaching/upp-2023/week14/index.du b/src/teaching/upp-2023/week14/index.du index a0f9906..d06e169 100644 --- a/src/teaching/upp-2023/week14/index.du +++ b/src/teaching/upp-2023/week14/index.du @@ -1,11 +1,14 @@ -# Задачи - УПП, Седмица 14, 19.01.2024 +'def title Задачи - УПП, Седмица 14, 19.01.2024 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/B08TtnnW classroom.github.com/a/B08TtnnW] +GitHub classroom: {url classroom.github.com/a/B08TtnnW;https://classroom.github.com/a/B08TtnnW} Това е последния практикум, затова ви давам по-лесни и приятни задачи: имплементации на игри! -Всичките са взети от [url https://en.wikipedia.org/wiki/BASIC_Computer_Games 101 BASIC Computer Games] (книгата е налична в [url https://archive.org/details/bitsavers_decBooks10Mar75_26006648 archive.org]). +Всичките са взети от {url 101 BASIC Computer Games;https://en.wikipedia.org/wiki/BASIC_Computer_Games} (книгата е налична в {url archive.org;https://archive.org/details/bitsavers_decBooks10Mar75_26006648}). Разбира се, който иска, може да решава задачи от предходни практикуми, давал съм достатъчно задачи. @@ -20,7 +23,8 @@ GitHub classroom: [url https://classroom.github.com/a/B08TtnnW classroom.github. Компютъра автоматично (и случайно) генерира между 5 и 20 купчини с между 1 и 10 пръчки. Разбира се, трябва компютъра да съобщи за конкретните стойности: -```terminal +'def LANG terminal +``` X piles Y sticks in pile 1 Z sticks in pile 2 @@ -29,29 +33,34 @@ K sticks in pile X След това се редуват, първия играч, втория играч: -```terminal +'def LANG terminal +``` Player 1 turn Избирате купчина с пръчки: -```terminal +'def LANG terminal +``` Which pile do you want sticks from? _ където _ е мястото на курсора. След това броя пръчки от купчината: -```terminal +'def LANG terminal +``` How many sticks? _ Ако някоя стойност е невалидна, питате пак. След това идва редът на втория играч: -```terminal +'def LANG terminal +``` Player 2 turn Накрая, този който вземе последната пръчка печели играта и се пита дали искате наново да почнете играта: -```terminal +'def LANG terminal +``` Player X won. Do you want to play again? _ ## 2 задача - Хамураби @@ -64,7 +73,8 @@ Player X won. Do you want to play again? _ В началото вашия съветник казва: -```terminal +'def LANG terminal +``` Hamurabi, I beg to report to you In year X, Y people starved, Z came to the city. @@ -74,12 +84,14 @@ In year X, Y people starved, Z came to the city. След това имате 1/7 шанс чума да сполети вашия град. Ако се случи, съветника ви съобщава за това и загубвате половината си население: -```terminal +'def LANG terminal +``` A horrible plague struck! Half of the people died. След това съветника ви дава информация за града: -```terminal +'def LANG terminal +``` Population is now X. The city now owns X acres. You harvested Z bushels per acre. @@ -92,7 +104,8 @@ You now have L bushels in store. Иначе, сега съветника започва да ви дава информация и да ви пита за вашето действие: -```terminal +'def LANG terminal +``` Land is trading at X bushels per acre. How many acres do you wish to buy? _ @@ -100,7 +113,8 @@ How many acres do you wish to buy? _ Трябва да се въведе цяло число. В този случай, както и всеки други, ако то е отрицателно, съветника напуска и играта свършва: -```terminal +'def LANG terminal +``` Hamurabi, I cannot do what you wish, get yourself another steward!!!!! So long for now. @@ -108,44 +122,51 @@ So long for now. Ако нямате достатъчно бушели в резерв, за да купите всичката въведена земя, съветника ви казва: -```terminal +'def LANG terminal +``` Hamurabi, think again, you have only X bushels of grian. Now then, и същото съобщение за "Land is trading at [...] How many acres ..." се изписва и приемате нов вход. Ако сте въвели 0, значи искате да продавате земя и съветника ви пита: -```terminal +'def LANG terminal +``` How many acres do you wish to sell? _ Ако се въведе отрицателно число, случва се същото като при купуване на земя. Ако въведете повече земя, отколкото имате, съветника казва: -```terminal +'def LANG terminal +``` Hamurabi think again, you own only X acres. Now then, и пак пита "How many acres [...]". След като сте купили или продали земя, сега съветника ви пита колко бушели жито ще отделите за нахранване на населението: -```terminal +'def LANG terminal +``` How many bushels do you wish to feed your people? _ Ако се въведе твърде голямо число, съветника предупреждава и пита пак: -```terminal +'def LANG terminal +``` Hamurabi, think again, you have only X bushels of grain. Now then, How many bushels do you wish to feed your people? _ Остава последния въпрос от съветника за годината: -```terminal +'def LANG terminal +``` How many acres do you wish to plant with seed? _ Разбира се, ако се въведат повече акри отколкото има, съветника предупреждава и пита пак: -```terminal +'def LANG terminal +``` Hamurabi, think again, you own only X acres. Now then, How many acres do you wish to plant with seed? _ @@ -154,7 +175,8 @@ How many acres do you wish to plant with seed? _ Един бушел жито може да засее два акъра земя, ако няма достатъчно жито, съветника предупреждава и пита пак. Отнема 10 човека да се грижат за един акър земя, ако няма достатъчно хора, съветника предупреждава и пита пак: -```terminal +'def LANG terminal +``` But you have only X people to tend the fields. Now then, Това са въпросите на съветника, сега остава годината да се изиграе. @@ -163,13 +185,14 @@ But you have only X people to tend the fields. Now then, След това избирате друго произволно число между 1 и 6. Ако числото е по-голямо от 1, тогава плъховете ще изядат по толкова голяма дроб бушели жито от резерва (при числото 5, плъховете изяждат 1/5; тук бушелите жито се смятат преди жътва). -Сега населението расте, броя хора които са "дошли" в града се определя по формулата [`R * (20* АКРИ ЗЕМЯ + БУШЕЛИ ЖИТО) / БРОЙ ХОРА / 100 + 1`], където R е цяло число между 1 и 6. +Сега населението расте, броя хора които са "дошли" в града се определя по формулата {` R * (20* АКРИ ЗЕМЯ + БУШЕЛИ ЖИТО) / БРОЙ ХОРА / 100 + 1}, където R е цяло число между 1 и 6. Бушелите жито се смятат след жътва. Предпоследно, определя се колко хора са умрели от глад, като всеки човек консумира 20 бушели жито. Ако над 45% от населението са умрели от глад, останалите хора ви свалят от власт и играта свършва: -```terminal +'def LANG terminal +``` You starved X people in one year, due to this extreme mismanagement, you have not only been impeached and thrown out of office but you have also been declared national fink! @@ -179,27 +202,31 @@ So long for now. Ако успешно царувате 10 години, накрая съветника ви казва как сте се справили: -```terminal +'def LANG terminal +``` In your 10-year term of office, X percent of the population starved per year on average, I.E., a total of Y people died. Сега изчислявате пропорцията между земя и хора, съветника ви казва: -```terminal +'def LANG terminal +``` You started with 10 acres per person and ended with X acres per person. Ако средно над 33% от населението е умирало от глад всяка година или съотношението ви е под 7 акъра на човек, тогава се случва същото нещо, като когато над 45% от населението умира от глад. Ако средно над 10% (но под 34%) от населението е умирало от глад всяка година или съотношението ви е под 9 акъра на човек (но над 6), тогава оставате в историята като лош владетел: -```terminal +'def LANG terminal +``` Your heavy-handed performance smacks of Nero and Ivan IV. The people (remaining) find you an unpleasant ruler, and frankly, hate your guts. So long for now. Ако средно над 3% (но под 11%) от населението е умирало от глад всяка година или съотношението е между 9 и 10 акъра на човека, тогава оставате със средно впечатление: -```terminal +'def LANG terminal +``` Your performance could have been somewhat better but really wasn't too bad at all. X people would dearly like to see you assassinated but we all have our trivial problems. So long for now. @@ -208,7 +235,8 @@ So long for now. В противен случай, тоест средно под 4% от населението е умирало от глад всяка година или съотношението е над 10 акъра на човека, тогава хората ви харесват: -```terminal +'def LANG terminal +``` A fantastic performance!!! Charlemange, Disraeli and Jefferson combined could not have done better. So long for now. diff --git a/src/teaching/upp-2023/week2/index.du b/src/teaching/upp-2023/week2/index.du index 645f1c6..9ea5a69 100644 --- a/src/teaching/upp-2023/week2/index.du +++ b/src/teaching/upp-2023/week2/index.du @@ -1,18 +1,21 @@ -# Задачи - УПП, Седмица 2, 13.10.2023 +'def title Задачи - УПП, Седмица 2, 13.10.2023 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github.com/a/Bi5dhwW7] +GitHub classroom: {url classroom.github.com/a/Bi5dhwW7;https://classroom.github.com/a/Bi5dhwW7} -Решения: [url https://github.com/Syndamia/upp-2023-solutions/tree/main/week02 GitHub] +Решения: {url GitHub;https://github.com/Syndamia/upp-2023-solutions/tree/main/week02} -## [=Важни бележки=] +## {b Важни бележки} .numbered -1. Не е добре да ползвате [`using namespace std;`] -2. Единствената библиотека, която (поне за сега) може да ползвате е [`iostream`] -3. За хората с текстови редактори и [`gcc`], моля да погледнете в Moodle и да използвате предоставените флагове, най-важния от които е [`-std=c++17`] -3. Като си качвате решенията в GitHub classroom, за предпочитане е имената на файловете да свършват на [`.cpp`]. +1. Не е добре да ползвате {` using namespace std;} +2. Единствената библиотека, която (поне за сега) може да ползвате е {` iostream} +3. За хората с текстови редактори и {` gcc}, моля да погледнете в Moodle и да използвате предоставените флагове, най-важния от които е {` -std=c++17} +3. Като си качвате решенията в GitHub classroom, за предпочитане е имената на файловете да свършват на {` .cpp}. Отново, не е задължително, но ми улеснява живота. ## Тема: конвертиране @@ -21,25 +24,26 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. ### Задача 1 - Конвертирания от int -Получавате целочислено число (тип [`int`]), след това, за всеки тип от следния списък, трябва да изкарате на нов ред текст във формата "Със/без загуба тип стойност": +Получавате целочислено число (тип {` int}), след това, за всеки тип от следния списък, трябва да изкарате на нов ред текст във формата "Със/без загуба тип стойност": .bulleted -- [`bool`] -- [`long long int`] -- [`unsigned int`] -- [`char`] -- [`short int`] -- [`double`] -- [`long int`] -- [`unsigned char`] +- {` bool} +- {` long long int} +- {` unsigned int} +- {` char} +- {` short int} +- {` double} +- {` long int} +- {` unsigned char} Целта е да напишете един низ, който съдържа "Със/без загуба тип", и след това да изкарате (конвертираната) стойност. Не се иска да правите код, който намира тази информация автоматично, всичко това просто си го напишете ръчно (hardcoded). -[=Пример=] -  [*Нарочно са показани само първите два реда от изхода*] +{b Пример} +  {i Нарочно са показани само първите два реда от изхода} -:table_2 +:table +:2 |= Вход |= Изход @@ -47,6 +51,7 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. |: Със загуба bool 1\nБез загуба long long int 5\n... + ## Тема: Побитови оператори \n @@ -55,9 +60,10 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. Получавате положително цяло число, от него трябва да "запазите" само първите (най-десните) 6 бита и да изкарате получилото се число. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -68,15 +74,17 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. |: 8 + ### Задача 3 - Деление и умножение -Получавате положително цяло число [`а`], трябва да изкарате две числа (разделени с празно пространство):\n -[`a`] (целочислено) разделено на 16 и [`а`] умножено по 8. -[=Трябва да използвате побитови оператори за това!=] +Получавате положително цяло число {` а}, трябва да изкарате две числа (разделени с празно пространство):\n +{` a} (целочислено) разделено на 16 и {` а} умножено по 8. +{b Трябва да използвате побитови оператори за това!} -[=Пример=] +{b Пример} -:table_2 +:table +:2 |= Вход |= Изход @@ -84,6 +92,7 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. |: 4 584 + ### Задача 4 - IP адрес Разграничаваме устройствата, свързани към интернет, по техния IP адрес. @@ -105,13 +114,14 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. ``` 128 128 128 128 -И накрая изкарания резултат трябва да бъде [`128.128.128.128`] +И накрая изкарания резултат трябва да бъде {` 128.128.128.128} На входа получавате цяло положително число, трябва да изкарате на екрана как би изглеждало с това представяне, с точките между осморки битове. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -125,20 +135,22 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. |: 56.135.131.240 + ## Тема: Логически оператори \n ### Задача 5 - Дели ли се -От входа получавате две числа: [`а`] и [`n`]. -Трябва да върнете 0 ако [`a`] не се дели на [`n`] без остатък, и 1 иначе. +От входа получавате две числа: {` а} и {` n}. +Трябва да върнете 0 ако {` a} не се дели на {` n} без остатък, и 1 иначе. -[=Упътване:=] Булевата стойност [`false`] се изкарва като 0, а [`true`] се изкарва като 1, от [`std::cout`] +{b Упътване:} Булевата стойност {` false} се изкарва като 0, а {` true} се изкарва като 1, от {` std::cout} -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -154,9 +166,10 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. Получавате от входа буква, трябва да върнете 0 ако буквата не е цифра и 1 ако е. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -170,6 +183,7 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. |: 0 + ## Тема: Условни конструкции \n @@ -178,9 +192,10 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. На входа получавате три целочислени, трябва да ги изкарате в нарастващ ред. -[=Пример=] +{b Пример} -:table_2 +:table +:2 |= Вход |= Изход @@ -188,15 +203,17 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. |: 3 5 8 + ### Задача 8 - Календар От входа получавате число от 1 до 12: номера на месеца. Трябва да изкарате името на месеца, където 1 съответства на "January", 2 на "February" и так. нат. -Моля използвате [`switch`] конструкция. +Моля използвате {` switch} конструкция. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -207,15 +224,17 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. |: October + ### Задача 9 - Монети Получавате число с плаваща запетая, това ще бъде цената на даден продукт в лева. Искате да платите използвайки само монети, като целта е да използвате възможно най-големите стойности на монети, възможно най-много (тоест ситуацията в която трябва да носите един милион монети по една стотинка не трябва да е възможност). Изкарайте двойки "монета бройка", като работите с монети от по 50 стотинки, 20 стотинки, 10 стотинки, 5 стотинки, 1 стотинка. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -226,10 +245,11 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. |: 0.5 6 0.2 1 0.1 1 0.05 1 0.01 2 + ### Задача 10 - ILS При кацане, един самолет се нужда от информация дали е точно приравнен със средата на пистата, особено когато видимостта е занижена. -Една система за тази цел се нарича [url https://www.pilotscafe.com/Understanding-ILS/ ILS], но ние ще разгледаме нейния компонент, [url https://en.wikipedia.org/wiki/Instrument_landing_system_localizer the localizer]: в края на пистата големи предаватели излъчват различни радио сигнали в двете половини на пистата. +Една система за тази цел се нарича {url ILS;https://www.pilotscafe.com/Understanding-ILS/}, но ние ще разгледаме нейния компонент, {url the localizer;https://en.wikipedia.org/wiki/Instrument_landing_system_localizer}: в края на пистата големи предаватели излъчват различни радио сигнали в двете половини на пистата. Ефектът е като на стерео тон колони, когато самолетът е в ляво от пистата, той приема сигнала от лявата част на пистата по-силно от този за дясната, както ако си доближиш ухото до лявата тон колона, ти ще чуваш нейния звук по-силно от дясната. @@ -238,9 +258,10 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. Спрямо техните стойности, трябва да върнете "Turn right" ако самолетът е в ляво от пистата (ако XXX е по-голямо от YYY) и "Turn left" ако самолетът е в дясно. Допълнително, понеже не е нужно самолетът да се намира перфектно в средата на пистата, зачитаме че ако разликата между двата интензитета е по-малка от 4, тогава самолетът е правилно подравнен и връщаме "Follow heading". -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -254,14 +275,15 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. |: Follow heading + ### Задача 11 - GPS -[*В тази задача има много "теория", иначе самия код е малък и лесен.*] +{i В тази задача има много "теория", иначе самия код е малък и лесен.} Кондензирайки възможно най-много, ще обясня как работи GPS. На земята имаме специални методи, чрез които можем да определим позицията на всеки сателит, обаче обратното, определянето на позицията чрез сателит, става с помощта на супер прецизни часовници и малко математика. -Понеже радио комуникацията е със скоростта на светлината, можем лесно да определим разстояния между сателит и дадена точка, считайки колко време е отнело на сателита да върне отговор (припомням формулата [`s = v * t`], или [`разстояние = скорост * време`]). +Понеже радио комуникацията е със скоростта на светлината, можем лесно да определим разстояния между сателит и дадена точка, считайки колко време е отнело на сателита да върне отговор (припомням формулата {` s = v * t}, или {` разстояние = скорост * време}). Обаче, така получаваме само разстоянието, това не е достатъчно за да определим точната позиция, понеже има много възможни точки на земята, които да са на това разстояние. Решението на проблема, е че просто вземаш разстоянието от няколко сателита, твоята позиция се намира в общата точка между всички възможни области. @@ -274,7 +296,7 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. От математика, ако знаем разстоянието на нашия приятел към трети различен човек, трите кръга върху картата ще се пресичат в само една точка, а именно позицията на нашия приятел. В три измерения, правим същото, обаче със сфери, и ни трябват четири сателита. -Понеже математиката в две и три измерения е малко множко, ще разгледаме всичко едноизмерно, в [url https://en.wikipedia.org/wiki/Flatland Lineland]. +Понеже математиката в две и три измерения е малко множко, ще разгледаме всичко едноизмерно, в {url Lineland;https://en.wikipedia.org/wiki/Flatland}. \n @@ -287,9 +309,10 @@ GitHub classroom: [url https://classroom.github.com/a/Bi5dhwW7 classroom.github. Накрая получавате още две числа, пак координата и време, но за втория сателит. Изкарайте къде се намираме ние, като нека скоростта на светлината да бъде 29 метра в милисекунда. -[=Пример=] +{b Пример} -:table_2 +:table +:2 |= Вход |= Изход diff --git a/src/teaching/upp-2023/week2/revision.du b/src/teaching/upp-2023/week2/revision.du index f2d771d..bd9cb2a 100644 --- a/src/teaching/upp-2023/week2/revision.du +++ b/src/teaching/upp-2023/week2/revision.du @@ -1,8 +1,11 @@ -# Преговор - УПП, Седмица 2, 13.10.2023 +'def title Преговор - УПП, Седмица 2, 13.10.2023 +'def desc Преговор на материала + +# {title} \n -[$presentation-controller] +{presentation-controller} :title_slide @@ -13,7 +16,7 @@ ## Конвертиране на данни -[$br3] +{br3} :unordered - Неявно (скрито, експлицитно): компилаторът сам се досеща да промени типа @@ -32,7 +35,7 @@ :slide -[$br5] +{br5} :unordered - Със загуба на информация (от по-голям тип в по-малък) @@ -55,15 +58,15 @@ .p Първо ще ги погледнем чисто теоретично. -.p [=Внимавайте, те са различни от логическите оператори!=] +.p {b Внимавайте, те са различни от логическите оператори!} -.p [=Означавам побитовите числа с водеща буква "b"!=] -Тоест, числото [`b1001`] е двоичното число [`1001`], което е десетичното число [`9`]. +.p {b Означавам побитовите числа с водеща буква "b"!} +Тоест, числото {` b1001} е двоичното число {` 1001}, което е десетичното число {` 9}. -[$br3] +{br3} :unordered -- Отрицание/негация, [`~`]: обръща 0 в 1 и 1 в 0 +- Отрицание/негация, {` ~}: обръща 0 в 1 и 1 в 0 ``` ~ b0010 = b1101 @@ -72,19 +75,19 @@ :slide :unordered -- Побитово "и", [`&`]: за два бита, ако и двете са 1, връща 1, иначе връща 0 +- Побитово "и", {` &}: за два бита, ако и двете са 1, връща 1, иначе връща 0 ``` 3 & 5 = 1 b0011 & b0101 = b0001 -- Побитово "или", [`|`]: за два бита, ако и двете са 0, връща 0, иначе връща 1 +- Побитово "или", {` |}: за два бита, ако и двете са 0, връща 0, иначе връща 1 ``` 3 | 5 = 7 b0011 | b0101 = b0111 -- Изключващо "или", [`^`]: ако само един от двата бита е 1, връща 1, иначе връща 0 +- Изключващо "или", {` ^}: ако само един от двата бита е 1, връща 1, иначе връща 0 ``` 3 ^ 5 = 6 @@ -94,7 +97,7 @@ :middle_slide27 :unordered -- Побитово отместване на ляво, [`<<`]: отмества всеки бит с n позиции на ляво\n +- Побитово отместване на ляво, {` <<}: отмества всеки бит с n позиции на ляво\n Винаги "запълва" с нули (няма разлика между логическо и аритметично ляво отместване) ``` @@ -103,7 +106,7 @@ (приемаме, че типа данни съхранява само 4 бита данни) -- Побитово отместване на дясно, [`>>`]: отмества всеки бит с n позиции на дясно\n +- Побитово отместване на дясно, {` >>}: отмества всеки бит с n позиции на дясно\n При аритметичното отместване, дупките се запълват с предходната стойност на старшия бит\n При логическото отместване, винаги запълваме с 0\n В C++ има един оператор, дали е аритметическо или логическо се определя от типа @@ -118,7 +121,7 @@ Примери с код: -:code_cpp +````cpp int a = 3, b = 5; int n1 = ~ a; // -4 @@ -139,6 +142,7 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 + :slide ## Логически оператори @@ -146,10 +150,10 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 .p Много приличат на побитовите, обаче побитовите работят върху битове, докато логическите работят върху bool. -[$br4] +{br4} :unordered -- [`!`]: обръща [`true`] във [`false`] и обратно +- {` !}: обръща {` true} във {` false} и обратно ```cpp ! true // false @@ -159,14 +163,14 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 :middle_slide :unordered -- [`&&`]: "логическо и", ако и двете стойности са [`true`], тогава и резултатът е [`true`] +- {` &&}: "логическо и", ако и двете стойности са {` true}, тогава и резултатът е {` true} ```cpp true && true // true false && true // false false && false // false -- [`||`]: "логическо или", само ако и двете са [`false`], тогава е [`false`] +- {` ||}: "логическо или", само ако и двете са {` false}, тогава е {` false} ```cpp true || true // true @@ -180,7 +184,7 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 ## Условни конструкции :unordered -- [`if`]: приема булева стойност, ако е [`true`], изпълнява кода в къдравите скоби, ако е [`false`] ги пропуска +- {` if}: приема булева стойност, ако е {` true}, изпълнява кода в къдравите скоби, ако е {` false} ги пропуска ```cpp if (expression) { @@ -188,9 +192,9 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 } dootherthing; - [`expression`] се конвертира към типа [`bool`]\n + {` expression} се конвертира към типа {` bool}\n - Ако в къдравите скоби имаме един израз (тоест е само един ред код, завършващ на [`;`]) можем да ги пропуснем. + Ако в къдравите скоби имаме един израз (тоест е само един ред код, завършващ на {` ;}) можем да ги пропуснем. ```cpp if (expression) dosomething; @@ -200,7 +204,7 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 :middle_slide25 :unordered -- [`if-else`]: работи като [`if`], обаче след къдравите скоби добавяме [`else { ... }`]. +- {` if-else}: работи като {` if}, обаче след къдравите скоби добавяме {` else { ... }}. ```cpp if (expression) { @@ -212,10 +216,10 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 dootherthing; .p - Ако [`expression`] е истина, [`dothing1`] се изпълнява и [`dothing2`] се пропуска изцяло. - Аналогично, ако [`expression`] е лъжа, [`dothing1`] се изпуска и [`dothing2`] се изпълнява. + Ако {` expression} е истина, {` dothing1} се изпълнява и {` dothing2} се пропуска изцяло. + Аналогично, ако {` expression} е лъжа, {` dothing1} се изпуска и {` dothing2} се изпълнява. - .p Както с [`if`], ако [`dothing2`] е само един израз, можем да пропуснем къдравите скоби + .p Както с {` if}, ако {` dothing2} е само един израз, можем да пропуснем къдравите скоби ```cpp if (expression) { @@ -237,7 +241,7 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 else if (expression2) { doSometing2; } - ... + \... else { doSomethingN; } @@ -249,7 +253,7 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 else { if (expression2) doSomething2; else { - ... + \... else doSomethingN; } } @@ -258,8 +262,8 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 :slide :unordered -- [`expression`] винаги се конвертира до тип [`bool`] (ако е нужно)\n - [=Никога не правете такива неща:=] +- {` expression} винаги се конвертира до тип {` bool} (ако е нужно)\n + {b Никога не правете такива неща:} ```cpp bool a; @@ -270,14 +274,14 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 bool a = false; if (expression) a = true; - Просто правите [`bool a = expression;`] + Просто правите {` bool a = expression;} ```cpp bool a; if (expression) a = false; else a = true; - Просто правите [`bool a = ! expression;`] + Просто правите {` bool a = ! expression;} @@ -288,7 +292,7 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 ```cpp (expression) ? valueA : valueB - Ако [`expression`] е истина, връща се [`valueA`], иначе се връща [`valueB`] + Ако {` expression} е истина, връща се {` valueA}, иначе се връща {` valueB} ```cpp int grade; @@ -306,7 +310,7 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 :middle_slide27 :unordered -- [`switch`]: приема стойност и изпълнява случая, при който стойността съвпада с определената +- {` switch}: приема стойност и изпълнява случая, при който стойността съвпада с определената ```cpp switch (value) { @@ -323,10 +327,10 @@ int r5 = (unsigned int)-b >> 1; // 2147483645 else if (value == valueC) doSomething3; .p - [`otherwise`] е като [`else`], това е случая когато не съвпада с никоя стойност. + {` otherwise} е като {` else}, това е случая когато не съвпада с никоя стойност. Може да бъде изпуснат. - .p Без [`break`] изпълнението продължава към следващия [`case`] + .p Без {` break} изпълнението продължава към следващия {` case} diff --git a/src/teaching/upp-2023/week3/index.du b/src/teaching/upp-2023/week3/index.du index 1b0f213..7669ca0 100644 --- a/src/teaching/upp-2023/week3/index.du +++ b/src/teaching/upp-2023/week3/index.du @@ -1,8 +1,11 @@ -# Задачи - УПП, Седмица 3, 20.10.2023 +'def title Задачи - УПП, Седмица 3, 20.10.2023 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/JgMSXuCf classroom.github.com/a/JgMSXuCf] +GitHub classroom: {url classroom.github.com/a/JgMSXuCf;https://classroom.github.com/a/JgMSXuCf} ## Тема: цикли @@ -10,11 +13,12 @@ GitHub classroom: [url https://classroom.github.com/a/JgMSXuCf classroom.github. ### Задача 1 - Степенуване -Получавате цяло число [`x`] и цяло положително число [`n`], трябва да върнете [`x`] на степен [`n`]-та. +Получавате цяло число {` x} и цяло положително число {` n}, трябва да върнете {` x} на степен {` n}-та. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -28,92 +32,112 @@ GitHub classroom: [url https://classroom.github.com/a/JgMSXuCf classroom.github. |: 4 + ### Задача 2 - Progress bar -Получавате цяло число [`x`], което е по-голямо или равно на 1, и на всеки ред трябва да изкарате един "progress bar", чиято дължина се увеличава с всеки изминал ред. -На практика, този "progress bar" трябва да бъде една права, съставена от знакът [`#`], която трябва с всеки изминал ред да се удължава с един знак. -В началото прогресът е 1 и продължава до [`x`] включително. +Получавате цяло число {` x}, което е по-голямо или равно на 1, и на всеки ред трябва да изкарате един "progress bar", чиято дължина се увеличава с всеки изминал ред. +На практика, този "progress bar" трябва да бъде една права, съставена от знакът {` #}, която трябва с всеки изминал ред да се удължава с един знак. +В началото прогресът е 1 и продължава до {` x} включително. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход |: 3 |: ``` +'emplace # ## ### +'endemplace |: 5 |: ``` +'emplace # ## ### #### ##### +'endemplace + #### Бонус -Направете дължината на този progress bar фиксирана на 10 знака, и въведеното [`x`] да определя след колко реда трябва да запълним progress bar-а. +Направете дължината на този progress bar фиксирана на 10 знака, и въведеното {` x} да определя след колко реда трябва да запълним progress bar-а. Този път, прогресът започва от 0. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход |: 1 |: ``` +'emplace ########## +'endemplace |: 2 |: ``` +'emplace ##### ########## +'endemplace |: 3 |: ``` +'emplace ### ###### ########## +'endemplace |: 10 |: ``` +'emplace # ## ### -[*...*] +'endemplace +{i ...} |: 20 |: ``` +'emplace # # ## ## ### -[*...*] +'endemplace +{i ...} + ### Задача 3 - Endless program with an end От входа получавате букви, не се знае колко. На нов ред, за всяка буква, трябва да върнете "letter" ако е латинска буква, "digit" ако е цифра и "other" ако не е нито едно от двете. -Обаче, буквата [`^`] има специално значение, когато я получим трябва програмата да свърши изпълнение. +Обаче, буквата {` ^} има специално значение, когато я получим трябва програмата да свърши изпълнение. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -126,17 +150,19 @@ other letter + ### Задача 4 - Premature end -Ще получите максимум 10 цели числа, трябва (целочислено) да разделите числото [`65536`] на всяко от въведените числа. +Ще получите максимум 10 цели числа, трябва (целочислено) да разделите числото {` 65536} на всяко от въведените числа. Но, когато получите числото 0, веднага трябва да спрете вземане на числа от входа. Финално, изкарайте резултата от всички тези деления. -[=Упътване:=] Използвайте [`break`]. +{b Упътване:} Използвайте {` break}. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -156,19 +182,20 @@ letter Получавате букви, незнайно колко. Трябва да броите колко от тях са малки букви, колко са главни и колко са цифри. -В момента в който получите [`$`] трябва да спрете приемане на букви и да изкарате +В момента в който получите {` $} трябва да спрете приемане на букви и да изкарате ``` Lowercase: X Uppercase: Y Digit: Z където X, Y и Z са съответните бройки. -Обаче, ако получите буква, която не е малка, главна, цифра или [`$`], трябва моментално да спрете изпълнението на програмата, без да отпечатвате нищо. +Обаче, ако получите буква, която не е малка, главна, цифра или {` $}, трябва моментално да спрете изпълнението на програмата, без да отпечатвате нищо. -[=Упътване:=] Използвайте [`return`]. +{b Упътване:} Използвайте {` return}. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -179,28 +206,30 @@ Lowercase: X Uppercase: Y Digit: Z |: + ### Задача 6 - Глупави сметки От входа получавате букви, това ще са "команди", като при всяка буква трябва да направите различно действие: .bulleted -- [`s`]: след като я получите, трябва да вземете цяло число от входа и да го запазите (първоначалната стойност на числото е 15) -- [`l`]: трябва побитово да отместите наляво запазеното число с един бит -- [`r`]: трябва побитово да отместите надясно запазеното число с един бит -- [`q`]: трябва да запазите сегашното число на втора степен -- [`c`]: трябва да запазите сегашното число на трета степен -- [`m`]: трябва да запазите сегашното число минус 351 -- [`p`]: трябва да запазите сегашното число плюс 94 -- [`&`]: прекратявате програмата +- {` s}: след като я получите, трябва да вземете цяло число от входа и да го запазите (първоначалната стойност на числото е 15) +- {` l}: трябва побитово да отместите наляво запазеното число с един бит +- {` r}: трябва побитово да отместите надясно запазеното число с един бит +- {` q}: трябва да запазите сегашното число на втора степен +- {` c}: трябва да запазите сегашното число на трета степен +- {` m}: трябва да запазите сегашното число минус 351 +- {` p}: трябва да запазите сегашното число плюс 94 +- {` &}: прекратявате програмата След всяка операция трябва да изкарате сегашната стойност на числото. -Обаче, ако се въведе буква, за която няма дефинирана операция (не е команда) трябва да изкарате "Invalid command!" и да [=не=] изкарвате сегашната стойност на числото. +Обаче, ако се въведе буква, за която няма дефинирана операция (не е команда) трябва да изкарате "Invalid command!" и да {b не} изкарвате сегашната стойност на числото. -[=Упътване:=] Използвайте [`switch`], [`default`] и [`continue`]. +{b Упътване:} Използвайте {` switch}, {` default} и {` continue}. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -224,6 +253,7 @@ Invalid command! 1 + ### Задача 7 - Безсмислена "тивност" Получавате от входа число с плаваща запетая. @@ -232,11 +262,12 @@ Invalid command! Първоначалната стойност на числото е 3.14159 и трябва в началото да изкарате "Positive". -[=Упътване:=] Използвайте [`do-while`]. +{b Упътване:} Използвайте {` do-while}. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -255,23 +286,24 @@ Negative Получавате букви (команди), като на всяка трябва да извършите някакво действие: :bulleted -- [`t`] - увеличавате минутите с единица (не забравяйте, че ако времето е било "0:59", трябва да стане "1:00") и изкарвате сегашното време -- [`c`] - в зависимост от предишни натискания, прави различни неща: +- {` t} - увеличавате минутите с единица (не забравяйте, че ако времето е било "0:59", трябва да стане "1:00") и изкарвате сегашното време +- {` c} - в зависимост от предишни натискания, прави различни неща: .bulleted - ако преди не е натиснат, влизаме в режим на промяна на часовете, от входа приемаме число което ще бъде новия час и изкарваме сегашното време - ако вече е натиснат, влизаме в режим на минутите, от входа приемаме число, което ще бъде новата стойност на минутите и изкарваме сегашното време - ако вече два пъти е бил натиснат, излизаме от режима - - ако сме в някой от първите два режима и получим [`t`] преди да излезем, не увеличаваме минутите + - ако сме в някой от първите два режима и получим {` t} преди да излезем, не увеличаваме минутите -- [`f`] - променяме изкараното време от 12 часов формат на 24 часов и обратно, като първоначално започваме с 24 часов, и изкарваме сегашното време +- {` f} - променяме изкараното време от 12 часов формат на 24 часов и обратно, като първоначално започваме с 24 часов, и изкарваме сегашното време .bulleted - - При 24 часов формат изкарваме "XX:YY", където [`XX`] е часа и [`YY`] са минутите + - При 24 часов формат изкарваме "XX:YY", където {` XX} е часа и {` YY} са минутите - При 12 часов формат е почти същото "XX:YY ZM" където ZM е PM или AM -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -286,6 +318,7 @@ Negative 7:3 PM + ### Задача 9 - BASIC maze Това е една популярна тестова програма на (много стари) компютри, които са идвали с интерпретатор на езика BASIC: @@ -293,9 +326,9 @@ Negative ``` 10 PRINT CHR$(205.5+RND(1));:GOTO 10 -Задачата е да я пресъздадем, тоест на 20 реда трябва да има по 20 букви, като всяка буква е, на случаен принцип, [`/`] или [`\\`] . +Задачата е да я пресъздадем, тоест на 20 реда трябва да има по 20 букви, като всяка буква е, на случаен принцип, {` /} или {` \\} . -[=Упътване:=] Формално никога не се преподават или изискват случайни стойности, затова ги показвам сега: +{b Упътване:} Формално никога не се преподават или изискват случайни стойности, затова ги показвам сега: Най-отгоре на сорс-файла добавете нужната библиотека: @@ -303,21 +336,21 @@ Negative #include <stdlib.h> #include <ctime> -След това, в [`main`], преди да използвате случайни стойности, трябва да "инициализираме системата": +След това, в {` main}, преди да използвате случайни стойности, трябва да "инициализираме системата": ```cpp srand(time(NULL)); -С функцията [`rand()`] получавате случайна положителна стойност, може да я ограничите до две стойности с модулно деление, [`rand() % 2`]. +С функцията {` rand()} получавате случайна положителна стойност, може да я ограничите до две стойности с модулно деление, {` rand() % 2}. -[=Примерен изход=] [*Нямаме вход, вашия изход няма да изглежда напълно еднакъв*] +{b Примерен изход} {i Нямаме вход, вашия изход няма да изглежда напълно еднакъв} ``` -'include ./example_maze.txt +'snippet 1 $ ./example_maze.txt ### Задача 10 - Елка -[*Решението на тази задача е по-дълго!*] +{i Решението на тази задача е по-дълго!} Сега имплементирате кода на една елка. Елката запазва две числа, първото е "сегашното" число с което правим нормалните операции и "виждаме" на екрана, и второто е отделна памет, в която можем да добавяме и изваждаме числа. @@ -328,16 +361,17 @@ srand(time(NULL)); Буквата е команда, като може да бъде +,-,\*,/, които са обикновените операции с които променяме сегашното число, докато: .bulleted -- [`a`] - добавя сегашното число в отделната памет -- [`s`] - изважда сегашното число от тази памет -- [`c`] - занулява сегашното число -- [`m`] - занулява числото в отделната памет +- {` a} - добавя сегашното число в отделната памет +- {` s} - изважда сегашното число от тази памет +- {` c} - занулява сегашното число +- {` m} - занулява числото в отделната памет -След [`a`], [`s`] и [`m`] трябва да изкарате числото в отделната памет, докато след всички други команди трябва да изкарате сегашното число. +След {` a}, {` s} и {` m} трябва да изкарате числото в отделната памет, докато след всички други команди трябва да изкарате сегашното число. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -352,6 +386,7 @@ srand(time(NULL)); 0 + ## Тема: assert \n @@ -363,7 +398,7 @@ srand(time(NULL)); ``` int parseSensor(int s) { return ((((s=(s>>1)&(~0xF617A100))<0x54)?s|0xF01:s&0xCBFF)>>2)-21; } -Все още не сме учили функции, затова просто пльоснете горното нещо във вашия сорс код, [*над*] [`int main()`] и [*в*] [`main`] може да я използвате чрез [`parseSensor(inputValue)`]. +Все още не сме учили функции, затова просто пльоснете горното нещо във вашия сорс код, {i над} {` int main()} и {i в} {` main} може да я използвате чрез {` parseSensor(inputValue)}. Вашата задача е при определени градуси да връщате съобщение на екрана: @@ -376,7 +411,7 @@ int parseSensor(int s) { return ((((s=(s>>1)&(~0xF617A100))<0x54)?s|0xF01:s&0xCB Обаче, това не е всичко. Поглеждате функцията на вашия колега и не сте уверени в нея, обаче нямате документацията за обработка на входа. -Единственото нещо, което знаете, е че стойностите от функцията не трябва да са извън обхвата -20 и 40, затова използвайте [`assert`] и проверете/тествайте дали това винаги е вярно. +Единственото нещо, което знаете, е че стойностите от функцията не трябва да са извън обхвата -20 и 40, затова използвайте {` assert} и проверете/тествайте дали това винаги е вярно. Ето стойности с които може да тествате: @@ -391,9 +426,10 @@ int parseSensor(int s) { return ((((s=(s>>1)&(~0xF617A100))<0x54)?s|0xF01:s&0xCB На кои стойности функцията на колегата не работи? -[=Примери=] [*Входът е различен от горепосочените стойности (и при него функцията работи коректно)*] +{b Примери} {i Входът е различен от горепосочените стойности (и при него функцията работи коректно)} -:table_2 +:table +:2 |= Вход |= Изход diff --git a/src/teaching/upp-2023/week3/revision.du b/src/teaching/upp-2023/week3/revision.du index bcbdafa..99875e2 100644 --- a/src/teaching/upp-2023/week3/revision.du +++ b/src/teaching/upp-2023/week3/revision.du @@ -1,8 +1,11 @@ -# Преговор - УПП, Седмица 3, 20.10.2023 +'def title Преговор - УПП, Седмица 3, 20.10.2023 +'def desc Преговор на материала + +# {title} \n -[$presentation-controller] +{presentation-controller} :title_slide35 @@ -20,7 +23,7 @@ bool b; if (condition) b = true; - Грешно е, понеже [`condition`] сам по себе си е от тип bool, с този [`if`] буквално не правите нищо. + Грешно е, понеже {` condition} сам по себе си е от тип bool, с този {` if} буквално не правите нищо. Правилния вариант е: ```cpp @@ -48,7 +51,7 @@ .p Всяка буква действително съответства на определено число, дефинирано от ASCII стандарта. - Наистина '0' е 48 и '9' е 57, обаче от вас [=не=] се очаква да помните ASCII таблицата! + Наистина '0' е 48 и '9' е 57, обаче от вас {b не} се очаква да помните ASCII таблицата! Също, ако не знаеш наизуст кои буква са тези числа, този израз е много неясен. .p @@ -63,11 +66,11 @@ ## С/без загуба на данни -[$br3] +{br3} .p Получи се малко разногласие между това, което Ивана ви е казала и това което аз ви казах. -В края на деня, [=конвертиране от int към unsigned int не губи информация!=] +В края на деня, {b конвертиране от int към unsigned int не губи информация!} .p Цитирайки 4то издание на "The C++ Programming Language" глава 10.5: @@ -88,7 +91,7 @@ A conversion is value-preserving if you can convert a value and then convert the .p Как бихме ги използвали, за да представим отрицателните числа? -Най-лесния начин е да погледнем най-левия (старшия) бит, ако е 0 значи е положително, ако е 1 значи е отрицателно, тоест [`010`] е 2, докато [`110`] е -2. +Най-лесния начин е да погледнем най-левия (старшия) бит, ако е 0 значи е положително, ако е 1 значи е отрицателно, тоест {` 010} е 2, докато {` 110} е -2. Ако разпишем всичките ни числа: ``` @@ -175,17 +178,17 @@ A conversion is value-preserving if you can convert a value and then convert the Това е идеята на "complements", дефинираме отрицателни числа, така че да използваме едно и също събиране между положителни и отрицателни. .p -Още от много старите "калкулатори" ([url https://en.wikipedia.org/wiki/Adding_machine сумиращи машини]), изваждането се е свеждало до събиране на положително и отрицателно число. +Още от много старите "калкулатори" ({url сумиращи машини;https://en.wikipedia.org/wiki/Adding_machine}), изваждането се е свеждало до събиране на положително и отрицателно число. .p -И това е причината защо [`~ 2`] връща [`-3`]: +И това е причината защо {` ~ 2} връща {` -3}: ``` ~ 00000000000000000000000000000010 ────────────────────────────────── 11111111111111111111111111111101 -И затова при [`>>`] със знаков тип имаме аритметическо отместване: +И затова при {` >>} със знаков тип имаме аритметическо отместване: ``` 11111111111111111111111111111101 >> 1 @@ -197,17 +200,17 @@ A conversion is value-preserving if you can convert a value and then convert the ## Цикли -[$br4] +{br4} :unordered -- [`while`] цикъл +- {` while} цикъл ```cpp while (условие) { тяло } - "условие" е булева стойност, като ако е [`false`] цикъла спира, докато ако е [`true`] "тяло" се изпълнява и после пак се проверява условие + "условие" е булева стойност, като ако е {` false} цикъла спира, докато ако е {` true} "тяло" се изпълнява и после пак се проверява условие @@ -215,7 +218,7 @@ A conversion is value-preserving if you can convert a value and then convert the - Може да си го представите като - :code_cpp + ````cpp if (условие) { тяло } @@ -229,14 +232,15 @@ A conversion is value-preserving if you can convert a value and then convert the else { спри } - ... + \... + :slide :unordered -- [`do-while`] цикъл, като [`while`], но "тяло" се изпълнява поне един път +- {` do-while} цикъл, като {` while}, но "тяло" се изпълнява поне един път ```cpp do { @@ -245,7 +249,7 @@ A conversion is value-preserving if you can convert a value and then convert the Нашият аналог е: - :code_cpp + ````cpp тяло if (условие) { @@ -256,14 +260,15 @@ A conversion is value-preserving if you can convert a value and then convert the } if (условие) { - ... + \... + :middle_slide :unordered -- [`for`] цикъл +- {` for} цикъл ```cpp for (инициализация; условие; инкрементация) { @@ -271,7 +276,7 @@ A conversion is value-preserving if you can convert a value and then convert the } "инициализация" се изпълнява само веднъж, преди всичко останало в цикъла\n - "условие" се изпълнява преди всяка итерация, като ако е [`false`] цикъла спира, докато ако е [`true`] продължава\n + "условие" се изпълнява преди всяка итерация, като ако е {` false} цикъла спира, докато ако е {` true} продължава\n "инкрементация" се изпълнява след края на всяка итерация @@ -280,7 +285,7 @@ A conversion is value-preserving if you can convert a value and then convert the :unordered - Може да си представяте, че това на практика извършва: - :code_cpp + ````cpp инициализация if (условие) { @@ -298,14 +303,15 @@ A conversion is value-preserving if you can convert a value and then convert the else { спри } - ... + \... + :middle_slide :unordered -- или използвайки [`while`] цикъл: +- или използвайки {` while} цикъл: ```cpp инициализация @@ -320,18 +326,18 @@ A conversion is value-preserving if you can convert a value and then convert the ### Ключови думи -[$br3] +{br3} :unordered -- [`break`]: моментално прекратява изпълнението на цикъла +- {` break}: моментално прекратява изпълнението на цикъла - .p При [`for`] цикли инкрементацията не се изпълнява след [`break`] + .p При {` for} цикли инкрементацията не се изпълнява след {` break} -[$br2] +{br2} -- [`continue`]: продължи след края на сегашната итерация; тоест изпълнението на тяло се прекратява и започваме нова итерация +- {` continue}: продължи след края на сегашната итерация; тоест изпълнението на тяло се прекратява и започваме нова итерация - .p При [`for`] цикли директно отива на инкрементация + .p При {` for} цикли директно отива на инкрементация @@ -339,17 +345,18 @@ A conversion is value-preserving if you can convert a value and then convert the ## Assert -[$br3] +{br3} .p Понякога е полезно да тестваме нашия код вътре в самия код. Тоест, искаме на конкретно място в кода да проверим нещо. + ```cpp assert(condition); .p -Ако [`condition`] е [`true`], нищо не се случва, обаче ако е [`false`] програмата моментално прекратява изпълнение. +Ако {` condition} е {` true}, нищо не се случва, обаче ако е {` false} програмата моментално прекратява изпълнение. .p -Използва се повече като програмистки уред, тоест ако програмата спре заради [`assert`], това е защото има някаква програмистка грешка. +Използва се повече като програмистки уред, тоест ако програмата спре заради {` assert}, това е защото има някаква програмистка грешка. diff --git a/src/teaching/upp-2023/week4/index.du b/src/teaching/upp-2023/week4/index.du index 425ffbd..48b8c61 100644 --- a/src/teaching/upp-2023/week4/index.du +++ b/src/teaching/upp-2023/week4/index.du @@ -1,12 +1,15 @@ -# Задачи - УПП, Седмица 4, 27.10.2023 +'def title Задачи - УПП, Седмица 4, 27.10.2023 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/jqKaO1ny classroom.github.com/a/jqKaO1ny] +GitHub classroom: {url classroom.github.com/a/jqKaO1ny;https://classroom.github.com/a/jqKaO1ny} ## Задача 1 - Числен редактор -Получавате число [`N`], което ще е в обхвата от 1 до 10000000000000000000. +Получавате число {` N}, което ще е в обхвата от 1 до 10000000000000000000. Вашата програма трябва да поддържа няколко операции върху това число, включително копиране на редица от цифри в него и поставянето им в друга част на числото. Подробните операции ще получите по-късно, и не е нужно да валидирате вход или дали след дадена операция числото се побира в типа данни. @@ -16,7 +19,7 @@ GitHub classroom: [url https://classroom.github.com/a/jqKaO1ny classroom.github. Всичките операции трябва да бъдат отделени във функции. Затова, и за улеснение, задачата е разделена на стъпки: -[=ВАЖНО:=] В решението [=НЕ=] може да изполвате масиви, вектори, ..., както и каквито и да е функции, които не сте написали вие! +{b ВАЖНО:} В решението {b НЕ} може да изполвате масиви, вектори, ..., както и каквито и да е функции, които не сте написали вие! ### Подточка а) Примитивните функции @@ -25,69 +28,70 @@ GitHub classroom: [url https://classroom.github.com/a/jqKaO1ny classroom.github. Имплементирайте функциите: :unordered -- [`get`], която приема число, начален индекс и краен индекс (в този ред)\n +- {` get}, която приема число, начален индекс и краен индекс (в този ред)\n Тя връща подчислото, което започва от началния и завършва в крайния индекс. - .p Пример: [`get(481395, 2, 4)`] връща [`813`] + .p Пример: {` get(481395, 2, 4)} връща {` 813} -- [`remove`], която приема число, начален индекс и дължина (в този ред)\n +- {` remove}, която приема число, начален индекс и дължина (в този ред)\n Връща числото, без "дължина" на брой цифри от началния индекс - .p Пример: [`remove(481395, 3, 3)`] връща [`485`] + .p Пример: {` remove(481395, 3, 3)} връща {` 485} -- [`insert`], която приема число, начален индекс, дължина и число за вмъкване\n +- {` insert}, която приема число, начален индекс, дължина и число за вмъкване\n Връща числото, като на началния индекс намираме началото на вмъкнатото число с дължина "дължина"\n Ефектът, е че числото се вмъква на дадения индекс, обаче избутва цифрите в ляво от него, вместо тези от дясно. - .p Пример: [`insert(495, 2, 4, 1001)`] връща [`4100195`] + .p Пример: {` insert(495, 2, 4, 1001)} връща {` 4100195} ### Подточка б) Композитните функции Сега е време да имплементираме съществената логика в задачата. -Използвайки [=само=] примитивните функции, имплементирайте функциите: +Използвайки {b само} примитивните функции, имплементирайте функциите: :unordered -- [`copy`], която приема число, начален индекс, дължина и втори начален индекс\n +- {` copy}, която приема число, начален индекс, дължина и втори начален индекс\n Връща числото, като от втория начален индекс, следващите "дължина" на брой цифри съвпадат с "дължина" на брой цифри от първия начален индекс - .p Пример: [`copy(481395, 3, 4, 2)`] връща [`4139581395`] + .p Пример: {` copy(481395, 3, 4, 2)} връща {` 4139581395} -- [`cut`], която приема число, начален индекс, дължина и втори начален индекс\n +- {` cut}, която приема число, начален индекс, дължина и втори начален индекс\n Връща числото, като "дължина" на брой цифри от (стария) начален индекс са преместени във втория начален индекс - .p Пример: [`cut(481395, 3, 4, 2)`] връща [`413958`] + .p Пример: {` cut(481395, 3, 4, 2)} връща {` 413958} -- [`replace`], която приема число, начален индекс, дължина и число за замяна\n +- {` replace}, която приема число, начален индекс, дължина и число за замяна\n Връща числото, като "дължина" на брой цифри от начален индекс са заменени с числото за замяна\n - Заменените цифри и числото за замяна [=може да имат различни дължини=]! + Заменените цифри и числото за замяна {b може да имат различни дължини}! - .p Пример: [`replace(481395, 4, 2, 705)`] връща [`4817055`] + .p Пример: {` replace(481395, 4, 2, 705)} връща {` 4817055} -- [`prepend`], която приема две числа\n +- {` prepend}, която приема две числа\n Връща долепени второто и първото число - .p Пример: [`prepend(395, 81)`] връща [`81395`] + .p Пример: {` prepend(395, 81)} връща {` 81395} -- [`append`], която приема две числа\n +- {` append}, която приема две числа\n Връща долепени първото и второто число - .p Пример: [`append(395, 81)`] връща [`39581`] + .p Пример: {` append(395, 81)} връща {` 39581} ### Подточка в) Вход и изход Последно, време е да имплементираме интерфейса на програмата. -Както вече казахме, първия вход е числото [`N`] с което ще извършим операция. +Както вече казахме, първия вход е числото {` N} с което ще извършим операция. -След това приемаме буква, която определя нашата (композитна) функция, като за всички функции използваме първата буква в името им, освен за [`cut`], за която използваме [`x`]. -Тоест, [`c`] означава, че ще "copy"-ваме, [`p`] че ще "prepend"-ваме, [`x`] че ще "cut"-ваме и так. нат. +След това приемаме буква, която определя нашата (композитна) функция, като за всички функции използваме първата буква в името им, освен за {` cut}, за която използваме {` x}. +Тоест, {` c} означава, че ще "copy"-ваме, {` p} че ще "prepend"-ваме, {` x} че ще "cut"-ваме и так. нат. След като въведем буква, трябва да приемем съответния за дадената функция брой аргументи и да изкараме на екрана резултата от функцията. -[=Примери=] +{b Примери} -:table_2 +:table +:2 |= Вход |= Изход @@ -104,6 +108,7 @@ GitHub classroom: [url https://classroom.github.com/a/jqKaO1ny classroom.github. |: 86998385021843839 + ## Задача 2 - Умножение на полиноми Представяме полином чрез две числа, първото побитово определя дали x на конкретната степен съществува, докато второто определя коефициента (като цифра) пред всеки член, без значение дали съществува в полинома. @@ -111,7 +116,7 @@ GitHub classroom: [url https://classroom.github.com/a/jqKaO1ny classroom.github. Числото с коефициенти е между 1 и 10000000000000000000. Пример: първото число е 13, a второто е 3052. -Побитово [`13 = 1101`], тоест ще имаме +Побитово {` 13 = 1101}, тоест ще имаме ``` x³ * 1 + x² * 1 + x¹ * 0 + x⁰ * 1 @@ -121,15 +126,15 @@ x³ * 1 + x² * 1 + x¹ * 0 + x⁰ * 1 ``` 3 * x³* 1 + 0 * x² * 1 + 5 * x¹ * 0 + 2 * x⁰ * 1 -Финално, нашия полином, кодиран от числата 13 и 3052 е [`3x³ + 2`]. +Финално, нашия полином, кодиран от числата 13 и 3052 е {` 3x³ + 2}. От входа получавате два полинома, трябва да ги умножите и да изкарате получилия се полином (пак във формата с две числа). -[=ВАЖНО:=] В решението [=НЕ=] може да изполвате масиви, вектори, ..., както и каквито и да е функции, които не сте написали вие! +{b ВАЖНО:} В решението {b НЕ} може да изполвате масиви, вектори, ..., както и каквито и да е функции, които не сте написали вие! ## Задача 3 - Дъската на Зар -[*Името си го измислих, няма връзка с нещо :)*] +{i Името си го измислих, няма връзка с нещо :)} Дъската на Зар е една много проста игра. Имаме два играча, които играят върху квадратна дъска, като на всяка "клетка" има цифра (0 до 9). @@ -143,7 +148,7 @@ x³ * 1 + x² * 1 + x¹ * 0 + x⁰ * 1 Пример: ако играем с дъска 5х5, намираме се на реда "25486" и позицията на първия играч е първата, тогава ходът му изглежда така (с "V" показваме къде се намира): -:code +```` V 25486 Прочита цифрата 2, значи трябва да се премести с две клетки на дясно @@ -171,11 +176,11 @@ V Накрая на играта, трябва да сравните точките на първия и втория играч и да изкарате кой е победил (или дали никой не е). Един ред може да се представи като цяло число и обработваме ред по ред, без да се връщаме назад. -Тоест, първо от входа получавате число [`N`], което е размера на дъската. -След това ще получавате [`N`] числа, всяко с [`N`] цифри в десетичния си запис, като след получаване на едно число изпълнявате ходовете на всички играчи. +Тоест, първо от входа получавате число {` N}, което е размера на дъската. +След това ще получавате {` N} числа, всяко с {` N} цифри в десетичния си запис, като след получаване на едно число изпълнявате ходовете на всички играчи. -[=ВАЖНО:=] В решението [=НЕ=] може да изполвате масиви, вектори, ..., както и каквито и да е функции, които не сте написали вие! +{b ВАЖНО:} В решението {b НЕ} може да изполвате масиви, вектори, ..., както и каквито и да е функции, които не сте написали вие! -[=Упътване:=] +{b Упътване:} Лесно се получава, ако занулим цифрите които първия играч е посетил. Още по-лесно става ако използвате функции от първата задача. diff --git a/src/teaching/upp-2023/week4/revision.du b/src/teaching/upp-2023/week4/revision.du index 622df06..b659a05 100644 --- a/src/teaching/upp-2023/week4/revision.du +++ b/src/teaching/upp-2023/week4/revision.du @@ -1,6 +1,9 @@ -# Преговор - УПП, Седмица 4, 27.10.2023 +'def title Преговор - УПП, Седмица 4, 27.10.2023 +'def desc Преговор на материала -[$presentation-controller] +# {title} + +{presentation-controller} :title_slide35 @@ -20,9 +23,9 @@ - Ще изисквам добър стил при писане на код .bulleted - - Това означава добре подравнен код, празни символи около оператори [=и=] свестни имена на променливи + - Това означава добре подравнен код, празни символи около оператори {b и} свестни имена на променливи - Името на променлива не трябва да бъде 150 знака, но трябва да е разбираемо какво съдържа - - [=Без шльокавица!=] + - {b Без шльокавица!} - Преговорът ще бъде за вас да си го четете (освен ако не трябва да преподам нещо ново) - Ще може да предавате задания след срока!\n @@ -30,7 +33,7 @@ -[*Нещата за 2s compliment се намират и в [url ../week3/revision.html?a преговора на миналата седмица], ама го написах след като свърши часа, затова го копирам и тук.*] +{i Нещата за 2s compliment се намират и в {url преговора на миналата седмица;../week3/revision.html?a}, ама го написах след като свърши часа, затова го копирам и тук.} :slide @@ -42,7 +45,7 @@ .p Как бихме ги използвали, за да представим отрицателните числа? -Най-лесния начин е да погледнем най-левия (старшия) бит, ако е 0 значи е положително, ако е 1 значи е отрицателно, тоест [`010`] е 2, докато [`110`] е -2. +Най-лесния начин е да погледнем най-левия (старшия) бит, ако е 0 значи е положително, ако е 1 значи е отрицателно, тоест {` 010} е 2, докато {` 110} е -2. Ако разпишем всичките ни числа: ``` @@ -134,17 +137,17 @@ Това е идеята на "complements", дефинираме отрицателни числа, така че да използваме едно и също събиране между положителни и отрицателни. .p -Още от много старите "калкулатори" ([url https://en.wikipedia.org/wiki/Adding_machine сумиращи машини]), изваждането се е свеждало до събиране на положително и отрицателно число. +Още от много старите "калкулатори" ({url сумиращи машини;https://en.wikipedia.org/wiki/Adding_machine}), изваждането се е свеждало до събиране на положително и отрицателно число. .p -И това е причината защо [`~ 2`] връща [`-3`]: +И това е причината защо {` ~ 2} връща {` -3}: ``` ~ 00000000000000000000000000000010 ────────────────────────────────── 11111111111111111111111111111101 -И затова при [`>>`] със знаков тип имаме аритметическо отместване: +И затова при {` >>} със знаков тип имаме аритметическо отместване: ``` 11111111111111111111111111111101 >> 1 @@ -162,17 +165,17 @@ тяло } -Като [`<АРГУМЕНТИ>`] са двойки от типа [`ТИП ИМЕ`], разделени със запетаи. -Един вид, аргументите са променливи към [`тяло`], които задаваме извън функцията. +Като {` <АРГУМЕНТИ>} са двойки от типа {` ТИП ИМЕ}, разделени със запетаи. +Един вид, аргументите са променливи към {` тяло}, които задаваме извън функцията. -Извикваме функция чрез [`име(<СТОЙНОСТИ>)`], като [`<СТОЙНОСТИ>`] са разделени със запетая и всяка съответства на поредния тип в аргументите на функцията. -Там, където пишем [`име(<СТОЙНОСТИ>)`] се "замества" с върнатата стойност от функцията. +Извикваме функция чрез {` име(<СТОЙНОСТИ>)}, като {` <СТОЙНОСТИ>} са разделени със запетая и всяка съответства на поредния тип в аргументите на функцията. +Там, където пишем {` име(<СТОЙНОСТИ>)} се "замества" с върнатата стойност от функцията. -Връщаме стойност като напишем във функцията [`return СТОЙНОСТ;`]. +Връщаме стойност като напишем във функцията {` return СТОЙНОСТ;}. Една функция трябва да бъде декларирана преди да бъде използвана, тоест кода -:code_cpp +````cpp #include <iostream> int main() { @@ -180,7 +183,7 @@ int main() { } int doSomething() { - ... + \... } @@ -192,7 +195,7 @@ int doSomething() { Тоест горния пример ще работи ако имаме: -:code_cpp +````cpp #include <iostream> int doSomething(); @@ -202,5 +205,5 @@ int main() { } int doSomething() { - ... + \... } diff --git a/src/teaching/upp-2023/week5/index.du b/src/teaching/upp-2023/week5/index.du index 2673077..ba2c114 100644 --- a/src/teaching/upp-2023/week5/index.du +++ b/src/teaching/upp-2023/week5/index.du @@ -1,8 +1,11 @@ -# Задачи - УПП, Седмица 5, 03.11.2023 +'def title Задачи - УПП, Седмица 5, 03.11.2023 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/3KoIQ71H classroom.github.com/a/3KoIQ71H] +GitHub classroom: {url classroom.github.com/a/3KoIQ71H;https://classroom.github.com/a/3KoIQ71H} ## Задача 1 @@ -10,11 +13,12 @@ GitHub classroom: [url https://classroom.github.com/a/3KoIQ71H classroom.github. Направете функция, която получава два двуизмерни координата, покомпонентно ги сумира и връща резултатните координати. Няма как функцията да върне две стойности, затова добаваете оше два аргумента, които да са указатели към променливи в които да запазим сумираните координати. -От входа получавате два координата, след това връщате тяхната покомпонентна сума [=използвайки функцията=]. +От входа получавате два координата, след това връщате тяхната покомпонентна сума {b използвайки функцията}. -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -22,20 +26,22 @@ GitHub classroom: [url https://classroom.github.com/a/3KoIQ71H classroom.github. |: 6.1 -99.241 + ## Задача 2 Използвайки масиви, имплементирайте 30-цифрени цели положителни числа. Трябва да поддържате операциите събиране и изваждане между две такива числа. Първо ще получите 30 цифри, които отговарят на първото числа, после още 30 цифри, които отговарят на втрото число и накрая ще получите знак. -Ако знака е [`+`], трябва да ги съберете и да изкарате резултата на екрана. -Ако знака е [`-`], трябва да ги извадите и да изкарате резултата на екрана. +Ако знака е {` +}, трябва да ги съберете и да изкарате резултата на екрана. +Ако знака е {` -}, трябва да ги извадите и да изкарате резултата на екрана. При изкарване трябва да следвате "нормалните" правила: цифрите са долепени и водещите нули не се пишат. -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -72,24 +78,26 @@ GitHub classroom: [url https://classroom.github.com/a/3KoIQ71H classroom.github. |: 999999999999999999999999999999 + ## Задача 3 Получавате редица цифри. Ако имаме поне 3 повтарящи се цифри една след друга, можем да ги премахнем. -Тоест редицата [`0 3 1 2 2 2 4 7`] може да стане [`0 3 1 4 7`]. +Тоест редицата {` 0 3 1 2 2 2 4 7} може да стане {` 0 3 1 4 7}. След едно премахване, трябва да можем после да премахнем новопоявило се премахване. -Тоест редицата [`5 1 3 3 3 3 1 1 1 9 2`] първо става [`5 1 1 1 1 9 2`] и след това [`5 9 2`]. +Тоест редицата {` 5 1 3 3 3 3 1 1 1 9 2} първо става {` 5 1 1 1 1 9 2} и след това {` 5 9 2}. Не е нужно да гледате напред за възможно най-много премахване. -Тоест в случая [`8 1 3 4 4 4 5 5 5 5 4 4`] не се очаква да предвидите, че ако първо премахнете 5-те, после ще може да премахнете всички 4ки. +Тоест в случая {` 8 1 3 4 4 4 5 5 5 5 4 4} не се очаква да предвидите, че ако първо премахнете 5-те, после ще може да премахнете всички 4ки. Премахвате първата валидна повтаряща се редица, връщате се малко назад, поглеждате дали някоя нова редица не се е появила, премахвате нея или отивате на следващата. -От входа първо получавате броя [`N`] на цифрите в редицата, като [`N`] е между 1 и 40. -След това получавате [`N`] на брой цифри и накрая връщате редицата с премахнати повтаряния. +От входа първо получавате броя {` N} на цифрите в редицата, като {` N} е между 1 и 40. +След това получавате {` N} на брой цифри и накрая връщате редицата с премахнати повтаряния. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -108,21 +116,23 @@ GitHub classroom: [url https://classroom.github.com/a/3KoIQ71H classroom.github. |: 7 1 5 2 1 7 2 1 2 1 7 2 6 1 6 7 6 9 7 3 8 6 6 5 1 2 7 4 6 8 3 8 2 2 6 9 4 2 6 5 + ## Задача 4 Получавате редица числа. Всяко число е индекс към друго число в редицата (индексите започва от 0). -Започвайки от всяка цифра, проследяваме всички "скоци", тоест ако имаме [`1 3 0 2`] и започваме от индекс 0, тогава от него скачаме на индекс 1, от него на индекс 3, от него на индекс 2 и от него се връщаме в индекс 0. -Докато прескачаме не може да посетим вече посетен индекс, тоест ако имаме [`1 3 0 1`], от 0 отиваме в 1, от 1 в 3 и от 3 в 1, обаче вече сме посетили индекс 1, така че спираме да скачаме. +Започвайки от всяка цифра, проследяваме всички "скоци", тоест ако имаме {` 1 3 0 2} и започваме от индекс 0, тогава от него скачаме на индекс 1, от него на индекс 3, от него на индекс 2 и от него се връщаме в индекс 0. +Докато прескачаме не може да посетим вече посетен индекс, тоест ако имаме {` 1 3 0 1}, от 0 отиваме в 1, от 1 в 3 и от 3 в 1, обаче вече сме посетили индекс 1, така че спираме да скачаме. Търси се колко най-много скока можем да направим, започайки от който и да е индекс. Ако има няколко индекса с максималния брой скоци, връщаме само първия. -Получавате от входа брой [`N`] на числата (индексите), като [`N`] е между 1 и 30, след това получавате толкова на брой числа (между 0 и N-1) и накрая връщате при кой начален индекс имаме най-много скока и колко са тези скоци. +Получавате от входа брой {` N} на числата (индексите), като {` N} е между 1 и 30, след това получавате толкова на брой числа (между 0 и N-1) и накрая връщате при кой начален индекс имаме най-много скока и колко са тези скоци. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -155,6 +165,7 @@ GitHub classroom: [url https://classroom.github.com/a/3KoIQ71H classroom.github. |: 0 2 + ## Задача 5 sim картите са типове smart-card, това означава че в себе си имат един миниатюрен компютър с миниатюрна памет. @@ -166,12 +177,12 @@ sim картите са типове smart-card, това означава че ### а) валидационни функции .bulleted -- [`isUnblockCode`], приема буква и връща дали е отблокиращ код\n +- {` isUnblockCode}, приема буква и връща дали е отблокиращ код\n Само главни, малки и цифри са валидни отблокиращи кодове -- [`isPhoneNumber`], приема число (10 цифрено) и поглежда най-левите 3 цифри\n +- {` isPhoneNumber}, приема число (10 цифрено) и поглежда най-левите 3 цифри\n Те трябва да са валиден код на държава. Нужно е да приемате поне кодовете за България (359) и за Франция (033). - Ако искате може и други да приемате, пълен списък има [url https://en.wikipedia.org/wiki/List_of_country_calling_codes#Alphabetical_order тук]. + Ако искате може и други да приемате, пълен списък има {url тук;https://en.wikipedia.org/wiki/List_of_country_calling_codes#Alphabetical_order}. ### б) вход и команди @@ -179,20 +190,20 @@ sim картите са типове smart-card, това означава че Ако отблокиращия е в невалиден формат, връщате съответно съобщение за грешка и спирате програмата. След това получавате команди, всяка команда се определя с букви и още някакви стойности. -[=Всяка команда трябва да бъде изкарана в отделна функция!=] +{b Всяка команда трябва да бъде изкарана в отделна функция!} .bulleted -- [`v`] - пробвате се да се "логнете" в сим картата. +- {` v} - пробвате се да се "логнете" в сим картата. След буквата получавате и едно число, което е въведения ПИН код. Ако е правилен, следващите 5 команди, които изискват упълномощение могат да се изпълнят. След 5те команди, упълномощението се "премахва" и трябва пак да се въведе ПИН код при упълномощени команди. Ако е грешен, общо има 3 опита, и след тях картата се блокира. -- [`u`] - отпблокиране на блокирана карта. +- {` u} - отпблокиране на блокирана карта. След буквата получавате отблокиращ код и нов ПИН код. Ако отблокиращия код е в грешен формат или е грешната стойност, премахваме един опит. При 10 неуспешни опита, изкарвате съобщение, че картата е перманентно блокирана и спирате програмата. Ако е успешно отблокирана, тогава променяте ПИН кода и сте се "логнали" автоматично. -- [`i`] - връща информация за СИМ картата, това са общо броя команди които са изпълнявани до сега +- {` i} - връща информация за СИМ картата, това са общо броя команди които са изпълнявани до сега ### в) команди с упълномощение @@ -202,15 +213,15 @@ sim картите са типове smart-card, това означава че Ако някоя търсена стойност е невалидна или не съществува, връщате съответната грешка. .bulleted -- [`c`] - променя ПИН код. +- {` c} - променя ПИН код. Получавате нов ПИН код и го променяте. -- [`a`] - добавя контакт в паметта, общо може да имаме 10 контакта. +- {` a} - добавя контакт в паметта, общо може да имаме 10 контакта. Всеки контакт се определя с буква, неговото "име", и 10-цифрен мобилен номер. Приема допълнително неговото име и тел. номер. Добавяме контакта в първото незаето място, а ако всички са заети, връщаме съобщение с грешка. -- [`r`] - приема и още една буква (име), връща телефонния номер на съответния контакт. +- {` r} - приема и още една буква (име), връща телефонния номер на съответния контакт. Ако той не съществува или телефонния номер е невалиден, връщаме съответно съобщение с грешка. -- [`d`] - приема и още една буква (име), изтрива съответния контакт. +- {` d} - приема и още една буква (име), изтрива съответния контакт. Ако той не съществува, връщаме съответно съобщение с грешка. -- [`o`] - променя контакт, приема допълнително две имена на контакти и телефонен номер. +- {` o} - променя контакт, приема допълнително две имена на контакти и телефонен номер. Променя контакта с първото име, като второто име и тел. номер стават новите му стойности. diff --git a/src/teaching/upp-2023/week5/revision.du b/src/teaching/upp-2023/week5/revision.du index 37c7c8d..c415f5a 100644 --- a/src/teaching/upp-2023/week5/revision.du +++ b/src/teaching/upp-2023/week5/revision.du @@ -1,4 +1,7 @@ -# Преговор - УПП, Седмица 5, 03.11.2023 +'def title Преговор - УПП, Седмица 5, 03.11.2023 +'def desc Преговор на материала + +# {title} ## Указатели @@ -6,22 +9,22 @@ За да можем да определим къде дадено нещо е запазено, всяка клетка в паметта си има "адрес". Адресът е едно цяло положително число. -Можем да вземем адреса на дадена променлива с оператора [`&`]: +Можем да вземем адреса на дадена променлива с оператора {` &}: ```cpp double a = 3.14159; std::cout << (&a) << std::endl; -Tази програма ще върне адресът на променлива [`a`]. +Tази програма ще върне адресът на променлива {` a}. След като имаме адрес, бихме искали да работим със стойността на този адрес. -Това го правим с дерефериращия оператор [`*`]: +Това го правим с дерефериращия оператор {` *}: ```cpp double a = 3.14159; std::cout << (*(&a)) << std::endl; -Тази програма връща стойността на адреса на променлива [`a`]. +Тази програма връща стойността на адреса на променлива {` a}. Променливи, които съдържат адреси се наричат указатели. Синтаксисът на един указател е: @@ -55,13 +58,13 @@ double *pointer2 = &a; <ТИП> <ИМЕ>[N] = { <СТОЙНОСТ> }; // дефинира всички N елементи със <СТОЙНОСТ> <ТИП> <ИМЕ>[N] = { <СТОЙНОСТ 1>, <СТОЙНОСТ 2>, ..., <СТОЙНОСТ M> }; // където M <= N -Самото [`<ИМЕ>`] е указател, така че може да достъпваме стойности чрез указателна аритметика: +Самото {` <ИМЕ>} е указател, така че може да достъпваме стойности чрез указателна аритметика: ```cpp int arr[2] = { 83, 18 }; std::cout << (*(arr + 1)) << std::endl; -Връща втория елемент, [`18`]. +Връща втория елемент, {` 18}. Или чрез по-приятния синтаксис с квадратни скоби: @@ -69,7 +72,7 @@ std::cout << (*(arr + 1)) << std::endl; int arr[2] = { 83, 18 }; std::cout << (arr[1]) << std::endl; -Двете неща са еквивалентни, тоест [`name[x]`] е еквивалентно на [`*(name + x)`]. +Двете неща са еквивалентни, тоест {` name[x]} е еквивалентно на {` *(name + x)}. Когато един масив съдържа букви, наричаме го "низ" (string). -За да не трябва да следим дължината на един низ в друга променлива и да трябва да я подаваме, винаги завършваме нашия низ на "терминаращата нула" - [`'\0'`]. +За да не трябва да следим дължината на един низ в друга променлива и да трябва да я подаваме, винаги завършваме нашия низ на "терминаращата нула" - {` '\0'}. diff --git a/src/teaching/upp-2023/week6/index.du b/src/teaching/upp-2023/week6/index.du index f9ff0b1..11cc5ee 100644 --- a/src/teaching/upp-2023/week6/index.du +++ b/src/teaching/upp-2023/week6/index.du @@ -1,8 +1,11 @@ -# Задачи - УПП, Седмица 6, 10.11.2023 +'def title Задачи - УПП, Седмица 6, 10.11.2023 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/BBLlWMOy classroom.github.com/a/BBLlWMOy] +GitHub classroom: {url classroom.github.com/a/BBLlWMOy;https://classroom.github.com/a/BBLlWMOy} ## Задача 1 @@ -12,9 +15,10 @@ GitHub classroom: [url https://classroom.github.com/a/BBLlWMOy classroom.github. N и M са между 1 и 60. -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -42,16 +46,17 @@ N и M са между 1 и 60. Разглеждаме числатата от 0 до N. За всяко число знаем колко интервала го включват (покриват). -Тоест в [`0 1 1 0`] означава, че 0 интервала "покриват" числото 0, един интервал покрива числото 1, един интервал покрива числото 2 и 0 покриват числото 3. +Тоест в {` 0 1 1 0} означава, че 0 интервала "покриват" числото 0, един интервал покрива числото 1, един интервал покрива числото 2 и 0 покриват числото 3. Търси се колко различни интервала имаме. Не различаваме между два долепени интервала и един дълъг интервал. От входа получаввате N (от 1 до 30), и след това N на брой числа: броя покриващи интервали за всички числа от 0 до N-1. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -84,6 +89,7 @@ N и M са между 1 и 60. |: 5 + ## Задача 3 Трябва да имплементирате дигитална версия на морски шах. @@ -95,17 +101,17 @@ N и M са между 1 и 60. В случай, че игралното поле се запълни и никой не е спечелил, след последното му изкарване трябва да върнете "Draw!" и да спрете програмата. -[=Пример:=] -[*Смесен вход/изход, вход е означен с "$ " преди него*] +{b Пример:} +{i Смесен вход/изход, вход е означен с "$ " преди него} ``` -'include ./ex3-io.txt +'snippet 1 $ ./ex3-io.txt -[=Бонус:=] направете го да работи с NxN брой клетки, като N е число между 1 и 50. +{b Бонус:} направете го да работи с NxN брой клетки, като N е число между 1 и 50. ## Задача 4 -Имплементирайте играта [url https://en.wikipedia.org/wiki/Chomp chomp]: представете си, че имаме един шоколад, разделен на NxM квадратчета. +Имплементирайте играта {url chomp;https://en.wikipedia.org/wiki/Chomp}: представете си, че имаме един шоколад, разделен на NxM квадратчета. Всеки играч избира квадратче (координати), след това изяжда всички парчета, които са в дясно или надолу от квадратчето. Играчът, който изяде квадратчето в горния ляв ъгъл губи играта. @@ -114,15 +120,15 @@ N и M са между 1 и 60. Редуват се първия и втория играч, като всеки въвежда две числа - координати в шоколада (между 1 и N за реда и 1 и M за колоната). Когато някой изяде парчето в горния ляв ъгъл, програмата изкарва "PLAYER wins!" (PLAYER е 1 или 2) и спира изпълнение. -[=Пример=] -[*Смесен вход/изход, вход е означен с "$ " преди него*] +{b Пример} +{i Смесен вход/изход, вход е означен с "$ " преди него} ``` -'include ex4-io.txt +'snippet 1 $ ex4-io.txt ## Задача 5 -[=Тази задача е много трудна, proceed with caution!=] +{b Тази задача е много трудна, proceed with caution!} Ще имплементираме програма, която "симулира" един елементарен компютър. Компютъра ни, като всеки друг, работи само и единствено с цели неотрицателни числа. @@ -133,34 +139,34 @@ N и M са между 1 и 60. Започваме изпълнение от началото на паметта, след като изпълним една инструкция, изпълняваме тази директно до нея, и така докато не стигнем инструкцията "EXT". В такъв случай, изкарваме стойността в регистър B и спираме програмата. -Това са командите, описани във формата "D - [`A B C`]", като D е число, съответстващо на инструкцията с име [`A`] (името го използваме за нас, в кода то не присъства) и аргументи след името [`B`] и [`C`]. -[`MEMORY`] е число, съответстващо на индекс (адрес) в паметта на компютъра (между 0 и 127), а [`VALUE`] е произволна числова стойност. +Това са командите, описани във формата "D - {` A B C}", като D е число, съответстващо на инструкцията с име {` A} (името го използваме за нас, в кода то не присъства) и аргументи след името {` B} и {` C}. +{` MEMORY} е число, съответстващо на индекс (адрес) в паметта на компютъра (между 0 и 127), а {` VALUE} е произволна числова стойност. :unordered -- 0 - [`EXT`] - край на изпълнението на програмата в симулирания компютър +- 0 - {` EXT} - край на изпълнението на програмата в симулирания компютър -- 1 - [`INC MEMORY`] - инкрементира стойността на индекс [`MEMORY`]\n - Пример: [`0 2`] - инкрементира стойността на индекс 2 +- 1 - {` INC MEMORY} - инкрементира стойността на индекс {` MEMORY}\n + Пример: {` 0 2} - инкрементира стойността на индекс 2 -- 2 - [`RIN VALUE MEMORY`] - инкрементира стойността на индекс [`VALUE + MEMORY`]\n - Пример: [`1 3 6`] - инкрементира стойността на адрес [`3 + 6 = 9`] +- 2 - {` RIN VALUE MEMORY} - инкрементира стойността на индекс {` VALUE + MEMORY}\n + Пример: {` 1 3 6} - инкрементира стойността на адрес {` 3 + 6 = 9} -- 3 - [`DEC MEMORY`] - декрементира стойността на индекс [`MEMORY`] +- 3 - {` DEC MEMORY} - декрементира стойността на индекс {` MEMORY} -- 4 - [`RDE VALUE MEMORY`] - декрементира стойността на индекс [`VALUE + MEMORY`] +- 4 - {` RDE VALUE MEMORY} - декрементира стойността на индекс {` VALUE + MEMORY} -- 5 - [`STA MEMORY`] - запазва стойността на индекс [`MEMORY`] в регистъра А\n - Пример: [`4 19`] - запазва стойността на индекс 19 в регистъра А +- 5 - {` STA MEMORY} - запазва стойността на индекс {` MEMORY} в регистъра А\n + Пример: {` 4 19} - запазва стойността на индекс 19 в регистъра А -- 6 - [`RST VALUE MEMORY`] - запазва стойността на адрес [`VALUE + MEMORY`] в регистър А\n - Пример: [`5 2 14`] - запазва стойността на индекс [`2 + 14 = 16`] в регистър А +- 6 - {` RST VALUE MEMORY} - запазва стойността на адрес {` VALUE + MEMORY} в регистър А\n + Пример: {` 5 2 14} - запазва стойността на индекс {` 2 + 14 = 16} в регистър А -- 7 - [`STB MEMORY`] - запазва стойността на индекс [`MEMORY`] в регистъра B +- 7 - {` STB MEMORY} - запазва стойността на индекс {` MEMORY} в регистъра B -- 8 - [`BEQ MEMORY`] - продължава изпълнение от индекс [`MEMORY`], ако стойността в регистъра А е нула\n - Пример: [`7 8`] - продължава изпълнение от индекс 8, ако стойността в регистър А е нула +- 8 - {` BEQ MEMORY} - продължава изпълнение от индекс {` MEMORY}, ако стойността в регистъра А е нула\n + Пример: {` 7 8} - продължава изпълнение от индекс 8, ако стойността в регистър А е нула -- 9 - [`BNE MEMORY`] - продължава изпълнение от индекс [`MEMORY`], ако стойността в регистъра А не е нула +- 9 - {` BNE MEMORY} - продължава изпълнение от индекс {` MEMORY}, ако стойността в регистъра А не е нула В началото получавате N, това са броя числа, които съставят цялата програма. @@ -169,11 +175,12 @@ N и M са между 1 и 60. Ако по време на изпълнение стигнете до инструкция, която не е дефинирана, изкарвате "Error: undefined instruction!" и спирате програмата. Ако някой аргумент е индекс в паметта, обаче стойността му е извън обхвата на паметта, изкарвате "Error: invalid memory address!" и спирате програмата. -Ако няма грешка и програмата успешно стигне до [`EXT`] инструкция, както беше казано, изкарваме на екрана стойността в регистъра B. +Ако няма грешка и програмата успешно стигне до {` EXT} инструкция, както беше казано, изкарваме на екрана стойността в регистъра B. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -190,9 +197,10 @@ N и M са между 1 и 60. |: 863461 + .question Какво прави последната програма? -[=Бонус:=] направете програми за симулаторния компютър, които +{b Бонус:} направете програми за симулаторния компютър, които .ordered 1. умножават числата 87401 и 37 2. намира сумата на числата 87, 305, 2, 612, 222 diff --git a/src/teaching/upp-2023/week7/index.du b/src/teaching/upp-2023/week7/index.du index e8173b9..0a576d9 100644 --- a/src/teaching/upp-2023/week7/index.du +++ b/src/teaching/upp-2023/week7/index.du @@ -1,24 +1,28 @@ -# Задачи - УПП, Седмица 7, 17.11.2023 +'def title Задачи - УПП, Седмица 7, 17.11.2023 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/m5M2_CWD classroom.github.com/a/m5M2_CWD] +GitHub classroom: {url classroom.github.com/a/m5M2_CWD;https://classroom.github.com/a/m5M2_CWD} ## Задача 1 -[*Това е почти същата задача като през [url ../week5/#1 седмица 5]*] +{i Това е почти същата задача като през {url седмица 5;../week5/#1}} Дефинираме двуизмерен координат като две числа с плаваща запетая. Направете функция, която получава два двуизмерни координата, покомпонентно ги сумира и връща резултатните координати. Няма как функцията да върне две стойности, затова добаваете още два аргумента, които да са указатели към променливи в които да запазим сумираните координати. -.warn [=Трябва=] да използвате референции вместо указатели! +.warn {b Трябва} да използвате референции вместо указатели! -От входа получавате два координата, след това връщате тяхната покомпонентна сума [=използвайки функцията=]. +От входа получавате два координата, след това връщате тяхната покомпонентна сума {b използвайки функцията}. -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -26,23 +30,25 @@ GitHub classroom: [url https://classroom.github.com/a/m5M2_CWD classroom.github. |: 6.1 -99.241 + ## Задача 2 -Един магазин продава три продукта, които ще бележим с [`a`], [`b`] и [`c`]. +Един магазин продава три продукта, които ще бележим с {` a}, {` b} и {` c}. Правим инвентарна система за тези продукти, като за всеки от тях пазим неговата бройка в склада. В началото имаме 0 от всеки продукт. -Получавате букви, докато не стигнете до буквата [`$`]. -Ако буквата е [`a`], [`b`] или [`c`], тогава този продукт става "сегашния" продукт. -Ако буквата е [`S`], тогава намаляте бройката на сегашния продукт с 1, а ако е [`R`] - увеличаваме с 10. +Получавате букви, докато не стигнете до буквата {` $}. +Ако буквата е {` a}, {` b} или {` c}, тогава този продукт става "сегашния" продукт. +Ако буквата е {` S}, тогава намаляте бройката на сегашния продукт с 1, а ако е {` R} - увеличаваме с 10. -.warn [=НЕ=] може да използвате масиви! [=Трябва=] действията на [`S`] и [`R`] да се изкарат във функции! +.warn {b НЕ} може да използвате масиви! {b Трябва} действията на {` S} и {` R} да се изкарат във функции! -Когато получите [`$`], изкарвате броя на всеки продукт и спирате програмата. +Когато получите {` $}, изкарвате броя на всеки продукт и спирате програмата. -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -50,23 +56,25 @@ GitHub classroom: [url https://classroom.github.com/a/m5M2_CWD classroom.github. |: а: 23 b: 17 c: 9 + ## Задача 3 -В началото получавате буква - тя съответства на дадена [=функция=], след това получавате 5 числа с плаваща запетая. +В началото получавате буква - тя съответства на дадена {b функция}, след това получавате 5 числа с плаваща запетая. След всяко въведено трябва да изкарате резултата от съответната функция при подадено входното число. -.warn [=Трябва=] да използвате указател към функция! +.warn {b Трябва} да използвате указател към функция! Буквите съответстват на следните функции: .bulleted -- [`a`] - модул на стойност -- [`s`] - стойност на втора степен -- [`h`] - занулена частта след запетаята -- [`f`] - занулена частта преди (в ляво от) запетаята +- {` a} - модул на стойност +- {` s} - стойност на втора степен +- {` h} - занулена частта след запетаята +- {` f} - занулена частта преди (в ляво от) запетаята -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -83,6 +91,7 @@ GitHub classroom: [url https://classroom.github.com/a/m5M2_CWD classroom.github. |: 0.5 -0.3 0.994 0 -0.003 + ## Задача 4 Ще имлементираме система за задачи. @@ -95,25 +104,25 @@ GitHub classroom: [url https://classroom.github.com/a/m5M2_CWD classroom.github. ``` N. [C] TASK -Където [`N`] е нейния номер (индекс), [`C`] е шпация или буквата "x" (шпация когато не е изпълнена, и "х" когато е), [`TASK`] е самия низ на задачата. +Където {` N} е нейния номер (индекс), {` C} е шпация или буквата "x" (шпация когато не е изпълнена, и "х" когато е), {` TASK} е самия низ на задачата. -Програмата получава букви, докато не получи буквата [`$`]. +Програмата получава букви, докато не получи буквата {` $}. Всяка буква определя някакво действие: .bulleted -- при [`p`] изкарваме на екрана всички задачи -- при [`d`] изкарваме на екрана всички завършени задачи -- при [`t`] изкарваме на екрана всички незавършени задачи -- след [`a`] въвеждаме нова (незавършена) задача на последния свободен индекс\n +- при {` p} изкарваме на екрана всички задачи +- при {` d} изкарваме на екрана всички завършени задачи +- при {` t} изкарваме на екрана всички незавършени задачи +- след {` a} въвеждаме нова (незавършена) задача на последния свободен индекс\n Ако вече пазим 64 задачи, трябва да изкараме грешка на екрана и да продължим с програмата. -- след [`c`] въвеждаме номер на задача и обръщаме нейната изпълненост: ако е изпълнена, става неизпълнена, и ако е неизпълнена, става изпълнена +- след {` c} въвеждаме номер на задача и обръщаме нейната изпълненост: ако е изпълнена, става неизпълнена, и ако е неизпълнена, става изпълнена В началото на програмата нямаме никакви задачи. -[=Пример:=] -[*Смесен вход/изход, изход е отбелязан с "> ". Забележете, че има шпации в края на низове за задачи.*] +{b Пример:} +{i Смесен вход/изход, изход е отбелязан с "> ". Забележете, че има шпации в края на низове за задачи.} ``` -'include ex4-io.txt +'snippet 1 $ ex4-io.txt ## Задача 5 @@ -124,34 +133,34 @@ N. [C] TASK След това получавате произволен брой команди - букви с възможна последователност от стойности. Трябва да имплементирате следните команди: .bulleted -- [`s`] - изкарвате изображението на екрана -- [`r`] - завъртате изображението по часовниковата стрелка с 90 градуса -- [`l`] - завъртате изображението обратно на часовниковата стрелка с 90 градуса -- [`h`] - обръщате изображението по хоризонтала (първи и последен ред се разменят, след това втори и предпоследен и так. нат.) -- [`v`] - обръщате изображението по вертикалата (първа и последна колона се разменят, след това втора и предпоследна и так. нат.) -- [`f`] - след този знак получавате още 4 стойности - това са два координата върху изображението, и трябва да запълните с бяло правоъгълна област с горен ляв ъгъл в първата точка и с долен десен ъгъл във втората точка. +- {` s} - изкарвате изображението на екрана +- {` r} - завъртате изображението по часовниковата стрелка с 90 градуса +- {` l} - завъртате изображението обратно на часовниковата стрелка с 90 градуса +- {` h} - обръщате изображението по хоризонтала (първи и последен ред се разменят, след това втори и предпоследен и так. нат.) +- {` v} - обръщате изображението по вертикалата (първа и последна колона се разменят, след това втора и предпоследна и так. нат.) +- {` f} - след този знак получавате още 4 стойности - това са два координата върху изображението, и трябва да запълните с бяло правоъгълна област с горен ляв ъгъл в първата точка и с долен десен ъгъл във втората точка. В един координат първо посочваме реда и след това колоната, като координатите започват от 0, от горния ляв ъгъл. -- [`c`] - почти същото като [`f`], обаче запълвате с черно, не с бяло +- {` c} - почти същото като {` f}, обаче запълвате с черно, не с бяло -[=Пример:=] -[*Смесен вход/изход*] +{b Пример:} +{i Смесен вход/изход} ``` -'include ex5-io.txt +'snippet 1 $ ex5-io.txt ## Задача 6 -Ще имплементираме програма, която намира състоянието на един [url https://en.wikipedia.org/wiki/Elementary_cellular_automaton елементарен едноклетъчен автомат] след даден брой генерации и определено правило. +Ще имплементираме програма, която намира състоянието на един {url елементарен едноклетъчен автомат;https://en.wikipedia.org/wiki/Elementary_cellular_automaton} след даден брой генерации и определено правило. Задачата изглежда сложна, но не е толкова зле. За нашите цели, един "елементарен едноклетъчен автомат" е просто един голям булев масив. -Ще наричаме стойност [`true`] жива и стойност [`false`] мъртва. +Ще наричаме стойност {` true} жива и стойност {` false} мъртва. За всяка клетка в масива имаме правила, в зависимост от стойностите на клетката в ляво и в дясно променяме сегашната клетка. Направили сме една "генерация" след като обиколим всички клетки един път (от ляво на дясно) и обновим техните стойности. -Би трябвало това да ви напомня на [url https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life играта "Живот"] от [url https://en.wikipedia.org/wiki/John_Horton_Conway John Conway]. +Би трябвало това да ви напомня на {url играта "Живот";https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life} от {url John Conway;https://en.wikipedia.org/wiki/John_Horton_Conway}. -Конкретните правила са тези при [url https://en.wikipedia.org/wiki/Rule_30 "правило 30"].\n +Конкретните правила са тези при {url "правило 30";https://en.wikipedia.org/wiki/Rule_30}.\n Ако сегашната клетка е жива: .bulleted - става мъртва, ако тази в ляво е жива diff --git a/src/teaching/upp-2023/week8/index.du b/src/teaching/upp-2023/week8/index.du index 16a92c9..08318b6 100644 --- a/src/teaching/upp-2023/week8/index.du +++ b/src/teaching/upp-2023/week8/index.du @@ -1,10 +1,13 @@ -# Задачи - УПП, Седмица 8, 24.11.2023 +'def title Задачи - УПП, Седмица 8, 24.11.2023 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/Big7FRUG classroom.github.com/a/Big7FRUG] +GitHub classroom: {url classroom.github.com/a/Big7FRUG;https://classroom.github.com/a/Big7FRUG} -.warn [=Трябва=] да използвате възможно най-малко памет във всички задачи! +.warn {b Трябва} да използвате възможно най-малко памет във всички задачи! ## Задача 1 @@ -15,9 +18,10 @@ GitHub classroom: [url https://classroom.github.com/a/Big7FRUG classroom.github. Броим позициите на числата от 1, тоест в "8 5 9 7", 8 е на позиция 1, 5 е на позиция 2, 9 е на позиция 3 и 7 е на позиция 4. "Всяко второ число" са числата 5 и 7, докато "всяко трето" е само числото 9. -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -32,6 +36,7 @@ GitHub classroom: [url https://classroom.github.com/a/Big7FRUG classroom.github. 2 54 + ## Задача 2 Получавате и запазвате цели числа, докато не получите числото 0. @@ -43,9 +48,10 @@ GitHub classroom: [url https://classroom.github.com/a/Big7FRUG classroom.github. След ротацията трябва да изкарате числата на екрана. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -59,14 +65,16 @@ GitHub classroom: [url https://classroom.github.com/a/Big7FRUG classroom.github. |: 983 473 103 1 4 + ## Задача 3 Получавате цяло положително число N и след това получавате всички коефициенти в матрица NxN. Трябва да изкарате редицата числа, получена чрез умножаване на първия ред по всяка колона от същата матрица. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -100,9 +108,10 @@ GitHub classroom: [url https://classroom.github.com/a/Big7FRUG classroom.github. Накрая трябва да изкарате получената редица стойности. При изкарване трябва да пропуснете незапълнени клетки. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -116,11 +125,12 @@ GitHub classroom: [url https://classroom.github.com/a/Big7FRUG classroom.github. |: 96 56 96 90 33 15 43 73 17 + ## Задача 5 Получавате цели числа от входа, докато не получите числото 0. Представете си една права "по средата" на масива, вмъквате първото число в ляво от правата, второто в дясно, после пак в ляво и четвъртото в дясно и так. нат. -Пример: ако са въведени числата "1 2 3 4", и си представяме правата [`|`], при първото число правим [`1|`], при второто [`1|2`], при третото [`1 3|2`] и при четвъртото [`1 3|4 2`], тоест финалната редица е "1 3 4 2". +Пример: ако са въведени числата "1 2 3 4", и си представяме правата {` |}, при първото число правим {` 1|}, при второто {` 1|2}, при третото {` 1 3|2} и при четвъртото {` 1 3|4 2}, тоест финалната редица е "1 3 4 2". Друг начин по който да го разберем, е че първото число е на първа позиция, второто число е на последната, третото число е на втора позиция, четвъртото е на предпоследна и так. нат. Обаче ние не знаем финалния размер на масива, затова се нуждаем от логиката с чертата. @@ -130,9 +140,10 @@ GitHub classroom: [url https://classroom.github.com/a/Big7FRUG classroom.github. Напомням, че тази права само си я представяте. В началото масива е с размер 2. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -143,9 +154,10 @@ GitHub classroom: [url https://classroom.github.com/a/Big7FRUG classroom.github. |: 85 26 45 48 11 56 78 18 41 38 43 + ## Задача 6 -Трябва да направите интерпретатор за програмния език [url https://en.wikipedia.org/wiki/Brainfuck brainfuck]. +Трябва да направите интерпретатор за програмния език {url brainfuck;https://en.wikipedia.org/wiki/Brainfuck}. В него имате 8 команди/инструкции, всяка от които се изразява с един знак. Запазвате в паметта няколко неща: вашата brainfuck програма, паметта на "машината", къде се намирате в програмата и къде се намирате в паметта на "машината". @@ -155,21 +167,22 @@ GitHub classroom: [url https://classroom.github.com/a/Big7FRUG classroom.github. Самите команди (знаци), които съставят една brainfuck програма са: .bulleted -- [`>`]: сегашната клетка (къде се намирате в паметта на "машината") става тази в дясно -- [`<`]: сегашната клетка става тази в ляво -- [`+`]: инкрементира стойността в сегашната клетка с едно -- [`-`]: декрементира стойността в сегашната клетка с едно -- [`.`]: изкарва стойността в сегашната клетка (като число) -- [`,`]: приема от входа едно число и го записва в сегашната клетка -- [`\[`]: ако стойността в сегашната клетка е 0, тогава програмата "скача" напред към знака след съответната [`\]`] -- [`\]`]: ако стойността в сегашната клетка не е 0, тогава програмата "скача" назад към знака след съответната [`\[`] +- {` >}: сегашната клетка (къде се намирате в паметта на "машината") става тази в дясно +- {` <}: сегашната клетка става тази в ляво +- {` +}: инкрементира стойността в сегашната клетка с едно +- {` -}: декрементира стойността в сегашната клетка с едно +- {` .}: изкарва стойността в сегашната клетка (като число) +- {` ,}: приема от входа едно число и го записва в сегашната клетка +- {` [}: ако стойността в сегашната клетка е 0, тогава програмата "скача" напред към знака след съответната {` ]} +- {` ]}: ако стойността в сегашната клетка не е 0, тогава програмата "скача" назад към знака след съответната {` [} -От входа ще получавате редица знаци, които ще съставят вашата brainfuck програма, като при знака [`$`] входът спира и трябва да започнете изпълнение на brainfuck кода. +От входа ще получавате редица знаци, които ще съставят вашата brainfuck програма, като при знака {` $} входът спира и трябва да започнете изпълнение на brainfuck кода. Не знаете колко памет на "машината" ще ви трябва, затова бъдете готови да я разширявате при нужда. -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -177,6 +190,7 @@ GitHub classroom: [url https://classroom.github.com/a/Big7FRUG classroom.github. |: 7 + ## Задача 7 Нека да направим една игра, ще я наричамe "коридорен dungeon". @@ -224,4 +238,4 @@ GitHub classroom: [url https://classroom.github.com/a/Big7FRUG classroom.github. Всеки допълнителен телепортер, извън първоначалния с който спирате играта, ви носи още 50 точки. На всеки ход трябва да изкарате броя точки живот на играча, броя точки живот които меча му отнема, сегашната стая в която се намира, левите 5 стаи и десните 5 стаи. -Една стая е изобразена със знака [`?`] ако не е посетена, [` `] ако е празна, [`c`] ако има съкровище, [`m`] ако има чудовище и [`t`] ако има тунел. +Една стая е изобразена със знака {` ?} ако не е посетена, {` } ако е празна, {` c} ако има съкровище, {` m} ако има чудовище и {` t} ако има тунел. diff --git a/src/teaching/upp-2023/week9/index.du b/src/teaching/upp-2023/week9/index.du index 9e93216..9c16c51 100644 --- a/src/teaching/upp-2023/week9/index.du +++ b/src/teaching/upp-2023/week9/index.du @@ -1,19 +1,23 @@ -# Задачи - УПП, Седмица 9, 01.12.2023 +'def title Задачи - УПП, Седмица 9, 01.12.2023 +'def desc Условия на задачите за упражнение + +# {title} \n -GitHub classroom: [url https://classroom.github.com/a/lGXxCRZO classroom.github.com/a/lGXxCRZO] +GitHub classroom: {url classroom.github.com/a/lGXxCRZO;https://classroom.github.com/a/lGXxCRZO} .warn Освен ако не е казано друго, може да зачитате, че максималната дължина на един низ е 1024 знака. ## Задача 1 Получавате от входа два низа. -Трябва да изкарате на екрана низ, при който има знакът "\_" на индексите, където буквите между двата низа се различават, и съответната буква, когато не се различават. +Трябва да изкарате на екрана низ, при който има знакът "_" на индексите, където буквите между двата низа се различават, и съответната буква, когато не се различават. -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -27,6 +31,7 @@ AKDDCP A__D__ + ## Задача 2 От входа получавате число N и на следващия ред получавате низ с толкова на брой знака. @@ -35,9 +40,10 @@ A__D__ .important Трябва да използвате динамична памет -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -60,14 +66,16 @@ ABCKLMN KLMNABC + ## Задача 3 От входа получаввате един низ, трябва да изкарате броя думи в него. Думите се разделят с една или повече шпации, като знаци (точка, запетая, удивителна, ...) не са думи. -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -90,13 +98,14 @@ This , is , a , sentence .! |: 4 + ## Задача 4 Една от ранните програми за Apple I компютърът, написана от Steve Wozniak в упътването на компютъра, е така наречената "Woz Monitor", или wozmon за картко. Тя позволява да погледнеш стойностите в клетки от паметта, да запишеш стойности и да стартираш програми. Игнорирайки последната му възможност, нека да го имплементираме. -За нашите цели, паметта на компютъра е просто един масив, които ще расте [=когато е нужно=]. +За нашите цели, паметта на компютъра е просто един масив, които ще расте {b когато е нужно}. Ще адресираме (индексираме) стойностите от масива с числа от 16-тична бройна система. Когато въведем низ във формата: @@ -121,9 +130,10 @@ This , is , a , sentence .! - "адрес: стойност ...", като предходното, обаче може да определим стойностите на сегашната и на следващите клетки (пак изкарваме във формата "X: V ...") -[=Примери:=] +{b Примери:} -:table_2 +:table +:2 |= Вход |= Изход @@ -176,6 +186,7 @@ This , is , a , sentence .! 9: ABB 8A 99 0 + ## Задача 5 Перфокартите са стар формат за съхраняване на текст (код) върху хартиен носител, който е четим от машини. @@ -188,7 +199,7 @@ This , is , a , sentence .! Трябва да имплементирате програма, която получава перфо карти в стандартния IBM формат: 12 реда и 80 колони и изкарва съответния ред, който е закодиран. Тоест, от входа получавате 12 низа, всеки низ е с дължина 80, и са съставени от 0 и 1.\n -Стойностите [=по колони=]: +Стойностите {b по колони}: .bulleted - от "100000000000" до "000000000001" (със само една 1ца) съответстват на знаците "&", "-", "0", "1", ... "9". @@ -196,9 +207,10 @@ This , is , a , sentence .! - от "010100000000" до "010000000001" (с две 1ци, едната която е винаги втората) съответстват на знаците от "J" до "R". - от "001100000000" до "001000000001" (с две 1ци, едната която е винаги третата) съответстват на знаците "/", "S", ... "Z". -[=Пример:=] +{b Пример:} -:table_2 +:table +:2 |= Вход |= Изход @@ -220,6 +232,7 @@ This , is , a , sentence .! |: &-0123456789ABCDEFGHIJKLMNOPQR/STUVWXYZ + ## Задача 6 Регулярните изрази са низове, които позволяват да опишем шаблони, с които да филтрираме/приемаме низове. @@ -232,21 +245,21 @@ This , is , a , sentence .! - ако не е някой от горните знаци, тогава искаме сегашната буква да бъде равна на тази в израза :unordered -1. Какво описва регулярният израз [`aa*bcd`]? +1. Какво описва регулярният израз {` aa*bcd}? .p - Първата буква от нашия низ трябва да бъде [`а`]. - След това имаме [`a*`], след тази първа буква може да имаме 0 или повече [`a`]-та. - Тоест втората буква може да бъде [`a`] или [`b`], ако е [`a`], третата буква може да бъде [`a`] или [`b`], обаче ако втората буква е [`b`], тогава продължаваме напред и останалите букви трябва да са [`bcd`]. + Първата буква от нашия низ трябва да бъде {` а}. + След това имаме {` a*}, след тази първа буква може да имаме 0 или повече {` a}-та. + Тоест втората буква може да бъде {` a} или {` b}, ако е {` a}, третата буква може да бъде {` a} или {` b}, обаче ако втората буква е {` b}, тогава продължаваме напред и останалите букви трябва да са {` bcd}. .p - Тоест, този регулярен израз приема низове, които започват с [`a`], след това имат 0 или повече [`a`]-та и завършват на [`bcd`]. + Тоест, този регулярен израз приема низове, които започват с {` a}, след това имат 0 или повече {` a}-та и завършват на {` bcd}. Следните низове ще бъдат приети: "abcd", "aabcd", "aaabcd", "aaaabcd" и так. нат. -2. Какво описва регулярният израз [`b*cd?`]? +2. Какво описва регулярният израз {` b*cd?}? .p - В началото имаме [`b`] нула или повече пъти, след това имаме [`c`] и накрая имаме нула или едно [`d`]. + В началото имаме {` b} нула или повече пъти, след това имаме {` c} и накрая имаме нула или едно {` d}. Следните низове ще бъдат приети: "c", "bc", "bbc", "bbbc", ..., "cd", "bcd", "bbcd", ... @@ -257,8 +270,8 @@ This , is , a , sentence .! В противен случай изкарвате "No match". Ако регулярния израз е в грешен формат (срещнете "?" или "\*" като първи знак), трябва да изкарате "Bad regex". -[=Пример:=] -[*Смесен вход/изход*] +{b Пример:} +{i Смесен вход/изход} ``` -'include ./ex6-io.txt +'snippet 1 $ ./ex6-io.txt diff --git a/src/teaching/upp-2025/cpp-pitfalls/index.du b/src/teaching/upp-2025/cpp-pitfalls/index.du index 8a6936b..09b9339 100644 --- a/src/teaching/upp-2025/cpp-pitfalls/index.du +++ b/src/teaching/upp-2025/cpp-pitfalls/index.du @@ -1,37 +1,37 @@ -# Капани в C++ - УПП, КН, 2025-2026 +'def title Капани в C++ - УПП, КН, 2025-2026 +'def desc Помощна страница с кажи-речи всички странности и неприятности, които трябва да се знаят за УП курса. -'define expected-reading 15 min -'define created 22 November 2025 -'define edited 23 November 2025 -[$pagenav] +# {title} + +{pagenav 15 min;22 November 2025;23 November 2025} .warn Този документ ще бъде обновяван до края на курса. Моля, следете за промени! -[$br2] +{br2} :contents :numbered -1. [url #section-1 Лоши практики] +1. {uhref Лоши практики} .numbered - 1. [url #section-2 Записване/връщане на булеви стойности] + 1. {uhref Записване/връщане на булеви стойности} -2. [url #section-3 Оператори] +2. {uhref Оператори} .numbered - 1. [url #section-4 Типове на аритметични операции] - 2. [url #section-5 Лениво оценяване на булеви изрази] + 1. {uhref Типове на аритметични операции} + 2. {uhref Лениво оценяване на булеви изрази} -3. [url #undefined-behaviour Undefined behaviour] +3. {uhref Undefined behaviour} .numbered - 1. [url #section-6 Приоритет на скоби спрямо аритметични оператори] + 1. {uhref Приоритет на скоби спрямо аритметични оператори} -5. [url #section-7 Масиви и матрици] +5. {uhref Масиви и матрици} .numbered - 1. [url #section-8 Връщане на масиви] - 2. [url #section-9 Инициализация на масиви] - 3. [url #section-10 Масиви с неконстантен размер] - 4. [url #-int73-vs-int3-vs-int Тип на матрици (int[7\][3\] vs int(*)[3\] vs int**)] + 1. {uhref Връщане на масиви} + 2. {uhref Инициализация на масиви} + 3. {uhref Масиви с неконстантен размер} + 4. {uhref Тип на матрици (int[7][3] vs int(*)[3] vs int**)} @@ -48,24 +48,24 @@ Когато запишем булева стойност в променлива, лоша практика е да направим нещо такова: -```c++ +```cpp if (condition) myvar = true; else myvar = false; -Стойността на [`condition`] е булева сама по себе си, добрата практика е директно да запишем стойността: +Стойността на {` condition} е булева сама по себе си, добрата практика е директно да запишем стойността: -```c++ +```cpp myvar = condition; -Като [`condition`] е какъвто и да е булев израз. +Като {` condition} е какъвто и да е булев израз. -[$br2] +{br2} Еквивалентно имаме случая: -```c++ +```cpp bool f() { if (condition) return true; @@ -73,24 +73,24 @@ bool f() { return false; } -Коректното е просто да върнем [`condition`], тя е булева: +Коректното е просто да върнем {` condition}, тя е булева: -```c++ +```cpp bool f() { return condition; } -[$br2] +{br2} Трябва да е очевидно, но изрази от типа на: -```c++ +```cpp if (condition) myvar = false; else myvar = true; -```c++ +```cpp bool f() { if (condition) return false; @@ -101,10 +101,10 @@ bool f() { Спадат в същата категория. Резултата просто трябва да се обърне, булево: -```c++ +```cpp myvar = !condition; -```c++ +```cpp bool f() { return !condition; } @@ -117,7 +117,7 @@ bool f() { И върната стойност е от този тип. Например: -```c++ +```cpp int x = 5; double y = 6; std::cout << (x * y); // double е по-голямо от int, @@ -126,7 +126,7 @@ std::cout << (x * y); // double е по-голямо от int, Ефекта от това е, че деление на цели числа връща цяло число (което закръгля резултата). Например: -```c++ +```cpp int x = 5, y = 8; std::cout << (x / y); // деление на цели числа, резултата се закръгля надолу std::cout << (double)(x / y); // резултата от деление вече е закръглен, @@ -141,42 +141,42 @@ std::cout << ((double)x / y); // едното вече е с плаваща за Двата главни примера се срещат при оператори "и" и "или". -[$br2] +{br2} -```c++ +```cpp a || b || c || d -Ако [`a`] е истина, тогава другите няма да се изпълнят, защото тяхната стойност не е от значение, общия израз ще си остане истина. -Аналогично, ако [`a`] е лъжа, но [`b`] е истина, тогава [`c`] и [`d`] няма да се изпълнят. +Ако {` a} е истина, тогава другите няма да се изпълнят, защото тяхната стойност не е от значение, общия израз ще си остане истина. +Аналогично, ако {` a} е лъжа, но {` b} е истина, тогава {` c} и {` d} няма да се изпълнят. -[$br2] +{br2} -```c++ +```cpp a && b && c && d Напълно еквивалентно работи и "или". -Ако [`a`] е лъжа, тогава другите няма да се изпълнят, защото общия израз ще си остане лъжа. +Ако {` a} е лъжа, тогава другите няма да се изпълнят, защото общия израз ще си остане лъжа. -[$br2] +{br2} Това е релевантно когато използваме присвояващи оператори в логически условия, например: -```c++ +```cpp if (condition1 && ((myvar += 5) == 8)) и когато използваме функции: -```c++ +```cpp if (condition1 && f()) -И в двата случая, ако [`condition1`] е лъжа, тогава присвояването и извикването на функцията няма да се изпълнят. +И в двата случая, ако {` condition1} е лъжа, тогава присвояването и извикването на функцията няма да се изпълнят. Дали това е желан ефект или не зависи от кода. ## Undefined behaviour C++ наследява идеята от C, че някои неща в стандарта на езика не са дефинирани. -Тоест, какво ще се случи зависи от имплементацията на компилатора (това което превръща кода в [`.exe`]) и често се срещат разлики. +Тоест, какво ще се случи зависи от имплементацията на компилатора (това което превръща кода в {` .exe}) и често се срещат разлики. ### Приоритет на скоби спрямо аритметични оператори @@ -186,37 +186,37 @@ C++ наследява идеята от C, че някои неща в стан Този ефект е значим само при употреба на присвояващи оператори. Например: -```c++ +```cpp int x = 9; int y = (x += 5) * (x += 1) * (x -= 8); -Има два начина да се изчисли стойността на [`y`]: +Има два начина да се изчисли стойността на {` y}: :ordered 1. Първо изчисляваме всички изрази в скобите и след това изпълняваме умноженията. .p - Тоест, първо правим [`x += 5`], после [`x += 1`] и след това [`x -= 8`]. - Това променя стойността на [`x`] на 7 и стойността на [`y`] се свежда до [`x * x * x = 343`] + Тоест, първо правим {` x += 5}, после {` x += 1} и след това {` x -= 8}. + Това променя стойността на {` x} на 7 и стойността на {` y} се свежда до {` x * x * x = 343} 2. Първо изчисляваме умноженията. Това означава, че първо "слагаме" скоби около умноженията; израза се изпълнява все едно е: - ```c++ + ```cpp ((x += 5) * (x += 1)) * (x -= 8) .p - [*(Умножението е ляво асоциативно)*] + {i (Умножението е ляво асоциативно)} .p - Тоест, първо правим [`x += 5`] и след това [`x += 1`]. - Стойността на [`x`] е 15 и в големите скоби изчисляваме [`x * x = 225`]. + Тоест, първо правим {` x += 5} и след това {` x += 1}. + Стойността на {` x} е 15 и в големите скоби изчисляваме {` x * x = 225}. Сега израза се свежда до: - ```c++ + ```cpp 225 * (x -= 8) - Изпълнява се [`x -= 8`], [`x`] става 7, и [`y`] се свежда до [`225 * 7 = 1575`]. + Изпълнява се {` x -= 8}, {` x} става 7, и {` y} се свежда до {` 225 * 7 = 1575}. Първия метод се изпълнява от компилатора на Visual Studio, втория метод от gcc (много популярен C++ компилатор под Linux/MacOS). @@ -224,7 +224,7 @@ int y = (x += 5) * (x += 1) * (x -= 8); ## Масиви и матрици .important -Всички неща, които важат за статично-заделени масиви ([`int arr[5];`]), важат и за статично-заделени матрици ([`int mat[5][6];`])! +Всички неща, които важат за статично-заделени масиви ({` int arr[5];}), важат и за статично-заделени матрици ({` int mat[5][6];})! ### Връщане на масиви @@ -235,7 +235,7 @@ int y = (x += 5) * (x += 1) * (x -= 8); Например (да, в C++ можем да правим ей така обхвати): -```c++ +```cpp int main() { { int a = 5; // a се създава @@ -252,33 +252,33 @@ int main() { } // b се освобождава } -Като цяло, няма особено значение дали говорим за къдравите скоби на функция, на [`if`], на цикъл, ... +Като цяло, няма особено значение дали говорим за къдравите скоби на функция, на {` if}, на цикъл, ... -[$br2] +{br2} -Затова следното е [=грешно=]: +Затова следното е {b грешно}: -```c++ +```cpp int* f() { int arr[5] = { 1, 2, 3, 4, 5 }; return arr; } -[`arr`] е адрес в паметта (индекс, позиция, ..., която посочва клетка в паметта), някакво число. +{` arr} е адрес в паметта (индекс, позиция, ..., която посочва клетка в паметта), някакво число. -След като функцията свърши изпълнение и се върне стойността, ще сме "стигнали" къдравата скоба и [`arr`] ще бъде освободено. +След като функцията свърши изпълнение и се върне стойността, ще сме "стигнали" къдравата скоба и {` arr} ще бъде освободено. Може да зачитате, че стойностите се унищожават в този момент. Обаче, адреса сам по себе си е число, което си се връща и ние можем да работим с него както си искаме. -Тоест, [=C++ няма да ни се скара, че използваме масив, въпреки че той е, на практика, унищожен!=] +Тоест, {b C++ няма да ни се скара, че използваме масив, въпреки че той е, на практика, унищожен!} -[$br2] +{br2} -Ако искаме действително да върнем масив от стойности, трябва да го създадем в [=обхвата в който функцията се извиква и да го подадем като аргумент.=] +Ако искаме действително да върнем масив от стойности, трябва да го създадем в {b обхвата в който функцията се извиква и да го подадем като аргумент.} Например: -```c++ +```cpp void f(int* arr) { /* ... */ arr[0] = 28; @@ -295,111 +295,111 @@ int main() { Често използваме нотацията за къдрави скоби да инициализираме елементите на масив: -```c++ +```cpp int arr1[3] = { 1, 2, 3 }; Ако искаме да напълним масива с нули, често правим: -```c++ +```cpp int arr2[3] = { 0 }; -Обаче, ако примерно се опитаме да напълним масива с единици, тогава следното [=няма=] да проработи: +Обаче, ако примерно се опитаме да напълним масива с единици, тогава следното {b няма} да проработи: -```c++ +```cpp int arr3[3] = { 1 }; -[$br2] +{br2} Инициализацията чрез къдрави скоби работи по следния начин: всички елементи в масива се попълват спрямо подадените елементи в къдравите скоби. -[=Ако в къдравите скоби има по-малко елементи отколкото е голям масива, останалите елементи се попълват с нули!=] +{b Ако в къдравите скоби има по-малко елементи отколкото е голям масива, останалите елементи се попълват с нули!} -Тоест, в [`arr2`] ние попъляваме първия елемент да е нула, и останалите стават нули по подразбиране. -В [`arr3`] попълваме първия елемент да е единица и останалите стават нули по подразбиране. +Тоест, в {` arr2} ние попъляваме първия елемент да е нула, и останалите стават нули по подразбиране. +В {` arr3} попълваме първия елемент да е единица и останалите стават нули по подразбиране. Това навява на мисълта, дали не можем в C++ да пропуснем записването на първия елемент, когато искаме всичко да е нула? Можем! -```c++ +```cpp int arr4[3] = { }; // попълва arr4 с нули -[$br2] +{br2} Коректния метод, ако искаме да напълним масива с друг елемент, е да използваме цикъл. Например: -```c++ +```cpp for (int i = 0; i < 3; i++) arr[i] = 1; ### Масиви с неконстантен размер -[=Не=] позволяваме в този курс да правите такива неща: +{b Не} позволяваме в този курс да правите такива неща: -```c++ +```cpp int size; std::cin >> size; int arr[size]; -Въпреки че това [*може*] да се компилира и да работи. +Въпреки че това {i може} да се компилира и да работи. -Причината е защото този тип масиви се наричат [url https://en.wikipedia.org/wiki/Variable-length_array VLA]. -И в [=C++ VLA-ове не са позволени!=] +Причината е защото този тип масиви се наричат {url VLA;https://en.wikipedia.org/wiki/Variable-length_array}. +И в {b C++ VLA-ове не са позволени!} Въпреки това, много компилатори ги поддържат, главно защото много C++ компилатори са и C компилатори (и VLA-ове са позволени в C). -[=Единствения=] коректен метод да създадем масив, чиито размер не знаем предварително, е чрез динамича памет. +{b Единствения} коректен метод да създадем масив, чиито размер не знаем предварително, е чрез динамича памет. ### Тип на матрици (int[7][3] vs int(*)[3] vs int**) -```c++ +```cpp int mat[7][3]; -Какъв е типа на [`mat`]? +Какъв е типа на {` mat}? -От една страна е [`int[7][3]`]. -Но какъв е типа като указател, тоест когато няма въведени редове [=и=] колони? +От една страна е {` int[7][3]}. +Но какъв е типа като указател, тоест когато няма въведени редове {b и} колони? -Отговорите са два: [`int(*)[3]`] и [`int*`]. +Отговорите са два: {` int(*)[3]} и {` int*}. Ето защо. -[$br2] +{br2} Да си припомним как работят нормалните масиви. Когато декларираме следното: -```c++ +```cpp int arr[14]; -Тогава в паметта се [*използва*] (заделя) [=последователност=] от клетки, която побира 14 [`int`] стойности. +Тогава в паметта се {i използва} (заделя) {b последователност} от клетки, която побира 14 {` int} стойности. -Също да си припомним, че [`arr`] е указател към първата от тези клетки. +Също да си припомним, че {` arr} е указател към първата от тези клетки. -На кратко, това означава че [`arr`] е адрес (индекс, позиция, ..., число което посочва в коя клетка на паметта се намираме). +На кратко, това означава че {` arr} е адрес (индекс, позиция, ..., число което посочва в коя клетка на паметта се намираме). Финално припомняме, че индексирането в масив е същото като отместване на адреса. -Т.е. [`arr[6]`] е еквивалентно на [`*(arr + 6)`]. +Т.е. {` arr[6]} е еквивалентно на {` *(arr + 6)}. -На кратко, ние преместваме нашия адрес (индекс в паметта) напред с 6 позиции и с [`*`] дереферираме (прочитаме стойността на подадения адрес). +На кратко, ние преместваме нашия адрес (индекс в паметта) напред с 6 позиции и с {` *} дереферираме (прочитаме стойността на подадения адрес). -Това означава, че [=всички елементи в масива е нужно да бъдат поставени последователно в паметта=]. +Това означава, че {b всички елементи в масива е нужно да бъдат поставени последователно в паметта}. -[$br2] +{br2} -Двумерните масиви [=работят по същия начин!=] +Двумерните масиви {b работят по същия начин!} -В декларацията на [`mat`], в паметта се заделя последователност от клетки в паметта, равна на размера на матрицата. -Тоест [`7 * 3 = 21`] [=последователни=] [*позиции*] в паметта. +В декларацията на {` mat}, в паметта се заделя последователност от клетки в паметта, равна на размера на матрицата. +Тоест {` 7 * 3 = 21} {b последователни} {i позиции} в паметта. -Тогава, [`mat[2][1]`] на какво е еквивалентно? +Тогава, {` mat[2][1]} на какво е еквивалентно? -Отговорът е [`*(mat + 2 * 7 + 1)`]. +Отговорът е {` *(mat + 2 * 7 + 1)}. Нашата таблица е разположена като последователност от клетки, където първо имаме клетките от първи ред, след това от втория ред и так. нат. Например, при следната дефиниция на матрица: -```c++ +```cpp int nums[3][2] = { { 8, 92 }, { 20, 50 }, @@ -411,59 +411,59 @@ int nums[3][2] = { ``` 8 92 20 50 7 45 -Как извеждаме елемента [`nums[2][1]`]? -Това е последната стойност в матрицата, [`45`]. +Как извеждаме елемента {` nums[2][1]}? +Това е последната стойност в матрицата, {` 45}. Щом искаме трети ред (втори по индекс), значи трябва да пропуснем първите два реда. -Това са общо 4 числа, как го сметнахме? [`Два реда * брой колони на ред = 2 * 2`]. +Това са общо 4 числа, как го сметнахме? {` Два реда * брой колони на ред = 2 * 2}. Сега сме на последния ред, искаме втория елемент (първи по индекс), значи отиваме на следващия елемент. -Така показахме, че [`nums[2][1]`] е еквивалентно на [`*(nums + 2 * 2 + 1)`]. +Така показахме, че {` nums[2][1]} е еквивалентно на {` *(nums + 2 * 2 + 1)}. -[$br2] +{br2} -Това трябва да поражда въпрос: не можем ли да използваме [`nums`] като едномерен масив и да напишем [`nums[2 * 2 + 1]`]? +Това трябва да поражда въпрос: не можем ли да използваме {` nums} като едномерен масив и да напишем {` nums[2 * 2 + 1]}? Можем! -Затова е смислено да преобразуваме [`int[3][2]`] към [`int*`]. +Затова е смислено да преобразуваме {` int[3][2]} към {` int*}. Единствения проблем, е че употребата става неприятна. Например: -```c++ +```cpp void f(int* matrix) { /* ... */ matrix[2 * 2 + 1]; /* ... */ } -[$br2] +{br2} Забелязваме, че ако C++ знае броя колони, би трябвало да може да направи сам тази сметка с пропускането на редове. -От там се поражда [`int(*)[2]`] като смислено преобразуване на [`int[3][2]`]. +От там се поражда {` int(*)[2]} като смислено преобразуване на {` int[3][2]}. Това е най-обикновен указател, обаче му даваме броя колони (и с това, подсказваме че ще работим с матрица). С такъв тип указател можем да използваме синтаксиса с двете квадратни скоби. Например: -```c++ +```cpp void g(int (*matrix)[2]) { /* ... */ matrix[2][1]; /* ... */ } -[$br2] +{br2} Очевиден проблем, е че броя колони трябва да бъде константен (зададен в типа), ако искаме да ползваме двата чифта квадратни скоби. Няма ли начин да ги използваме с неконстантен брой колони? -Отговорът е [=не!=] +Отговорът е {b не!} -Изкушаващо е да използваме [`int**`], но този тип обозначава нещо друго: указател към указател. +Изкушаващо е да използваме {` int**}, но този тип обозначава нещо друго: указател към указател. -Ако имаме [`int** x`], то тогава [`x[2][1]`] [=няма=] да бъде еквивалентно на [`*(x + 2 * колони + 1)`]! -Ще бъде еквивалентно на [`*(*(x + 2) + 1)`]! +Ако имаме {` int** x}, то тогава {` x[2][1]} {b няма} да бъде еквивалентно на {` *(x + 2 * колони + 1)}! +Ще бъде еквивалентно на {` *(*(x + 2) + 1)}! Това защо е така ще разберем когато учим динамична памет. Тогава, матриците ни няма да бъдат последователност от елементи, ами ще бъдат последователност от (указатели към) масиви. diff --git a/src/teaching/upp-2025/ideas.du b/src/teaching/upp-2025/ideas.du index 7453dcf..b246989 100644 --- a/src/teaching/upp-2025/ideas.du +++ b/src/teaching/upp-2025/ideas.du @@ -144,7 +144,7 @@ Във входа получавате цяло число. Трябва да върнете (изкарате на екрана) стойността на числото делено на 7 (закръглено надолу). -[=Примери:=] +{b Примери:} :table_2 |= Вход @@ -162,9 +162,9 @@ Във входа получавате цяло число: дължина в инчове. Трябва да върнете размера в сантиметри по формулата (закръглено надолу): -[image ./cm-inch-formula Сантиметри = 50 / 127 * Инчове] +{img Сантиметри = 50 / 127 * Инчове;./cm-inch-formula} -[=Примери:=] +{b Примери:} :table_2 |= Вход diff --git a/src/teaching/upp-2025/index.du b/src/teaching/upp-2025/index.du index 2cad1df..f3f2c78 100644 --- a/src/teaching/upp-2025/index.du +++ b/src/teaching/upp-2025/index.du @@ -1,21 +1,25 @@ -# Увод в програмирането - практикум, Компютърни науки, 5 група +'def title Увод в програмирането - практикум, Компютърни науки, 5 група +'def desc Материали на проведените през 2025/2026 практикуми по Увод в програмирането на Компютърни науки (2 поток), 5 група. + +# {title} Материали на проведените през 2025/2026 практикуми по Увод в програмирането на Компютърни науки (2 поток), 5 група. -[=Зала:=] ФМИ 107 [$dbarsep] -[=Време:=] 16:00 - 18:00 [$dbarsep] -[=Ден:=] Четвъртък +{b Зала:} ФМИ 107 {dbarsep} +{b Време:} 16:00 - 18:00 {dbarsep} +{b Ден:} Четвъртък -[=Директни връзки:=] -[url ./week01/introduction.html?a#section-3 Контакт с мен] -| [url https://github.com/Syndamia/upp-2025-solutions Решения на задачи] -| [url https://github.com/18ivan18/IntroductionToProgramming2025 Материали от семинари] -| [url https://learn.fmi.uni-sofia.bg/course/view.php?id=11601 Курс в мудъл] +{b Директни връзки:} +{url Контакт с мен;./week01/introduction.html?a#section-3} +| {url Решения на задачи;https://github.com/Syndamia/upp-2025-solutions} +| {url Материали от семинари;https://github.com/18ivan18/IntroductionToProgramming2025} +| {url Курс в мудъл;https://learn.fmi.uni-sofia.bg/course/view.php?id=11601} -[=Допълнителни ресурси:=] -[url ./cpp-pitfalls Капани в C++] +{b Допълнителни ресурси:} +{url Капани в C++;./cpp-pitfalls} -:table_3 +:table +:3 |= № |= Дата |= Материали @@ -27,34 +31,34 @@ |: |: |: -[url ./week01/introduction.html?a Уводни бележки] -|| [url ./week01/concepts.html?a Общи концепции] -|| [url ./week01/github_classroom.html?a GitHub Classroom упътване] -|| [url ./week01/visual_studio.html?a Visual Studio упътване] -|| <br>[url ./week01/zip.html?a ZIP архиви упътване] +{url Уводни бележки;./week01/introduction.html?a} +|| {url Общи концепции;./week01/concepts.html?a} +|| {url GitHub Classroom упътване;./week01/github_classroom.html?a} +|| {url Visual Studio упътване;./week01/visual_studio.html?a} +|| <br>{url ZIP архиви упътване;./week01/zip.html?a} |: |: |: -[url ./week01 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week01 Решения] -|| [url https://classroom.github.com/a/-1l498jX GitHub Classroom] +{url Задачи;./week01} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week01} +|| {url GitHub Classroom;https://classroom.github.com/a/-1l498jX} |: 2 |: 09.10.2025 -|: Програмистко мислене [*(много експериментално)*] +|: Програмистко мислене {i (много експериментално)} |: |: |: -[url ./week02/machine_manual.html?a Упътване на машинната таблица] || [url ./week02/machine.html?a Машинна таблица] +{url Упътване на машинната таблица;./week02/machine_manual.html?a} || {url Машинна таблица;./week02/machine.html?a} |: |: |: -[url ./week02 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02 Решения] -|| [url https://classroom.github.com/a/DRjtkc6f GitHub Classroom] +{url Задачи;./week02} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02} +|| {url GitHub Classroom;https://classroom.github.com/a/DRjtkc6f} |: 3 |: 16.10.2025 @@ -63,9 +67,9 @@ |: |: |: -[url ./week03 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03 Решения] -|| [url https://classroom.github.com/a/UMc2WhVX GitHub Classroom] +{url Задачи;./week03} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03} +|| {url GitHub Classroom;https://classroom.github.com/a/UMc2WhVX} |: 4 |: 23.10.2025 @@ -74,9 +78,9 @@ |: |: |: -[url ./week04 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04 Решения] -|| [url https://classroom.github.com/a/rOzekyCs GitHub Classroom] +{url Задачи;./week04} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04} +|| {url GitHub Classroom;https://classroom.github.com/a/rOzekyCs} |: 5 |: 30.10.2025 @@ -85,9 +89,9 @@ |: |: |: -[url ./week05 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05 Решения] -|| [url https://classroom.github.com/a/6oPRMxJx GitHub Classroom] +{url Задачи;./week05} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05} +|| {url GitHub Classroom;https://classroom.github.com/a/6oPRMxJx} |: 6 |: 06.11.2025 @@ -96,9 +100,9 @@ |: |: |: -[url ./week06 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06 Решения] -|| [url https://classroom.github.com/a/JSB1UK_f GitHub Classroom] +{url Задачи;./week06} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06} +|| {url GitHub Classroom;https://classroom.github.com/a/JSB1UK_f} |: 7 |: 13.11.2025 @@ -107,9 +111,9 @@ |: |: |: -[url ./week07 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07 Решения] -|| [url https://classroom.github.com/a/clYBilXQ GitHub Classroom] +{url Задачи;./week07} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07} +|| {url GitHub Classroom;https://classroom.github.com/a/clYBilXQ} |: 8 |: 20.11.2025 @@ -118,9 +122,9 @@ |: |: |: -[url ./week08 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08 Решения] -|| [url https://classroom.github.com/a/rhpKbNmH GitHub Classroom] +{url Задачи;./week08} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08} +|| {url GitHub Classroom;https://classroom.github.com/a/rhpKbNmH} |: 9 |: 27.11.2025 @@ -129,9 +133,9 @@ |: |: |: -[url ./week09 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week09 Решения] -|| [url https://classroom.github.com/a/ZYFDdLi4 GitHub Classroom] +{url Задачи;./week09} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week09} +|| {url GitHub Classroom;https://classroom.github.com/a/ZYFDdLi4} |: 10 |: 04.12.2025 @@ -140,9 +144,9 @@ |: |: |: -[url ./week10 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10 Решения] -|| [url https://classroom.github.com/a/kDfmWmy7 GitHub Classroom] +{url Задачи;./week10} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10} +|| {url GitHub Classroom;https://classroom.github.com/a/kDfmWmy7} |: 11 |: 11.12.2025 @@ -151,9 +155,9 @@ |: |: |: -[url ./week11 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11 Решения] -|| [url https://classroom.github.com/a/z_C3UMi8 GitHub Classroom] +{url Задачи;./week11} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11} +|| {url GitHub Classroom;https://classroom.github.com/a/z_C3UMi8} |: 12 |: 18.12.2025 @@ -162,9 +166,9 @@ |: |: |: -[url ./week12 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week12 Решения] -|| [url https://classroom.github.com/a/zvYPAVPS GitHub Classroom] +{url Задачи;./week12} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week12} +|| {url GitHub Classroom;https://classroom.github.com/a/zvYPAVPS} |: 13 |: 08.01.2026 @@ -173,9 +177,9 @@ |: |: |: -[url ./week13 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13 Решения] -|| [url https://classroom.github.com/a/8vTquPOY GitHub Classroom] +{url Задачи;./week13} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13} +|| {url GitHub Classroom;https://classroom.github.com/a/8vTquPOY} |: 14 |: 15.01.2026 @@ -184,11 +188,11 @@ |: |: |: -[url ./week14/bitwise-and-binary-representation.html?a Побитови операции и представяне на числени данни] +{url Побитови операции и представяне на числени данни;./week14/bitwise-and-binary-representation.html?a} |: |: |: -[url ./week14 Задачи] -|| [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week14 Решения] -|| [url https://classroom.github.com/a/JjE8rZOx GitHub Classroom] +{url Задачи;./week14} +|| {url Решения;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week14} +|| {url GitHub Classroom;https://classroom.github.com/a/JjE8rZOx} diff --git a/src/teaching/upp-2025/week01/concepts.du b/src/teaching/upp-2025/week01/concepts.du index 242e635..33bb98e 100644 --- a/src/teaching/upp-2025/week01/concepts.du +++ b/src/teaching/upp-2025/week01/concepts.du @@ -1,11 +1,11 @@ -# Общи концепции - УПП, Седмица 1, 02.10.2025 +'def title Общи концепции - УПП, Седмица 1, 02.10.2025 +'def desc Общи концепции за компютрите, компилацията, git и GitHub Classroom. -'define expected-reading 4 min -'define created 27 September 2025 -'define edited 28 September 2025 -[$pagenav] +# {title} -[$presentation-controller] +{pagenav 4 min;27 September 2025;28 September 2025} + +{presentation-controller} :title_slide35 @@ -16,7 +16,7 @@ ## Компютър, код, компилиране -[$br2] +{br2} :unordered - Компютъра е една гигантска елка с много бутони и памет @@ -34,28 +34,28 @@ - В древността (около 1940те) програмистите са ръчно са размествали жички за да работят с компютъра - Електротехниката се развива и това "разместване" се случва без нуждата от промяна в електрическата схема - На хората им омръзва от писането на числа, изобретяват програмните езици -- Това е ([=неформатиран=]) текст, като комбинации от знаци се свеждат до съответните цифри +- Това е ({b неформатиран}) текст, като комбинации от знаци се свеждат до съответните цифри .unordered - Например, нека числото 200 да обозначава\n - "добавяне на единица към [*(регистър)*] Y" - - С програмен език текста [`INY`] или [`++Y`] се свежда до числото 200 + "добавяне на единица към {i (регистър)} Y" + - С програмен език текста {` INY} или {` ++Y} се свежда до числото 200 :middle_slide35 .unordered -- Програмите които превръщат този текст в числа се наричат [=компилатори=]. - Самия процес - [=компилиране=]. +- Програмите които превръщат този текст в числа се наричат {b компилатори}. + Самия процес - {b компилиране}. - Разногласия по какъв текст какво трябва да значи още текат, затова имаме различни (програмни) езици - Допълнително, хората правят комбинации от знаци, които се превеждат до много числа по сложни начини -- Така се зараждат [=парадигмите=] +- Така се зараждат {b парадигмите} :slide35 ## История на версиите, git -[$br2] +{br2} .unordered - Microsoft Word, браузърите, ... следят история на действия @@ -67,21 +67,21 @@ :middle_slide35 .unordered -- [url https://git-scm.com/ git] е програма, която пази такива разклонени редици от промени върху файловете в директории -- Всяка промяна се нарича "[=commit=]" -- Различните разклонения се наричат "[=branch=]"-ове +- {url git;https://git-scm.com/} е програма, която пази такива разклонени редици от промени върху файловете в директории +- Всяка промяна се нарича "{b commit}" +- Различните разклонения се наричат "{b branch}"-ове - Всеки "commit" трябва да има автор и описание, тоест commit-ове не се правят автоматично! - Създаването/изтриването на файлове с/без съдържание също се включва в commit-ите -- Папка (и всички под-папки в нея) в която git следи за промени се нарича "[=repository=]" (хранилище) +- Папка (и всички под-папки в нея) в която git следи за промени се нарича "{b repository}" (хранилище) :slide35 .unordered - Понякога искаме да споделим нашите промени и да смесим чужди промени при нас\n - [*(примерно няколко програмиста паралелно правят модификации по един и същ код)*] + {i (примерно няколко програмиста паралелно правят модификации по един и същ код)} - Можем да използваме Google Drive/Dropbox/... и ръчно да смесваме, но става сложно и тромаво -- Сайтове като [url https://github.com GitHub] са специализирани за работа с repository-та. +- Сайтове като {url GitHub;https://github.com} са специализирани за работа с repository-та. Предоставят: .unordered - безплатно пространство (облак) за repository-и @@ -100,12 +100,12 @@ ## GitHub Classroom -[$br1] +{br1} .unordered -- Чрез [url https://classroom.github.com GitHub Classroom] ще създавам [=задания с ограничен срок=] (края на съответното упражнение) +- Чрез {url GitHub Classroom;https://classroom.github.com} ще създавам {b задания с ограничен срок} (края на съответното упражнение) - Когато вие приемете заданието, автоматично се създава git repository към което имате (ограничен) достъп -- Преди срока трябва да добавите commit с вашата работа по време на упражнението, [=колкото и малко да е!=] +- Преди срока трябва да добавите commit с вашата работа по време на упражнението, {b колкото и малко да е!} - Добавя се един автоматичен "pull request" в който ще пиша отзивите. @@ -113,4 +113,4 @@ :title_slide35 -.p [url ./github_classroom.html?a Към "GitHub Classroom упътване"] +.p {url Към "GitHub Classroom упътване";./github_classroom.html?a} diff --git a/src/teaching/upp-2025/week01/github_classroom.du b/src/teaching/upp-2025/week01/github_classroom.du index fbce90d..8ece732 100644 --- a/src/teaching/upp-2025/week01/github_classroom.du +++ b/src/teaching/upp-2025/week01/github_classroom.du @@ -1,11 +1,11 @@ -# GitHub Classroom упътване - УПП, Седмица 1, 02.10.2025 +'def title GitHub Classroom упътване - УПП, Седмица 1, 02.10.2025 +'def desc Упътване как да си създадете GitHub акаунт и как да използвате GitHub Classroom. -'define expected-reading 5 min -'define created 27 September 2025 -'define edited 27 September 2025 -[$pagenav] +# {title} -[$presentation-controller] +{pagenav 5 min;27 September 2025;27 September 2025} + +{presentation-controller} :title_slide @@ -19,9 +19,9 @@ ## Сега всички (които нямат) трябва да си направят GitHub акаунти .p -Отивате на [url https://github.com/signup github.com/signup], въвеждате си данните една по една и се регистрирате +Отивате на {url github.com/signup;https://github.com/signup}, въвеждате си данните една по една и се регистрирате -.p [image ../../upp-2023/week1/img/github-signup.gif] +.p {img ../../upp-2023/week1/img/github-signup.gif} :middle_slide @@ -29,7 +29,7 @@ .p След това, като влезете в акаунтите си (което става автоматично след регистрация), на заглавната страница ще имате нещо такова: -.width75% [image ../../upp-2023/week1/img/github-index.gif] +.width75% {img ../../upp-2023/week1/img/github-index.gif} .p В горния десен ъгъл, където е иконката с квадрати на бял фон, след натискане получавате sidebar. @@ -46,11 +46,11 @@ .p Най-простия начин, който намерих, е да отворите -[url https://support.github.com/contact/reinstatement support.github.com/contact/reinstatement]\n +{url support.github.com/contact/reinstatement;https://support.github.com/contact/reinstatement}\n Ако отгоре пише "Your account has been flagged", тогава имаме проблем. .p -[image ../../upp-2023/week1/img/github-support-flagged.gif] +{img ../../upp-2023/week1/img/github-support-flagged.gif} :title_slide35 @@ -62,14 +62,14 @@ ## Как ще ползваме GitHub Classroom -[$br3] +{br3} .p За всеки практикум ще има направя линк. При приемане на заданието се генерира repository. .p -Трябва да сте качили работата си [=по време=] на упражнението (или малко след това) в това repository. +Трябва да сте качили работата си {b по време} на упражнението (или малко след това) в това repository. GitHub предоставя лесни начини да правите промени по файлове директно чрез браузъра, така че за незаинтересуваните, може да го ползвате като усложнен Google Drive. .p @@ -84,12 +84,12 @@ GitHub предоставя лесни начини да правите пром За всяко упражнение ще има отделен линк.\n Този за днеска е: [url https://classroom.github.com/a/-1l498jX] -[$br1] +{br1} :row .p След като го отворите, ще видите съобщение за разрешение, авторизирайте го. -.p [image ../../upp-2023/week1/img/github-classroom-authorize.gif] +.p {img ../../upp-2023/week1/img/github-classroom-authorize.gif} @@ -97,7 +97,7 @@ GitHub предоставя лесни начини да правите пром :row -.width60% [image ../../upp-2023/week1/img/join-the-classroom.gif] +.width60% {img ../../upp-2023/week1/img/join-the-classroom.gif} :column @@ -114,12 +114,12 @@ GitHub предоставя лесни начини да правите пром .p След това, би трябвало да видите страницата за "Приемане на заданието". -.width40% [image ../../upp-2023/week1/img/accept-assignment.gif] +.width40% {img ../../upp-2023/week1/img/accept-assignment.gif} .p След като го приемете, на новата страница, изчакайте няколко секунди и презаредете. Трябва да видите това: -.width40% [image ../../upp-2023/week1/img/ready-to-go.gif] +.width40% {img ../../upp-2023/week1/img/ready-to-go.gif} :middle_slide @@ -144,7 +144,7 @@ GitHub предоставя лесни начини да правите пром Целта е да видя какво правите и да ви помогна, моля проверявайте какво съм ви писал, по подразбиране би трябвало да получавате известия на имейл-а. .centered -.width80% [image ../../upp-2023/week1/img/feedback.gif] +.width80% {img ../../upp-2023/week1/img/feedback.gif} :slide @@ -160,9 +160,9 @@ GitHub предоставя лесни начини да правите пром Най-елементарния начин: копирате всичко, след това отивате на вашето GitHub repository, кликвате "Add", после "Create new file". .p -Отгоре на "Name your file..." пишете някакво име, което [=моля да завърша на [`.cpp`]!=] +Отгоре на "Name your file..." пишете някакво име, което {b моля да завърша на {` .cpp}!} Това показва, че файла съдържа код на C++. -Също, когато решавате много задачи и създавате много такива файлове, [=напомням че имената на файловете трябва да са различни.=] +Също, когато решавате много задачи и създавате много такива файлове, {b напомням че имената на файловете трябва да са различни.} .p В "Enter file contents here" пействате копирания код. @@ -171,4 +171,4 @@ GitHub предоставя лесни начини да правите пром :title_slide35 -.p [url ./visual_studio.html?a Към "Visual Studio упътване"] +.p {url Към "Visual Studio упътване";./visual_studio.html?a} diff --git a/src/teaching/upp-2025/week01/index.du b/src/teaching/upp-2025/week01/index.du index f3a5364..8fc3e52 100644 --- a/src/teaching/upp-2025/week01/index.du +++ b/src/teaching/upp-2025/week01/index.du @@ -1,44 +1,44 @@ -# Задачи - УПП, Седмица 1, 01.10.2025 +'def title Задачи - УПП, Седмица 1, 02.10.2025 +'def desc Условия на задачите за упражнение. -'define expected-reading 2 min -'define created 27 September 2025 -'define edited 27 September 2025 -[$pagenav] +# {title} + +{pagenav 2 min;27 September 2025;27 September 2025} .warn Не сте имали нито лекция нито семинарно упражнение, затова в задачите няма писане на код. -GitHub Classroom: [url https://classroom.github.com/a/-1l498jX] +GitHub Classroom: {url https://classroom.github.com/a/-1l498jX} ## 1 задача - Hello, World! Изкарайте на екрана съобщението "Hello, World!". Ако използвате Visual Studio, проектът по подразбиране трябва да съдържа програмата за "Hello, World!". -Нужно е единствено да я компилирате и пуснете, както са инструкциите в [url ./visual_studio.du#section-6 презентацията "Visual Studio"]. +Нужно е единствено да я компилирате и пуснете, както са инструкциите в {url презентацията "Visual Studio";./visual_studio.du#section-6}. -Ако използвате друга среда/редактор, създайте [`C++`] файл със следното съдържание: +Ако използвате друга среда/редактор, създайте {` C++} файл със следното съдържание: -```c++ -'include ./helloworld.cpp +```cpp +'snippet 1 $ ./helloworld.cpp Компилирайте го и го изпълнете според инструкциите на вашата програма. ### Исторически контекст В модерно време, това е класическата първа задача по програмиране. -Цялата идея идва от книгата/упътване [url https://en.wikipedia.org/wiki/The_C_Programming_Language The C Programming Language] (първо издание 1978). +Цялата идея идва от книгата/упътване {url The C Programming Language;https://en.wikipedia.org/wiki/The_C_Programming_Language} (първо издание 1978). Тази книга (и съответния език) са едни от най-популярните в програмирането. Ако някой не е запознат, целия свят се крепи на C :) ## 2 задача - Качване в GitHub Classroom -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week01 Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week01} -Създайте [=ZIP архив=] който съдържа вашия [`.cpp`] файл (съдържащ "Hello, World!" програмата). +Създайте {b ZIP архив} който съдържа вашия {` .cpp} файл (съдържащ "Hello, World!" програмата). Качете архива във вашето repository към заданието най-отгоре на страницата. -Инструкции за създаване на ZIP архив [url ./zip.html тук]. +Инструкции за създаване на ZIP архив {url тук;./zip.html}. -Инструкции за използване на GitHub Classroom [url ./github_classroom.html#-github-classroom-1 тук]. +Инструкции за използване на GitHub Classroom {url тук;./github_classroom.html#-github-classroom-1}. diff --git a/src/teaching/upp-2025/week01/introduction.du b/src/teaching/upp-2025/week01/introduction.du index 1e077c5..0585131 100644 --- a/src/teaching/upp-2025/week01/introduction.du +++ b/src/teaching/upp-2025/week01/introduction.du @@ -1,11 +1,11 @@ -# Уводни бележки - УПП, Седмица 1, 02.10.2025 +'def title Уводни бележки - УПП, Седмица 1, 02.10.2025 +'def desc Бележки относно практикума и курса. -'define expected-reading 4 min -'define created 27 September 2025 -'define edited 30 September 2025 -[$pagenav] +# {title} -[$presentation-controller] +{pagenav 4 min;27 September 2025;30 September 2025} + +{presentation-controller} :title_slide35 @@ -13,14 +13,14 @@ .p .width65% -[image_url https://upload.wikimedia.org/wikipedia/commons/3/3c/Chimpanzee_seated_at_typewriter.jpg https://en.wikipedia.org/wiki/Infinite_monkey_theorem] +{url {img https://upload.wikimedia.org/wikipedia/commons/3/3c/Chimpanzee_seated_at_typewriter.jpg};https://en.wikipedia.org/wiki/Infinite_monkey_theorem} :slide35 ## Елементарните неща out of the way -[$br3] +{br3} .unordered - Първите 15 минути на всеки кръгъл час са почивка @@ -33,7 +33,7 @@ ## Кой съм Аз -[$br5] +{br5} .unordered - Казвам се Камен. @@ -55,7 +55,7 @@ - <a href="mailto:kamen.d.mladenov@protonmail.com">kamen.d.mladenov@protonmail.com</a> <a class="borderless" href="/files/publickey-kamen.d.mladenov@protonmail.com-62ca52e87475c874b9e6ebf3c4c9f716b6ce4c9d.asc"><img class="borderless unzoomable" src="/img/pgpkey.gif" alt="PGP key"></a> -.p Директни линкове към Facebook и Discord има на [url https://learn.fmi.uni-sofia.bg/user/profile.php?id=23229 профила ми в Moodle].\n +.p Директни линкове към Facebook и Discord има на {url профила ми в Moodle;https://learn.fmi.uni-sofia.bg/user/profile.php?id=23229}.\n @@ -63,12 +63,12 @@ ## Кои сте вие? -[$br2] +{br2} .unordered - Няма да обикалям човек по човек. -[$br1] +{br1} .unordered - Кои са състезатели? @@ -86,18 +86,18 @@ ## Занятията -[$br3] +{br3} .unordered -- [=Лекции=] - теория и формалности зад нещата -- [=Семинари=] (семинарни упражнения) - как теоретичните неща се реализират -- [=Практикуми=] (практически упражнения) - реализиране на нещата от вас +- {b Лекции} - теория и формалности зад нещата +- {b Семинари} (семинарни упражнения) - как теоретичните неща се реализират +- {b Практикуми} (практически упражнения) - реализиране на нещата от вас :slide35 ## Оценяване -[$br4] +{br4} .unordered - Ще разберете на лекцията утре, от доц. Нора Ангелова.\n @@ -110,17 +110,17 @@ ## Материала -[$br4] +{br4} .unordered -- Ще работим изцяло с езика [`C++`] +- Ще работим изцяло с езика {` C++} - Ще разглеждаме общи концепции: оператори, цикли, функции, масиви, низове -- И някои по-специални понятия: [=указатели=], [=рекурсия=] +- И някои по-специални понятия: {b указатели}, {b рекурсия} :slide35 -[$br2] +{br2} ### За състезателите @@ -128,45 +128,45 @@ - Ще трябва да научите как се пише четим код - Може би не сте запознати с някои детайли -[$br1] +{br1} ### За хората без опит .unordered -- Материалът е [=много=] и бързо напредваме. +- Материалът е {b много} и бързо напредваме. Няма да имаме време всичко да изговорим. -- Допълнителна самоподготовка е [=нужна=] и едва ли ще можете да се справите без нея. +- Допълнителна самоподготовка е {b нужна} и едва ли ще можете да се справите без нея. :slide35 ### За всички -[$br3] +{br3} .unordered -- [=Не се отпускайте!=] -- [`C++`] е език на ниско ниво, има безброй много детайли които може да ви спънат. +- {b Не се отпускайте!} +- {` C++} е език на ниско ниво, има безброй много детайли които може да ви спънат. - Ние имаме специфични изисквания за писане на код.\n - [=Ако не ги спазвате, дори решението да работи, може да получите слаба оценка!=] + {b Ако не ги спазвате, дори решението да работи, може да получите слаба оценка!} :slide35 ## Плагиатство -[$br2] +{br2} .unordered - В училище (разкрито) преписването води до двойка и потенциално обаждане към родителите. -- Във ФМИ при установено плагиатството, [=в срок от една година=], студента [*може*] да бъде [=изключен от университета без възможност да се запише обратно=]. +- Във ФМИ при установено плагиатството, {b в срок от една година}, студента {i може} да бъде {b изключен от университета без възможност да се запише обратно}. - По-добре си изкарайте двойката, ще ви дадем достатъчно шансове да си минете курса. :middle_slide35 :centered -.p [*Пък и може би не си заслужава...*] +.p {i Пък и може би не си заслужава...} <iframe width="480" height="360" src="https://www.youtube.com/embed/hMloyp6NI4E"> </iframe> @@ -182,20 +182,20 @@ ## Как ще ги водим -[$br2] +{br2} .unordered - В началото на часа давам задачи, вие ги решавате. - Всички текстови редактори/IDE-та са позволени. -- До края на часа трябва да предадете написаното от вас в [url ./github_classroom.html#-github-classroom-1 GitHub Classroom] -- Ще връщам обратна връзка към предаденото, [*моля да я четете!*] +- До края на часа трябва да предадете написаното от вас в {url GitHub Classroom;./github_classroom.html#-github-classroom-1} +- Ще връщам обратна връзка към предаденото, {i моля да я четете!} :slide ## Видове задачи -[$br1] +{br1} .defs ; За решаване @@ -203,7 +203,7 @@ ; За самоподготовка : По-сложни задачи, които ще описват възможни проблеми от реалния свят ; За любознателните -: 1-2 сложни задачи, чиято цел е да се реализира [*реалистичен*] използваем софтуерен компонент +: 1-2 сложни задачи, чиято цел е да се реализира {i реалистичен} използваем софтуерен компонент :middle_slide35 @@ -218,23 +218,23 @@ ## Изкуствен интелект -[$br4] +{br4} .unordered - Ще чуете и други мнения от екипа по тематa - Анализ на генериран изход от ИИ ще бъде разглеждан в курса -- На практикумите ви е позволено да го ползвате, [=но=] не го окуражавам +- На практикумите ви е позволено да го ползвате, {b но} не го окуражавам :slide35 -[$br2] +{br2} .p Различни умения са: .numbered -1. да [=напишеш сам=] код от нулата -2. да [=четеш=] код и разбереш какво прави -3. да [=модифицираш/допълниш=] вече написан код +1. да {b напишеш сам} код от нулата +2. да {b четеш} код и разбереш какво прави +3. да {b модифицираш/допълниш} вече написан код .unordered - Чрез ИИ избягвате да правите първото. @@ -244,4 +244,4 @@ :title_slide35 -.p [url ./concepts.html?a Към "Общи концепции"] +.p {url Към "Общи концепции";./concepts.html?a} diff --git a/src/teaching/upp-2025/week01/visual_studio.du b/src/teaching/upp-2025/week01/visual_studio.du index cf7a9d4..e1f943d 100644 --- a/src/teaching/upp-2025/week01/visual_studio.du +++ b/src/teaching/upp-2025/week01/visual_studio.du @@ -1,11 +1,11 @@ -# Visual Studio упътване - УПП, Седмица 1, 02.10.2025 +'def title Visual Studio упътване - УПП, Седмица 1, 02.10.2025 +'def desc Упътване как да инсталирате, настроите и използвате Visual Studio. -'define expected-reading 6 min -'define created 27 September 2025 -'define edited 28 September 2025 -[$pagenav] +# {title} -[$presentation-controller] +{pagenav 6 min;27 September 2025;28 September 2025} + +{presentation-controller} :title_slide35 @@ -16,17 +16,17 @@ ## Къде пишем код? -[$br2] +{br2} .p -[=Кодът е чисто и просто текст=], компилаторът е специалната програма, която превръща този текст в нещо, което може компютъра да изпълни. +{b Кодът е чисто и просто текст}, компилаторът е специалната програма, която превръща този текст в нещо, което може компютъра да изпълни. .p -За писане и редактиране на текст ползваме [=текстови редактори=]. +За писане и редактиране на текст ползваме {b текстови редактори}. Програмистите са искали да улеснят работата си, затова модерните текстови редактори поддържат много помощни функционалности: показване на грешки на точния ред, автоматично форматиране, ... .p -За някои и това не е било достатъчно удобно, затова са създадени [=Integrated Development Environment=] (IDE), програми които съдържат в себе си всичко нужно за разработка на код. +За някои и това не е било достатъчно удобно, затова са създадени {b Integrated Development Environment} (IDE), програми които съдържат в себе си всичко нужно за разработка на код. Тоест, те са текстови редактори, но "вградено" могат да компилират код, да менажират сегашното repository, ... @@ -57,13 +57,13 @@ Visual Studio е вече инсталирано там. ### Инсталация -[$br5] +{br5} .p -За Visual Studio, отивате на [url https://visualstudio.microsoft.com/ visualstudio.microsoft.com], скролвате малко надолу, избирате "Download Visual Studio" и след това "Community 2022". +За Visual Studio, отивате на {url visualstudio.microsoft.com;https://visualstudio.microsoft.com/}, скролвате малко надолу, избирате "Download Visual Studio" и след това "Community 2022". .bulleted 'footnote vs-2022-old-win Може би има трикове с които да инсталирате 2022 версията, но те не са официални и затова няма да го преподам -- Ако искате да ползвате по-стара ОС, като Windows 8.1 или Windows 7 ще трябва да използвате "Community 2019"[$vs-2022-old-win], разликата между версиите не е съществена, затова не се притеснявайте. +- Ако искате да ползвате по-стара ОС, като Windows 8.1 или Windows 7 ще трябва да използвате "Community 2019"{vs-2022-old-win}, разликата между версиите не е съществена, затова не се притеснявайте. :slide @@ -76,7 +76,7 @@ Visual Studio е вече инсталирано там. Би трябвало да заема към 11 GB памет и в моето тестване се инсталира за 10тина минути. .centered -.width80% [image ../../upp-2023/week1/img/vs-install.gif] +.width80% {img ../../upp-2023/week1/img/vs-install.gif} :slide @@ -92,9 +92,9 @@ Visual Studio е вече инсталирано там. :width75% :row -.p [image ../../upp-2023/week1/img/vs-signin.gif] +.p {img ../../upp-2023/week1/img/vs-signin.gif} -.p [image ../../upp-2023/week1/img/vs-start-env.gif] +.p {img ../../upp-2023/week1/img/vs-start-env.gif} @@ -114,7 +114,7 @@ Visual Studio е вече инсталирано там. В лявата колона имате скорошни проекти, в дясната имате начини да създадете нов проект. :centered -:width80% [image ../../upp-2023/week1/img/vs-open-recent.gif] +:width80% {img ../../upp-2023/week1/img/vs-open-recent.gif} @@ -127,7 +127,7 @@ Visual Studio е вече инсталирано там. В този курс ще работим само и единствено с "Console App", затова изберете него и кликнете "Next". :centered -:width75% [image ../../upp-2023/week1/img/vs-create-project.gif] +:width75% {img ../../upp-2023/week1/img/vs-create-project.gif} @@ -139,7 +139,7 @@ Visual Studio е вече инсталирано там. Тук единствено може да искате да промените Project Name и Location, другото не е важно. :centered -:width80% [image ../../upp-2023/week1/img/vs-configure-project.gif] +:width80% {img ../../upp-2023/week1/img/vs-configure-project.gif} @@ -171,7 +171,7 @@ Visual Studio е вече инсталирано там. :centered :width60% -.p [image ../../upp-2023/week1/img/vs-general.gif] +.p {img ../../upp-2023/week1/img/vs-general.gif} @@ -179,7 +179,7 @@ Visual Studio е вече инсталирано там. В Solution Explorer имате всички файлове от проекта (Visual Studio позволява да групирате няколко проекта в едно, наречено Solution, не е нужно да се занимавате). .p -Тук [=единственото важно за вас се намира в папката "Source Files"=]. +Тук {b единственото важно за вас се намира в папката "Source Files"}. В нея ще се намира вашия код, всичко останало са допълнителни неща, които са релевантни за по-големи проекти. @@ -192,7 +192,7 @@ Visual Studio е вече инсталирано там. :width50% :fright -.p [image ../../upp-2023/week1/img/vs-debug-menu.gif] +.p {img ../../upp-2023/week1/img/vs-debug-menu.gif} @@ -200,14 +200,14 @@ Visual Studio е вече инсталирано там. .p След малко чакане, би трябвало да излезе един прозорец, който изглежда горе-долу така: -.p [image ../../upp-2023/week1/img/vs-console.gif] +.p {img ../../upp-2023/week1/img/vs-console.gif} :slide ### Дебъгване -[$br1] +{br1} .p Bug е когато нещо непланирано се случи в кода. @@ -220,7 +220,7 @@ Visual Studio предоставя много функционалности, к .p При компилиране, ще получим съобщение за грешки по време на компилирането. -.p [image ../../upp-2023/week1/img/vs-build-errors.gif] +.p {img ../../upp-2023/week1/img/vs-build-errors.gif} :slide @@ -235,11 +235,11 @@ Visual Studio предоставя много функционалности, к Той се появява когато при компилиране получим грешки и изчезва когато няма. :centered -:width70% [image ../../upp-2023/week1/img/vs-errors.gif] +:width70% {img ../../upp-2023/week1/img/vs-errors.gif} :title_slide35 -.p [url ./zip.html?a Към "ZIP архиви упътване"] +.p {url Към "ZIP архиви упътване";./zip.html?a} diff --git a/src/teaching/upp-2025/week01/zip.du b/src/teaching/upp-2025/week01/zip.du index d81320a..5b73cd9 100644 --- a/src/teaching/upp-2025/week01/zip.du +++ b/src/teaching/upp-2025/week01/zip.du @@ -1,11 +1,11 @@ -# ZIP архиви упътване - УПП, Седмица 1, 01.09.2025 +'def title ZIP архиви упътване - УПП, Седмица 1, 02.10.2025 +'def desc Упътване какво да инсталирате за създаване на ZIP архиви и как да ги създадете. -'define expected-reading 2 min -'define created 27 September 2025 -'define edited 28 September 2025 -[$pagenav] +# {title} -[$presentation-controller] +{pagenav 2 min;27 September 2025;28 September 2025} + +{presentation-controller} :title_slide35 @@ -23,10 +23,10 @@ ## Windows 11 -[$br4] +{br4} :unordered -- Под Windows 11 с [*новото*] меню което излиза при натискане на десен бутон, можете директно да архивирате селектираните файлове +- Под Windows 11 с {i новото} меню което излиза при натискане на десен бутон, можете директно да архивирате селектираните файлове - Тоест, процедурата е .numbered 1. Селекция на файловете за архивиране @@ -41,30 +41,30 @@ ## Windows 2000 - Windows 11 -[$br3] +{br3} :unordered - Ще трябва да инсталирате програма за ZIP файлове. -- Тази която аз препоръчвам е [url https://www.7-zip.org/ 7-Zip], спрямо WinRAR: +- Тази която аз препоръчвам е {url 7-Zip;https://www.7-zip.org/}, спрямо WinRAR: .unordered - Няма дразненето с безплатния trial - Поддържа повече формати - Налично е за повече ОС -- Инсталацията е стандартна: от [url https://www.7-zip.org/ заглавната страница] изтегляте 64bit-овата версия, пускате инсталатора +- Инсталацията е стандартна: от {url заглавната страница;https://www.7-zip.org/} изтегляте 64bit-овата версия, пускате инсталатора :slide -[$br3] +{br3} .ordered 1. Селектирате файловете които искате да архивирате -2. Десен бутон [*(под Windows 11 трябва да натиснете "Show more options")*] +2. Десен бутон {i (под Windows 11 трябва да натиснете "Show more options")} 3. Задържате курсора върху "7-Zip" -4. Избирате [`Add to "SOMETHING.[=zip=]"`], където [`SOMETHING`] ще е името на папката в която се намирате. +4. Избирате {` Add to "SOMETHING.{b zip}"}, където {` SOMETHING} ще е името на папката в която се намирате. Това директно създава архив с името на текущата папка. -5. Алтернативно избирате [`Add to archive...`]. +5. Алтернативно избирате {` Add to archive...}. От там се отваря прозорец с настройки, най-важно под "Archive format" да изберете ZIP. Другите неща не е нужно да променяте. @@ -73,7 +73,7 @@ ## MacOS -[$br6] +{br6} .ordered 1. Селектирате файловете които искате да архивирате @@ -87,14 +87,14 @@ .p .font20 -[*Ползваш Linux и се нуждаеш от туториал? Слабо.*] +{i Ползваш Linux и се нуждаеш от туториал? Слабо.} -[$br5] +{br5} ### Чрез командния ред .ordered -1. Инсталираш [`zip`] командата (пакета почти винаги също се казва [`zip`]) +1. Инсталираш {` zip} командата (пакета почти винаги също се казва {` zip}) 2. Извикваш команда във следната форма: ```bash zip archive.zip file1 file2 ... @@ -104,7 +104,7 @@ zip archive.zip file1 file2 ... ### Графично приложение -[$br7] +{br7} .unordered - Отваряш съответния "App Store", търсиш "zip", инсталираш първото и ползваш. @@ -113,4 +113,4 @@ zip archive.zip file1 file2 ... :title_slide35 -.p [url ./index.html Към задачите] +.p {url Към задачите;./index.html} diff --git a/src/teaching/upp-2025/week02/index.du b/src/teaching/upp-2025/week02/index.du index d1be61f..efaf969 100644 --- a/src/teaching/upp-2025/week02/index.du +++ b/src/teaching/upp-2025/week02/index.du @@ -1,85 +1,85 @@ -# Задачи - УПП, Седмица 2, 09.10.2025 +'def title Задачи - УПП, Седмица 2, 09.10.2025 +'def desc Условията на задачите за упражнение. -'define expected-reading 2 min -'define created 05 October 2025 -'define edited 11 October 2025 -[$pagenav] +# {title} + +{pagenav 2 min;05 October 2025;11 October 2025} .warn -Всички задачи от днес са върху [url ./machine.html "машинната таблица"]. +Всички задачи от днес са върху {url "машинната таблица";./machine.html}. GitHub Classroom: [url https://classroom.github.com/a/DRjtkc6f] ## Задача 1 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение01.csv Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение01.csv} Покажете числото 1337 в "popup". ## Задача 2 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение02.csv Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение02.csv} -Покажете сумата на [`INPUT1`] и 8 в "popup". +Покажете сумата на {` INPUT1} и 8 в "popup". ## Задача 3 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение03.csv Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение03.csv} -Покажете числото [`INPUT1`] в "popup", но с обърнат знак. +Покажете числото {` INPUT1} в "popup", но с обърнат знак. ## Задача 4 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение04.csv Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение04.csv} -Покажете [`INPUT1`] умножено по две в "popup". +Покажете {` INPUT1} умножено по две в "popup". ## Задача 5 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение05.csv Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение05.csv} -Ако [`INPUT1`] е равно на 10, покажете в "popup" стойността 1. +Ако {` INPUT1} е равно на 10, покажете в "popup" стойността 1. Иначе, покажете стойността 0. ## Задача 6 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение06.csv Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение06.csv} -Покажете в "popup" числото 1 ако [`INPUT1`] [=или=] [`INPUT2`] е равно на 5. +Покажете в "popup" числото 1 ако {` INPUT1} {b или} {` INPUT2} е равно на 5. Иначе покажете 0. ## Задача 7 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение07.csv Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение07.csv} -Покажете в "popup" числото 1 ако [`INPUT1`] [=и=] [`INPUT2`] са равни на 5. +Покажете в "popup" числото 1 ако {` INPUT1} {b и} {` INPUT2} са равни на 5. Иначе покажете 0. ## Задача 8 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение08.csv Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение08.csv} -Покажете в "popup" умножението на [`INPUT1`] и [`INPUT2`]. -Допускаме, че [`INPUT2`] е неотрицателно цяло число. +Покажете в "popup" умножението на {` INPUT1} и {` INPUT2}. +Допускаме, че {` INPUT2} е неотрицателно цяло число. ## Задача 9 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение09.csv Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение09.csv} -Нека [`INPUT1`] да обозначава разликата на аритметична прогресия (разликата между два съседни елементa) и [`INPUT2`] да обозначава индекса на елемент в тази прогресия. +Нека {` INPUT1} да обозначава разликата на аритметична прогресия (разликата между два съседни елементa) и {` INPUT2} да обозначава индекса на елемент в тази прогресия. -Покажаете в "popup" числото на [`INPUT2`] позиция от аритметичната прогресия. +Покажаете в "popup" числото на {` INPUT2} позиция от аритметичната прогресия. Нека първия елемент винаги е 0 и неговия индекс е 1. -Допускаме, че [`INPUT2`] е неотрицателно цяло число. +Допускаме, че {` INPUT2} е неотрицателно цяло число. ## Задача 10 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение10.csv Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week02/Решение10.csv} .note -[=(11.09.2025)=] Вече в условието и [`INPUT1`] е неотрицателно, иначе решението става твърде голямо. +{b (11.09.2025)} Вече в условието и {` INPUT1} е неотрицателно, иначе решението става твърде голямо. -Покажете в "popup" делението на [`INPUT1`] и [`INPUT2`], закръглено нагоре. -Допускаме, че [`INPUT1`] и [`INPUT2`] са неотрицателни цели числа. +Покажете в "popup" делението на {` INPUT1} и {` INPUT2}, закръглено нагоре. +Допускаме, че {` INPUT1} и {` INPUT2} са неотрицателни цели числа. Може да зачитате, че резултата при деление на 0 е 0. diff --git a/src/teaching/upp-2025/week02/machine.du b/src/teaching/upp-2025/week02/machine.du index 6c63d22..72d89fc 100644 --- a/src/teaching/upp-2025/week02/machine.du +++ b/src/teaching/upp-2025/week02/machine.du @@ -1,17 +1,17 @@ -# Машинна таблица - УПП, Седмица 2, 09.10.2025 +'def title Машинна таблица - УПП, Седмица 2, 09.10.2025 +'def desc Страница където може да работите с машинната таблица -'define expected-reading 2 min -'define created 05 October 2025 -'define edited 11 October 2025 -[$pagenav] +# {title} + +{pagenav 2 min;05 October 2025;11 October 2025} В тази таблица може да редактирате клетките на колона A и тези срещу INPUT1 и INPUT2. При изпълнение, всяка клетка в A се обикаля отгоре-надолу (показано с жълто). -Ако срещне [=команда=] тогава потенциално прочита и долната клетка, и извършва някакво действие. +Ако срещне {b команда} тогава потенциално прочита и долната клетка, и извършва някакво действие. -Повече подробности в [url ./machine_manual.html упътването]. -Списък от налични команди [url #section-1 в дъното на страницата]. +Повече подробности в {url упътването;./machine_manual.html}. +Списък от налични команди {url в дъното на страницата;#section-1}. .text 'snippet 8 $ ./machine_table.html @@ -19,25 +19,25 @@ ## Команди :defs -; [`ASUM`] -: Прави [`A = A + <числото в долната клетка>`] +; {` ASUM} +: Прави {` A = A + <числото в долната клетка>} -; [`ASUBTRACT`] -: Прави [`A = A - <числото в долната клетка>`] +; {` ASUBTRACT} +: Прави {` A = A - <числото в долната клетка>} -; [`ASHOW`] -: Показва стойността на [`A`] като pop-up. +; {` ASHOW} +: Показва стойността на {` A} като pop-up. -; [`BSUM`] -: Прави [`B = B + <числото в долната клетка>`] +; {` BSUM} +: Прави {` B = B + <числото в долната клетка>} -; [`BSUBTRACT`] -: Прави [`B = B - <числото в долната клетка>`] +; {` BSUBTRACT} +: Прави {` B = B - <числото в долната клетка>} -; [`GOTOBZ`] -: Ако [`B`] [=е=] 0, тогава отива на реда, посочен от следващата клетка. +; {` GOTOBZ} +: Ако {` B} {b е} 0, тогава отива на реда, посочен от следващата клетка. Иначе продължава нататък. -; [`GOTOBN`] -: Ако [`B`] [=е по-голямо или равно на=] 0, тогава отива на реда, посочен от следващата клетка. +; {` GOTOBN} +: Ако {` B} {b е по-голямо или равно на} 0, тогава отива на реда, посочен от следващата клетка. Иначе продължава нататък. diff --git a/src/teaching/upp-2025/week02/machine_manual.du b/src/teaching/upp-2025/week02/machine_manual.du index 7090a12..1104907 100644 --- a/src/teaching/upp-2025/week02/machine_manual.du +++ b/src/teaching/upp-2025/week02/machine_manual.du @@ -1,11 +1,11 @@ -# Упътване на машинната таблица - УПП, Седмица 2, 09.10.2025 +'def title Упътване на машинната таблица - УПП, Седмица 2, 09.10.2025 +'def desc Какво е машинната таблица, как работи, какви команди поддържа. -'define expected-reading 3 min -'define created 05 October 2025 -'define edited 05 October 2025 -[$pagenav] +# {title} -[$presentation-controller] +{pagenav 3 min;05 October 2025;05 October 2025} + +{presentation-controller} :title_slide35 @@ -18,8 +18,8 @@ - Целта е да разиграем мисленето за програмиране - Без да пишем истински код - "Машинната таблица" е специална таблица, която създадох за този практикум\n - [*(щеше да е на Excel ама...)*] -- Тя симулира действието на един [=много=] прост компютър + {i (щеше да е на Excel ама...)} +- Тя симулира действието на един {b много} прост компютър :slide35 @@ -27,7 +27,7 @@ ## Принцип на действие .centered -[image ./img/machine_table.png] +{img ./img/machine_table.png} :middle_slide35 @@ -37,55 +37,55 @@ .centered .font18 -[*(По принцип ще спре при първия празен ред)*] +{i (По принцип ще спре при първия празен ред)} .centered .p -[image ./img/table_execution_continuous.gif] +{img ./img/table_execution_continuous.gif} :middle_slide35 .centered .p -Продължава да обикаля клетки, докато не срещне [=празна клетка=] или не свършат всички клетки +Продължава да обикаля клетки, докато не срещне {b празна клетка} или не свършат всички клетки .centered .p -[image ./img/table_execution_empty.gif] +{img ./img/table_execution_empty.gif} :middle_slide35 .unordered -- Във всяка една клетка може да срещне [=команда=] или [=число=] +- Във всяка една клетка може да срещне {b команда} или {b число} - Очаква последователност от команди в колона A -- След [=някои=] команди, може да се срещне и число +- След {b някои} команди, може да се срещне и число - Стойности могат да се въвеждат в колоната A - Клетките "A" и "B" стават 0 при изпълнение -- Всяка команда работи със стойността на клетката "A" [=или=] "B" +- Всяка команда работи със стойността на клетката "A" {b или} "B" :middle_slide35 -## Командата [`ASHOW`] +## Командата {` ASHOW} .p Показва стойността на клетката A като popup .p -[image ./img/table_ashow.gif] +{img ./img/table_ashow.gif} :middle_slide35 -## Командата [`ASUM`] +## Командата {` ASUM} .p Поглежда числото в долната клетка и го сумира към клетката "А". .p -[image ./img/table_asum.gif] +{img ./img/table_asum.gif} :middle_slide35 @@ -96,18 +96,18 @@ Нека да покажем "A", добавим 5 към него и пак го покажем .p -[image ./img/table_ashow_and_asum.gif] +{img ./img/table_ashow_and_asum.gif} :middle_slide35 -## Командата [`ASUBTRACT`] +## Командата {` ASUBTRACT} .p -Като [`ASUM`], но изважда вместо да събере. +Като {` ASUM}, но изважда вместо да събере. .p -[image ./img/table_asubtract.gif] +{img ./img/table_asubtract.gif} :middle_slide35 @@ -127,7 +127,7 @@ Нека да добавим стойността на INPUT1 към "A" .p -[image ./img/table_asum_input1.gif] +{img ./img/table_asum_input1.gif} :middle_slide35 @@ -138,65 +138,65 @@ Нека добавим стойността на INPUT1 и INPUT2 към "А" .p -[image ./img/table_asum_input1_input2.gif] +{img ./img/table_asum_input1_input2.gif} :middle_slide35 -## Командата [`BSUM`] +## Командата {` BSUM} .p -Същото като [`ASUM`], но с клетка "B". +Същото като {` ASUM}, но с клетка "B". -## Командата [`BSUBTRACT`] +## Командата {` BSUBTRACT} .p -Същото като [`ASUBTRACT`], но с клетка "B". +Същото като {` ASUBTRACT}, но с клетка "B". -[$br1] +{br1} .p -[=Нямаме [`BSHOW`]!=] +{b Нямаме {` BSHOW}!} Но имаме други специални команди. :middle_slide35 -## Командата [`GOTOBZ`] +## Командата {` GOTOBZ} .p -[=Ако=] клетка "B" е равна на 0, тогава прочита следващата клетка и отива на посочения ред. +{b Ако} клетка "B" е равна на 0, тогава прочита следващата клетка и отива на посочения ред. .p -[image ./img/table_gotobz.gif] +{img ./img/table_gotobz.gif} :middle_slide .p -[=Иначе=] продължава напред +{b Иначе} продължава напред .p -[image ./img/table_gotobz_false.gif] +{img ./img/table_gotobz_false.gif} :middle_slide35 -## Командата [`GOTOBN`] +## Командата {` GOTOBN} .p -Същата като [`GOTOBZ`], обаче отива на посочения ред когато "B" е [=по-голямо или равно=] на 0 (неотрицателно). +Същата като {` GOTOBZ}, обаче отива на посочения ред когато "B" е {b по-голямо или равно} на 0 (неотрицателно). :middle_slide35 .unordered - Употребата на останалите бутони трябва да е явна. -- "Запази" запазва [=само=] колона A! +- "Запази" запазва {b само} колона A! :middle_slide35 .p .centered -[url ./index.html Към задачите] +{url Към задачите;./index.html} diff --git a/src/teaching/upp-2025/week03/index.du b/src/teaching/upp-2025/week03/index.du index 6eeb8f4..17a8ee7 100644 --- a/src/teaching/upp-2025/week03/index.du +++ b/src/teaching/upp-2025/week03/index.du @@ -1,12 +1,12 @@ -# Задачи - УПП, Седмица 3, 16.10.2025 +'def title Задачи - УПП, Седмица 3, 16.10.2025 +'def desc Условията на задачите за упражнение. -'define expected-reading 9 min -'define created 11 October 2025 -'define edited 18 October 2025 -[$pagenav] +# {title} + +{pagenav 9 min;11 October 2025;18 October 2025} .warn -Не сте учили побитови операции, затова някои задачи са преместени в [url #section-3 За любознателните]. +Не сте учили побитови операции, затова някои задачи са преместени в {url За любознателните;#section-3}. GitHub Classroom: [url https://classroom.github.com/a/UMc2WhVX] @@ -14,12 +14,13 @@ GitHub Classroom: [url https://classroom.github.com/a/UMc2WhVX] ### Задача 1 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise01.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise01.cpp} Получавате цяло число. Трябва да върнете 0 ако е нечетно и 1 ако е четно. -:table_2 +:table +:2 |= Вход |= Изход @@ -30,14 +31,16 @@ GitHub Classroom: [url https://classroom.github.com/a/UMc2WhVX] |: 1 + ### Задача 2 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise02.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise02.cpp} Получавате главна буква. Трябва да върнете съответната малка буква. -:table_2 +:table +:2 |= Вход |= Изход @@ -51,13 +54,15 @@ GitHub Classroom: [url https://classroom.github.com/a/UMc2WhVX] |: u + ### Задача 3 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise03.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise03.cpp} Получавате 3 цели числа, трябва да върнете 1 ако образуват аритметична прогресия и 0 иначе. -:table_2 +:table +:2 |= Вход |= Изход @@ -74,16 +79,18 @@ GitHub Classroom: [url https://classroom.github.com/a/UMc2WhVX] |: 1 + ### Задача 5 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise05.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise05.cpp} -Получавате десетично число: сума в [=левове=]. -Трябва да върнете същата сума в [=евро=], като [`1 € = 1.95583 лв`]. +Получавате десетично число: сума в {b левове}. +Трябва да върнете същата сума в {b евро}, като {` 1 € = 1.95583 лв}. -[*Поради прецизност при такива числа, вашите изходи може с много малко да се различават.*] +{i Поради прецизност при такива числа, вашите изходи може с много малко да се различават.} -:table_2 +:table +:2 |= Вход |= Изход @@ -103,9 +110,10 @@ GitHub Classroom: [url https://classroom.github.com/a/UMc2WhVX] |: 230.081 + ### Задача 6 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise06.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise06.cpp} Получавате две булеви стойности. Трябва да върнете 1 ако свойството "би-импликация" е изпълнено за тях. @@ -113,9 +121,10 @@ GitHub Classroom: [url https://classroom.github.com/a/UMc2WhVX] Припомняме, че би-импликацията и импликацията се дефинират по следния начин: -[image ./img/biimplication.png] +{img ./img/biimplication.png} -:table_2 +:table +:2 |= Вход |= Изход @@ -132,19 +141,21 @@ GitHub Classroom: [url https://classroom.github.com/a/UMc2WhVX] |: 1 + ### Задача 7 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise07.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise07.cpp} Получавате 4 цели числа от входа. За тях трябва да изкарате: .bulleted - средно аритметично, - сума, -- сума от вида [`1/<първо число> + 1/<второ число> + ...`], +- сума от вида {` 1/<първо число> + 1/<второ число> + ...}, - умножение. -:table_2 +:table +:2 |= Вход |= Изход @@ -158,19 +169,21 @@ GitHub Classroom: [url https://classroom.github.com/a/UMc2WhVX] |: -72.0 -288 inf 0 + ### Задача 8 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise08.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise08.cpp} -Получавате 5 реални числа: коефициентите на полином от трета степен [`a`] ([`a`] различно от 0), [`b`], [`c`], [`d`] и потенциален негов корен [`x`]. +Получавате 5 реални числа: коефициентите на полином от трета степен {` a} ({` a} различно от 0), {` b}, {` c}, {` d} и потенциален негов корен {` x}. -Трябва да върнете 1 ако [`x`] е корен на уравнението и 0 ако не е. +Трябва да върнете 1 ако {` x} е корен на уравнението и 0 ако не е. -Припомняме, че [`x`] е корен на кубично уравнение, когато: +Припомняме, че {` x} е корен на кубично уравнение, когато: -[image ./img/cubic.png] +{img ./img/cubic.png} -:table_2 +:table +:2 |= Вход |= Изход @@ -193,18 +206,20 @@ GitHub Classroom: [url https://classroom.github.com/a/UMc2WhVX] |: 1 + ### Задача 10 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise10.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise10.cpp} Получавате 6 реални числа: коефициентите на два (ортонормирани) триизмерни вектора. Върнете тяхното точково умножение. Припомняме, че алгебричата дефиниция на точковото умножение е: -[image ./img/dotproduct.png] +{img ./img/dotproduct.png} -:table_2 +:table +:2 |= Вход |= Изход @@ -221,24 +236,26 @@ GitHub Classroom: [url https://classroom.github.com/a/UMc2WhVX] |: 30 + ## За самоподготовка ### Задача 12 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise12.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise12.cpp} -Първите релефни етикети (които човек може сам да попълни) са въведени през 1958 от [url https://en.wikipedia.org/wiki/Dymo_Corporation#History DYMO]. +Първите релефни етикети (които човек може сам да попълни) са въведени през 1958 от {url DYMO;https://en.wikipedia.org/wiki/Dymo_Corporation#History}. Механични устройства съдържат диск с букви (знаци), който се завърта докато не се избере желаната буква. Чрез стискане на дръжката, малък чук прищипва лентата върху диска (който има релефи на буквите), пластмасовата лента се изкривява и буква се отпечтва (подобно на пишеща машина). -[image ./img/dymo.JPG] +{img ./img/dymo.JPG} Нека нашия диск съдържа само малки букви. Във входа получавате две малки букви: коя буква е избрана в момента и коя буква е желана. Трябва да върнете с колко позиции на ляво (обратно на часовниковата стрелка) трябва да се завърти диска, така че желаната буква да се избере. -:table_2 +:table +:2 |= Вход |= Изход @@ -261,28 +278,30 @@ GitHub Classroom: [url https://classroom.github.com/a/UMc2WhVX] |: 7 + ### Задача 13 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise13.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week03/Exercise13.cpp} -През 629, индийския математик [url https://en.wikipedia.org/wiki/Bh%C4%81skara_I Бхаскара 1ви] представя една забележителна апроксимация на синус функцията (в радиани): +През 629, индийския математик {url Бхаскара 1ви;https://en.wikipedia.org/wiki/Bh%C4%81skara_I} представя една забележителна апроксимация на синус функцията (в радиани): -[image ./img/sineapprox.png] +{img ./img/sineapprox.png} От входа ще получите два ъгъла в радиани, α и β, чиято сума е между 0 и π/2 (включително). -Използвайки [=единствено=] апроксимацията на Бхаскара 1ви, пресметнете [`tg(α + β)`].\n -[=Не може да използвате коренуване!=] +Използвайки {b единствено} апроксимацията на Бхаскара 1ви, пресметнете {` tg(α + β)}.\n +{b Не може да използвате коренуване!} За константата π, използвайте поне 5 цифри след десетичната запетая. .text <details> -<summary>[*Подсказка*]</summary> -Използвайте факта, че [url https://en.wikipedia.org/wiki/List_of_trigonometric_identities#Shifts_and_periodicity може да представите косинус чрез отместване на синус]. +<summary>{i Подсказка}</summary> +Използвайте факта, че {url може да представите косинус чрез отместване на синус;https://en.wikipedia.org/wiki/List_of_trigonometric_identities#Shifts_and_periodicity}. </details> -:table_2 +:table +:2 |= Вход |= Изход @@ -305,6 +324,7 @@ GitHub Classroom: [url https://classroom.github.com/a/UMc2WhVX] |: 1.30265 + .comment pi / 2 = 1.570795 pi / 3 = 1.047196 @@ -320,7 +340,8 @@ pi / 8 = 0.392698 Трябва да върнете 1 ако правоъгълниците се пресичат и 0 иначе. -:table_2 +:table +:2 |= Вход |= Изход @@ -340,6 +361,7 @@ pi / 8 = 0.392698 |: 1 + ## За любознателните .note @@ -351,7 +373,8 @@ pi / 8 = 0.392698 Трябва да върнете бит-а на съответната позиция в числото, като индекс 0 е най-десния бит (младши), докато 31 е най-левия бит (старши). -:table_2 +:table +:2 |= Вход |= Изход @@ -371,12 +394,14 @@ pi / 8 = 0.392698 |: 1 + ### Задача 9 Получавате цяло неотрицателно 8-битово число. Трябва да върнете 1 ако броя единици в числото е нечетно и 0 иначе. -:table_2 +:table +:2 |= Вход |= Изход @@ -396,6 +421,7 @@ pi / 8 = 0.392698 |: 1 + ### Задача 11 Нека да разделим едно цяло неотрицателно 32-битово число на 4 части, всяка по 8 бита. @@ -404,9 +430,10 @@ pi / 8 = 0.392698 Примерно, числото 2148271109 в двоичната бройна система е 10000000000011000000010000000101, което се разделя на подчислата 10000000, 00001100, 00000100 и 00000101 (128, 12, 4 и 5). Получавате две 32-битови цели неотрицателни числа. -Сумирайте [=съответните=] подчисла в двете числа и изкарайте резултаното "надчисло". +Сумирайте {b съответните} подчисла в двете числа и изкарайте резултаното "надчисло". -:table_2 +:table +:2 |= Вход |= Изход @@ -429,6 +456,7 @@ pi / 8 = 0.392698 |: 10291711 + .comment 0.0.0.3 + 0.0.0.4 = 7 0.0.0.255 + 0.0.0.1 = 0 @@ -449,7 +477,8 @@ pi / 8 = 0.392698 То представлява UNIX време. Трябва да изкарате UTC часа и датата, в "човешки" формат ("час:минути:секунди ден месец година"). -:table_2 +:table +:2 |= Вход |= Изход @@ -472,9 +501,10 @@ pi / 8 = 0.392698 |: 7:6:14 12 10 2025 + ### Задача 15 -В модерния интернет, всяко устройство се обозначава с [*уникален*] адрес. +В модерния интернет, всяко устройство се обозначава с {i уникален} адрес. Това е 32-битово цяло неотрицателно число. За човешко удобоство, това число се представя чрез "dot-decimal notation": всеки 8 бита се представят като десетично число и тези 4 числа се слепват с точки между тях. @@ -485,7 +515,8 @@ pi / 8 = 0.392698 От входа получавате цяло неотрицателно 32-битово число. Трябва да изкарате стойността му в "dot-decimal notation". -:table_2 +:table +:2 |= Вход |= Изход @@ -508,14 +539,15 @@ pi / 8 = 0.392698 |: 216.24.57.7 + ### Задача 17 -В автомобилите, за комуникация между всички електронни компоненти се използва [url https://en.wikipedia.org/wiki/CAN_bus Controller Area Network bus]. +В автомобилите, за комуникация между всички електронни компоненти се използва {url Controller Area Network bus;https://en.wikipedia.org/wiki/CAN_bus}. Различни устройства се свързват в една мрежа и си комуникират помежду си. Единичен трансфер на данни се нарича "frame". Всеки "frame" следва стандартен формат, описващ какви данни се пренасят, колко и т.н. -Как изглежда този формат може да намерите на: [url https://en.wikipedia.org/wiki/ISO_15765-2] +Как изглежда този формат може да намерите на: {url https://en.wikipedia.org/wiki/ISO_15765-2} От входа получавате осем 8-битови числа. Те представляват един CAN frame. diff --git a/src/teaching/upp-2025/week04/index.du b/src/teaching/upp-2025/week04/index.du index 8b138fa..89cd0db 100644 --- a/src/teaching/upp-2025/week04/index.du +++ b/src/teaching/upp-2025/week04/index.du @@ -1,17 +1,17 @@ -# Задачи - УПП, Седмица 4, 23.10.2025 +'def title Задачи - УПП, Седмица 4, 23.10.2025 +'def desc Условията на задачите за упражнение. -'define expected-reading 9 min -'define created 18 October 2025 -'define edited 25 October 2025 -[$pagenav] +# {title} -GitHub Classroom: [url https://classroom.github.com/a/rOzekyCs] +{pagenav 9 min;18 October 2025;25 October 2025} + +GitHub Classroom: {url https://classroom.github.com/a/rOzekyCs} :important .p -При [`if`]-ове [=ще=] вземаме точки за изрази от типа: +При {` if}-ове {b ще} вземаме точки за изрази от типа: -```c++ +```cpp if (condition) std::cout << 1; else @@ -20,7 +20,7 @@ else .p или -```c++ +```cpp if (condition) std::cout << false; else @@ -29,7 +29,7 @@ else .p или -```c++ +```cpp if (condition) std::cout << '0'; else @@ -43,12 +43,13 @@ else ### Задача 1 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise01.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise01.cpp} От входа получавате две реални числа. Трябва да ги върнете в нарастващ ред. -:table_2 +:table +:2 |= Вход |= Изход @@ -62,9 +63,10 @@ else |: -11.1 -2.5 + ### Задача 2 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise02.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise02.cpp} От входа получавате буква. Трябва да изкрате: @@ -74,7 +76,8 @@ else - "Digit" ако е цифра и - "Other" в останалите случаи. -:table_2 +:table +:2 |= Вход |= Изход @@ -91,14 +94,16 @@ else |: Other + ### Задача 3 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise03.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise03.cpp} От входа получавате ден в месеца (допускаме 30-дневен месец, където първи ден е Понеделник; като месец Септември от тази година). Трябва да върнете името на деня от седмицата. -:table_2 +:table +:2 |= Вход |= Изход @@ -118,18 +123,20 @@ else |: Tuesday + ### Задача 4 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise04.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise04.cpp} -От входа получавате реални коефициенти на квадратно уравнение: [`a`], [`b`] и [`c`]. +От входа получавате реални коефициенти на квадратно уравнение: {` a}, {` b} и {` c}. Трябва да изкарате корените на уравнението, като: .bulleted - ако има два корена, изкарвате и двата, -- ако има един корен, изкарвате [=само=] него, +- ако има един корен, изкарвате {b само} него, - ако няма реални корени, изкарвате "No real roots". -:table_2 +:table +:2 |= Вход |= Изход @@ -143,21 +150,23 @@ else |: 1.5 + ### Задача 5 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise05.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise05.cpp} От входа получавате буква, съответстваща на операция върху числа: .bulleted -- [`_`] за закръгляне надолу на число -- [`+`] за събиране на две числа -- [`*`] за умножение на две числа -- [`x`] за умножение на три числа -- [`.`] за умножение на четири числа +- {` _} за закръгляне надолу на число +- {` +} за събиране на две числа +- {` *} за умножение на две числа +- {` x} за умножение на три числа +- {` .} за умножение на четири числа След тази буква ще получите съответния брой реални числа и трябва да изкарате резултата от операцията. -:table_2 +:table +:2 |= Вход |= Изход @@ -177,16 +186,17 @@ else |: -8 + ### Задача 6 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise06.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise06.cpp} От входа получавате число, което определя фигура. Това число може да бъде: .bulleted -- [`1`] за окръжност, -- [`2`] за правоъгълник и -- [`3`] за триъгълник. +- {` 1} за окръжност, +- {` 2} за правоъгълник и +- {` 3} за триъгълник. Спрямо типа фигура, ще приемете различен брой реални числа: .bulleted @@ -197,7 +207,8 @@ else Използвайки тези числа, трябва да изкарате периметър (дължина) на фигурата. За константата π използвайте поне 5 цифри след запетаята. -:table_2 +:table +:2 |= Вход |= Изход @@ -211,16 +222,18 @@ else |: 1849.63 + ### Задача 7 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise07.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise07.cpp} От входа получавате цяло число. Изкарайте за него таблицата на умножение от 1 до 10 включително. -[=Използвайте цикъл!=] +{b Използвайте цикъл!} -:table_2 +:table +:2 |= Вход |= Изход @@ -253,14 +266,16 @@ else 10 -80 + ### Задача 8 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise08.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise08.cpp} -От входа получавате две цели положителни числа, [`a`] и [`x`]. -Пресметнете [`a`] на степен [`x`]. +От входа получавате две цели положителни числа, {` a} и {` x}. +Пресметнете {` a} на степен {` x}. -:table_2 +:table +:2 |= Вход |= Изход @@ -277,15 +292,17 @@ else |: 844596301 + ### Задача 9 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise09.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise09.cpp} От входа получавате цяло положително число. -Трябва [=поотделно=] да сумирате всички четни и нечетни числа от 1 до подаденото число, включително. +Трябва {b поотделно} да сумирате всички четни и нечетни числа от 1 до подаденото число, включително. Накрая изкарайте двете суми. -:table_2 +:table +:2 |= Вход |= Изход @@ -299,14 +316,16 @@ else |: 1056 1024 + ### Задача 10 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise10.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise10.cpp} От входа получавате цяло положително число. Изкарайте за него "Prime" ако е просто и "Not prime" ако не е, последвано от най-малкия делител (различен от 1 и самото число). -:table_2 +:table +:2 |= Вход |= Изход @@ -323,14 +342,16 @@ else |: Not prime 1187 + ### Задача 11 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise11.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise11.cpp} От входа получавате цели числа докато не срещнете числото 0. Трябва да върнете умножението на всички тези числа (без нулата). -:table_2 +:table +:2 |= Вход |= Изход @@ -344,20 +365,22 @@ else |: -1479870000 + ### Задача 12 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise12.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise12.cpp} От входа получавате знак. -Ако този знак е аритметична операция ([`+`], [`-`], [`*`], [`/`]), тогава ще получите две цели числа. +Ако този знак е аритметична операция ({` +}, {` -}, {` *}, {` /}), тогава ще получите две цели числа. Трябва да пресметнете резултата на операцията върху тези числа, да го изкарате и пак да очаквате знак. Ако този знак е точка, тогава спирате програмата. -[*При вас вход и изход ще са смесени.*] +{i При вас вход и изход ще са смесени.} -:table_2 +:table +:2 |= Вход |= Изход @@ -371,16 +394,18 @@ else |: 8192 5 49 100 + ### Задача 13 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise13.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise13.cpp} -[url https://en.wikipedia.org/wiki/Fibonacci_sequence Редицата на Фибоначи] е последователност от числа, където всяко следващо е равно на сумата на предходните две. +{url Редицата на Фибоначи;https://en.wikipedia.org/wiki/Fibonacci_sequence} е последователност от числа, където всяко следващо е равно на сумата на предходните две. По-точно, първото число (на индекс 0) е 0, второто число (на индекс 1) е 1 и всяко следващо се определя от предходните две. От входа получавате неотрицателен индекс и трябва да изкарате съответното число на фибоначи. -:table_2 +:table +:2 |= Вход |= Изход @@ -406,14 +431,16 @@ else |: 3524578 + ### Задача 14 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise14.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise14.cpp} От входа получавате цяло неотрицателно число. Трябва да обърнете реда на цифрите в числото и да изкарате резултата. -:table_2 +:table +:2 |= Вход |= Изход @@ -430,11 +457,12 @@ else |: 73444672 + ## За самоподготовка ### Задача 15 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise15.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise15.cpp} Получавате реално число: оценка по шестобалната система. Трябва да върнете "наименованието" на оценката спрямо стойността: @@ -446,7 +474,8 @@ else - "Weak" (оценки от 2.99 до 2.0) и - "Bad" (по-малко от двойка) -:table_2 +:table +:2 |= Вход |= Изход @@ -469,9 +498,10 @@ else |: Bad + ### Задача 16 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise16.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise16.cpp} Получавате три реални числа: ъгли в градуси. Трябва да върнете дали триъгълник с тези ъгли може да съществува, и ако да, дали е: @@ -482,7 +512,8 @@ else - тъп ("Obtuse") или - правоъгълен ("Right"). -:table_2 +:table +:2 |= Вход |= Изход @@ -502,16 +533,18 @@ else |: Obtuse triangle + ### Задача 17 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise17.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise17.cpp} -[url https://en.wikipedia.org/wiki/Factorial Факториел] е функция върху число, която представлява умножението на всички цели числа от 1 до самото число включително. +{url Факториел;https://en.wikipedia.org/wiki/Factorial} е функция върху число, която представлява умножението на всички цели числа от 1 до самото число включително. От входа получавате цяло положително число. Трябва да изкарате неговия факториел. -:table_2 +:table +:2 |= Вход |= Изход @@ -531,9 +564,10 @@ else |: 6 + ### Задача 18 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise18.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise18.cpp} Във вашата програма запазете цяла неотрицателна константа. От входа получавате цели неотрицателни числа: опити да се познае. @@ -542,9 +576,10 @@ else Ако е по-голямо, трябва да върнете "Lower". Ако бъде познато, трябва да върнете "You guessed it!" и да спрете програмата. -[*В следните примери числото е 1337. Вашия вход и изход ще бъдат смесени.*] +{i В следните примери числото е 1337. Вашия вход и изход ще бъдат смесени.} -:table_2 +:table +:2 |= Вход |= Изход @@ -578,15 +613,16 @@ You guessed it! ### Задача 19 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise19.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise19.cpp} -[url https://en.wikipedia.org/wiki/Harmonic_series_(mathematics) Хармоничния ред] е редица числа, където n-тото число се определя по формулата: +{url Хармоничния ред;https://en.wikipedia.org/wiki/Harmonic_series_(mathematics)} е редица числа, където n-тото число се определя по формулата: -[image ./img/harmonic_element.png] +{img ./img/harmonic_element.png} От входа ще получите положително цяло число n, трябва да върнете n-тото число в хармоничния ред. -:table_2 +:table +:2 |= Вход |= Изход @@ -606,21 +642,23 @@ You guessed it! |: 3.59774 + ### Задача 20 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise20.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise20.cpp} От входа получавате реално ненулево "целево" число и реално "обсег" число (в проценти). След това получавате редица реални ненулеви числа. -Продължавате да приемате реални числа, докато сумата на всички числа в редицата не е поне с "обсег" процента [*близкост*] до целевото число. +Продължавате да приемате реални числа, докато сумата на всички числа в редицата не е поне с "обсег" процента {i близкост} до целевото число. Накрая на програмата изкарайте тази сума. Формулата за процентова разлика между числа а и b е: -[image ./img/percent_diff.png] +{img ./img/percent_diff.png} -:table_2 +:table +:2 |= Вход |= Изход @@ -637,20 +675,21 @@ You guessed it! |: 20 + ## За любознателните ### Задача 21 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise21.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week04/Exercise21.cpp} В година 60та, преди близко до 2000 години, гръцкия математик Херон описва алгоритъм за пресмятане на корен квадратен на подадено число S. -Описва се редица от числа x, където всяко следващо е равно на предходното, следвайки [url https://en.wikipedia.org/wiki/Square_root_algorithms#Heron's_method просто линейно взаимоотношение]. +Описва се редица от числа x, където всяко следващо е равно на предходното, следвайки {url просто линейно взаимоотношение;https://en.wikipedia.org/wiki/Square_root_algorithms#Heron's_method}. Всеки следващ член на редицата става все по-близък до истинската стойност на корена. Първия член е произволно първоначално приближение. Разбира се, колко е по-близко приближението до истинската стойност, толкова по-бързо се приближаваме. -Нека за нашите цели да използваме [url https://en.wikipedia.org/wiki/Square_root_algorithms#Hyperbolic_estimates хиперболичното приближение]. +Нека за нашите цели да използваме {url хиперболичното приближение;https://en.wikipedia.org/wiki/Square_root_algorithms#Hyperbolic_estimates}. Получавате цяло число S и индекс на член в редицата n. Трябва да върнете корена на числото по метода на Херон. diff --git a/src/teaching/upp-2025/week05/index.du b/src/teaching/upp-2025/week05/index.du index f19ff04..6e545e7 100644 --- a/src/teaching/upp-2025/week05/index.du +++ b/src/teaching/upp-2025/week05/index.du @@ -1,9 +1,9 @@ -# Задачи - УПП, Седмица 5, 30.10.2025 +'def title Задачи - УПП, Седмица 5, 30.10.2025 +'def desc Условията на задачите за упражнение. -'define expected-reading 14 min -'define created 26 October 2025 -'define edited 01 November 2025 -[$pagenav] +# {title} + +{pagenav 14 min;26 October 2025;01 November 2025} GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] @@ -14,12 +14,13 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] ### Задача 1 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise01.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise01.cpp} От входа получавате 10 реални числа. Трябва да ги върнете в обратен ред. -:table_2 +:table +:2 |= Вход |= Изход @@ -30,14 +31,16 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: 39.8 6 69.21 84.55 100.001 18.62 34.799 65 89.95 41.4 + ### Задача 2 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise02.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise02.cpp} От входа получавате 7 букви. Трябва да изкарате буквите в същата последователност, обаче завъртяни надясно с 3 позиции. -:table_2 +:table +:2 |= Вход |= Изход @@ -48,15 +51,17 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: j l b k l m l + ### Задача 3 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise03.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise03.cpp} От входа получавате 14 цели неотрицателни числа. Трябва да изкарате второто най-голямо число. Ако няма такова, просто изкарайте най-голямото. -:table_2 +:table +:2 |= Вход |= Изход @@ -70,17 +75,19 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: 9 + ### Задача 4 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise04.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise04.cpp} От входа получавате две цели положителни числа. -Трябва да върнете [url https://en.wikipedia.org/wiki/Factorial#Definition факториел] от първото число, който факториел е повдигнат на степен второто число. +Трябва да върнете {url факториел;https://en.wikipedia.org/wiki/Factorial#Definition} от първото число, който факториел е повдигнат на степен второто число. Факториел на едно (неотрицателно цяло) число е умножението на всички цели числа от 1 до самото число включително. -Примерно, факториел от 5 е [`1 * 2 * 3 * 4 * 5 = 120`]. +Примерно, факториел от 5 е {` 1 * 2 * 3 * 4 * 5 = 120}. -:table_2 +:table +:2 |= Вход |= Изход @@ -103,14 +110,16 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: 256 + ### Задача 5 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise05.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise05.cpp} От входа получавате 18 цели числа. Трябва да изкарате същата поредица числа, обаче всички нули са в началото на редицата. -:table_2 +:table +:2 |= Вход |= Изход @@ -121,12 +130,13 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: 0 0 0 0 839 643 42 -694 57 650 729 -434 35 155 176 873 40 658 + .question Нужни ли са масиви, ако в условието трябваше да изкарвате нулите в края на поредицата? ### Задача 6 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise06.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise06.cpp} От входа получавате 15 цели числа. Трябва да изкарате дължината на най-дългата последователност от числа, която е подредена в нарастващ ред. @@ -134,9 +144,10 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] Последователност от числа, която съдържа еднакви числа, също се зачита за сортирана в нарастващ ред. .note -[=(01.11.2025)=] Поправен е изхода в първия пример, от 6 на 8. +{b (01.11.2025)} Поправен е изхода в първия пример, от 6 на 8. -:table_2 +:table +:2 |= Вход |= Изход @@ -159,14 +170,16 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: 5 + ### Задача 7 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise07.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise07.cpp} От входата получавате цяло неотрицателно число. Върнете дали то е перфектно: дали е равно на сумата на всички свои делители, освен себе си. -:table_2 +:table +:2 |= Вход |= Изход @@ -201,16 +214,18 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: Perfect + ### Задача 8 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise08.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise08.cpp} От входа получавате две редици от по 10 реални числа (т.е. първите 10 числа са от първата редица, и вторите 10 числа образуват втората редица). -След това получавате знак - аритметича операция ([`+`], [`-`], [`*`], [`/`]). +След това получавате знак - аритметича операция ({` +}, {` -}, {` *}, {` /}). Трябва да изпълните операцията върху всяка съответна двойка числа от двете редици и да върнете резултатите. -:table_2 +:table +:2 |= Вход |= Изход @@ -231,19 +246,21 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: inf -2 16.175 16.41 100.011 -inf 4 31.714 71 -nan + ### Задача 9 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise09.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise09.cpp} От входа получавате реално число z между 0 (изключително) и 2 (включително), заедно с дължина n. -Трябва да намерите стойността на логаритъм с основа ℯ ([url https://en.wikipedia.org/wiki/E_(mathematical_constant) Неперово число]) от това число, използвайки развитието по ред на Тейлър: +Трябва да намерите стойността на логаритъм с основа ℯ ({url Неперово число;https://en.wikipedia.org/wiki/E_(mathematical_constant)}) от това число, използвайки развитието по ред на Тейлър: -[image ./img/ln_taylor_series.png] +{img ./img/ln_taylor_series.png} като n определя колко елемента от реда да използвате. -:table_2 +:table +:2 |= Вход |= Изход @@ -281,22 +298,24 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: -4.60517 + ### Задача 10 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise10.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise10.cpp} От входа получавате цяло неотрицатено число с максимум 8 цифри. -Това число представлява сериен номер под [url https://en.wikipedia.org/wiki/S10_(UPU_standard) S10 стандарта за идентификационни номера на пратки]. +Това число представлява сериен номер под {url S10 стандарта за идентификационни номера на пратки;https://en.wikipedia.org/wiki/S10_(UPU_standard)}. Трябва да пресметнете "контролната цифра" (check digit) на серийния номер. Това става по следния начин: .numbered 1. От ляво на дясно, трябва да умножите всяка цифра със съответната си "тежест": 8, 6, 4, 2, 3, 5, 9, 7 2. Сумирате умножените цифри -3. Пресмятате контролната цифра по формулата: [`11 - <сума> mod 11`], където +3. Пресмятате контролната цифра по формулата: {` 11 - <сума> mod 11}, където ако резултата е 10, цифрата е 0 и ако резултата е 11, цифрата е 5. -:table_2 +:table +:2 |= Вход |= Изход @@ -325,28 +344,30 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: 5 + ### Задача 11 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise11.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise11.cpp} От входа получавате цяло неотрицателно число. -Изкарвате [url https://en.wikipedia.org/wiki/Lucas_number числото на Лукас] след толкова на брой позиции и ако числото [=не=] е било 0, приемаме ново число и повтаряте логиката. +Изкарвате {url числото на Лукас;https://en.wikipedia.org/wiki/Lucas_number} след толкова на брой позиции и ако числото {b не} е било 0, приемаме ново число и повтаряте логиката. -Тоест, ако първото число е n, тогава връщате [`n`]-тото число на Лукас.\n -Ако второто число е m, тогава връщате [`n + m`]-тото число на Лукас. +Тоест, ако първото число е n, тогава връщате {` n}-тото число на Лукас.\n +Ако второто число е m, тогава връщате {` n + m}-тото число на Лукас. И така нататък. Числата на Лукас се определят по следния начин: -[image ./img/lucas_def.png] +{img ./img/lucas_def.png} .note -[=(01.11.2025)=] Входа на последния пример е поправен. +{b (01.11.2025)} Входа на последния пример е поправен. -[*Вашия вход и изход може да са смесени!*] +{i Вашия вход и изход може да са смесени!} -:table_2 +:table +:2 |= Вход |= Изход @@ -369,9 +390,10 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: 47 2207 3571 3571 + ### Задача 12 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise12.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise12.cpp} От входа получавате 20 цели числа, всяко от които е индекс на елемент в масива (т.е. всяко е между 0 и 19 включително). @@ -384,9 +406,10 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] Ако се поражда цикъл (посетим някое число повече от един път), тогава трябва да изкарате "Infinity". .note -[=(01.11.2025)=] Входа на първия пример е поправен. +{b (01.11.2025)} Входа на първия пример е поправен. -:table_2 +:table +:2 |= Вход |= Изход @@ -406,18 +429,20 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: Infinity + ## За самоподготовка ### Задача 13 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise13.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise13.cpp} От входа получавате 8 цели числа. След това получавате 9то цяло число. Трябва да върнете, сред 8те цели числа, колко често се среща 9тото. -:table_2 +:table +:2 |= Вход |= Изход @@ -434,14 +459,16 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: 8 + ### Задача 14 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise14.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise14.cpp} От входа получавате 16 цели числа. Трябва да изкарате, на два реда, първо всички четни числа и после всички нечетни. -:table_2 +:table +:2 |= Вход |= Изход @@ -458,9 +485,10 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] -961 871 657 -297 -5 -9 255 + ### Задача 15 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise15.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise15.cpp} От входа получавате 12 реални числа. Трябва да върнете, на отделни редове, двойки числа от тази поредица: @@ -469,7 +497,8 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] - Втората двойка има второто и пред-посленото число. - И така нататък. -:table_2 +:table +:2 |= Вход |= Изход @@ -494,15 +523,17 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] 769.89 505 + ### Задача 16 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise16.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise16.cpp} От входа получавате две редици от по 5 цели числа (т.е. първите 5 числа са част от първата редица и вторите 5 числа са част от втората). Трябва да изкарате една редица от числа, където двете редици са преплетени: първо имаме първото число от първата редица, след това първото число от втората редица, след това второто число от първата редица и така нататък. -:table_2 +:table +:2 |= Вход |= Изход @@ -513,15 +544,17 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: 0 1 1 0 0 1 1 0 0 1 + ### Задача 17 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise17.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise17.cpp} От входа получавате цяло число в десетична бройна система. -Трябва да изкарате дали то е [url https://en.wikipedia.org/wiki/Narcissistic_number число на Армстронг]: число, което е равно на сумата на цифрите си, където всяка цифра е повдигната на степен, дължината на числото. +Трябва да изкарате дали то е {url число на Армстронг;https://en.wikipedia.org/wiki/Narcissistic_number}: число, което е равно на сумата на цифрите си, където всяка цифра е повдигната на степен, дължината на числото. -:table_2 +:table +:2 |= Вход |= Изход @@ -544,12 +577,13 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: Narcissistic + ### Задача 18 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise18.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise18.cpp} .note -[=(01.11.2025)=] Поправени бройката на входните цели числа и втория пример. +{b (01.11.2025)} Поправени бройката на входните цели числа и втория пример. От входа получавате 7 цели числа. @@ -557,7 +591,8 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] Ако такаъв индекс не съществува, изкарате "No such index". -:table_2 +:table +:2 |= Вход |= Изход @@ -568,19 +603,21 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: No such index + ### Задача 19 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise19.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise19.cpp} От входа получавате две числа: реален ъгъл в радиани x и положителен максимален индекс n. Трябва да върнете стойността на синус от този ъгъл, използвайки реда на Тейлър: -[image ./img/sinx_taylor_series.png] +{img ./img/sinx_taylor_series.png} където n определя с колко елемента от реда да смятаме. -:table_2 +:table +:2 |= Вход |= Изход @@ -597,27 +634,29 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: -1.08189 + ### Задача 20 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise20.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise20.cpp} От входа получавате цяло положително число. -Трябва да валидирате това число използвайки [url https://en.wikipedia.org/wiki/Luhn_algorithm алгоритъма на Luhn]: +Трябва да валидирате това число използвайки {url алгоритъма на Luhn;https://en.wikipedia.org/wiki/Luhn_algorithm}: .numbered 1. Най-дясната цифра е "цифра за проверка", тя трябва да бъде изкарана за после. 2. Започвайки от най-дясната цифра (от останалите цифри, т.е. втората най-дясна в числото), трябва да умножите всяка втора цифра по две. - Ако цифрата стане по-голяма от 9, трябва да [*извадите*] 9. + Ако цифрата стане по-голяма от 9, трябва да {i извадите} 9. 3. Сумирате всички цифри (всички умножени и неумножени). -4. Проверявате дали цифрата за проверка е равна на [`(10 - (сумa mod 10)) mod 10`] +4. Проверявате дали цифрата за проверка е равна на {` (10 - (сумa mod 10)) mod 10} Този алгоритъм се използва главно в проверката на номера на дебитни/кредитни карти. Главната цел е да се засекат някои механични грешки при въвеждане на номера. .note -[=(01.11.2025)=] Поправен е входа на третия пример. +{b (01.11.2025)} Поправен е входа на третия пример. -:table_2 +:table +:2 |= Вход |= Изход @@ -640,21 +679,23 @@ GitHub Classroom: [url https://classroom.github.com/a/6oPRMxJx] |: Invalid + ### Задача 21 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise21.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week05/Exercise21.cpp} От входа получавате цяло неотрицателно число. -Трябва да върнете съответното по индекс [url https://en.wikipedia.org/wiki/Catalan_number число на Каталан]. +Трябва да върнете съответното по индекс {url число на Каталан;https://en.wikipedia.org/wiki/Catalan_number}. n-тото число на Каталан се дефинира по следния начин: -[image ./img/catalan_def.png] +{img ./img/catalan_def.png} -Където [`x!`] е [url https://en.wikipedia.org/wiki/Factorial#Definition факториел] от x. +Където {` x!} е {url факториел;https://en.wikipedia.org/wiki/Factorial#Definition} от x. Припомняме, че факториел на едно число е умножението на всички цели числа от 1 до самото число включително. -:table_2 +:table +:2 |= Вход |= Изход diff --git a/src/teaching/upp-2025/week06/index.du b/src/teaching/upp-2025/week06/index.du index a1660f8..dcdd607 100644 --- a/src/teaching/upp-2025/week06/index.du +++ b/src/teaching/upp-2025/week06/index.du @@ -1,27 +1,28 @@ -# Задачи - УПП, Седмица 6, 06.11.2025 +'def title Задачи - УПП, Седмица 6, 06.11.2025 +'def desc Условията на задачите за упражнение. -'define expected-reading 10 min -'define created 01 November 2025 -'define edited 06 November 2025 -[$pagenav] +# {title} -GitHub Classroom: [url https://classroom.github.com/a/JSB1UK_f] +{pagenav 10 min;01 November 2025;06 November 2025} + +GitHub Classroom: {url https://classroom.github.com/a/JSB1UK_f} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise01.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise01.cpp} -През 1837 година, [url https://en.wikipedia.org/wiki/Charles_Babbage Чарлз Бабидж] пита въпроса: +През 1837 година, {url Чарлз Бабидж;https://en.wikipedia.org/wiki/Charles_Babbage} пита въпроса: .quote What is the smallest positive integer whose square ends in the digits 269,696? Според него това число е 99736 (чиито квадрат е 9947269696). -Напишете програма, която [=намира=] най-малкото число, отговарящо на въпроса. +Напишете програма, която {b намира} най-малкото число, отговарящо на въпроса. -:table_2 +:table +:2 |= Вход |= Изход @@ -29,14 +30,16 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: 25264 + ### Задача 2 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise02.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise02.cpp} От входа получавате 8 цели положителни числа. Трябва да изкарате най-голямото общо делимо между всички тези числа. -:table_2 +:table +:2 |= Вход |= Изход @@ -50,16 +53,18 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: 1 + ### Задача 3 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise03.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise03.cpp} Получавате цяло положително число. В него трябва да замените всички срещания на най-срещаната цифра с 0. Ако има няколко такива цифри, трябва да замените само най голямата от тях. -:table_2 +:table +:2 |= Вход |= Изход @@ -88,14 +93,16 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: 535035030 + ### Задача 4 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise04.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise04.cpp} Получавате една редица от 15 цели числа и след това втора редица с 5 цели уникални числа. Трябва да върнете броя срещания в първата редица на всяко от числата във втората редица. -:table_2 +:table +:2 |= Вход |= Изход @@ -106,21 +113,23 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: 0 2 7 6 0 + ### Задача 5 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise05.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise05.cpp} От входа получавате две реални числа: координати на точка в равнината. Спрямо следното изображение: -[image ./img/rectangle_and_line.png] +{img ./img/rectangle_and_line.png} изкарайте дали точката е в защрихованата област или не. -Областта [=не=] включва правата и правоъгълника! +Областта {b не} включва правата и правоъгълника! Зачитайте, че черните прави отбелязват главните оси, а разстоянията между съседни сиви оси е единица. -:table_2 +:table +:2 |= Вход |= Изход @@ -164,12 +173,13 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: Inside + ### Задача 6 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise06.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise06.cpp} От входа получавате цяло положително число. -Трябва да върнете дали то е [url https://en.wikipedia.org/wiki/Happy_number щастливо]. +Трябва да върнете дали то е {url щастливо;https://en.wikipedia.org/wiki/Happy_number}. Нека да вземем нашето число и да го заменим със сумата на всички свои цифри, повдигнати на квадрат. Оригиналното число е щастливо, ако след краен брой прилагания на тази операция, получим числото 1. @@ -177,7 +187,8 @@ What is the smallest positive integer whose square ends in the digits 269,696? Когато число не е щастливо, влизаме в безкрайния цикъл 4, 16, 37, 58, 89, 145, 42, 20, 4, 16, ... Това е единствения възможен цикъл в който нещастно число може да попадне. -:table_2 +:table +:2 |= Вход |= Изход @@ -206,18 +217,20 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: Happy + ### Задача 7 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise07.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise07.cpp} От входа получавате 6 реални числа. -Пресметнете съответните 6 [url https://en.wikipedia.org/wiki/Prefix_sum префиксни суми] и ги изкарайте. +Пресметнете съответните 6 {url префиксни суми;https://en.wikipedia.org/wiki/Prefix_sum} и ги изкарайте. Това са сумите на всички числа до сега. Тоест, префиксната сума на второто число е сумата на първото и второто число. Префиксата сума на третото число е сумата на първото, второто и третото число. -:table_2 +:table +:2 |= Вход |= Изход @@ -228,21 +241,23 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: 30.86 998.074 1083.07 1598.34 1145.34 1107.55 + ### Задача 8 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise08.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise08.cpp} От входа получавате две реални числа: координати на точка в равнината. Спрямо следното изображение: -[image ./img/two_circles.png] +{img ./img/two_circles.png} изкарайте дали точката е в защрихованата област или не. -Областта [=не=] включва самите окръжности! +Областта {b не} включва самите окръжности! Зачитайте, че черните прави отбелязват главните оси, а разстоянията между съседни сиви оси е единица. -:table_2 +:table +:2 |= Вход |= Изход @@ -289,14 +304,16 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: Outside + ### Задача 9 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise09.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise09.cpp} От входа получавате 10 цели числа. Трябва да върнете дали сред тях същестуват три числа (на различни позиции), чиято сума е равна на 0. -:table_2 +:table +:2 |= Вход |= Изход @@ -310,16 +327,18 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: Doesn't exist + ### Задача 10 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise10.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise10.cpp} От входа получавате четири трицифрени цели неотрицателн числа. Трябва да върнете най-голямото възможно цяло число, което се получава след "слепване" на тези числа. -[*Не е нужно да използвате сортиращ алгоритъм!*] +{i Не е нужно да използвате сортиращ алгоритъм!} -:table_2 +:table +:2 |= Вход |= Изход @@ -333,20 +352,22 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: 492382352289 + ### Задача 11 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise11.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise11.cpp} От входа получавате две реални числа: координати на точка в равнината. Спрямо следното изображение: -[image ./img/triangle_and_circle.png] +{img ./img/triangle_and_circle.png} -Областта [=не=] включва правата и правоъгълника! +Областта {b не} включва правата и правоъгълника! Зачитайте, че черните прави отбелязват главните оси, а разстоянията между съседни сиви оси е единица. -:table_2 +:table +:2 |= Вход |= Изход @@ -390,18 +411,20 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: Outside + ## За самоподготовка ### Задача 12 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise12.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise12.cpp} От входа получавате цяло неотрицателно число. -Трябва да върнете дали е [url https://en.wikipedia.org/wiki/Sum-product_number число на "сума-произведение"]. +Трябва да върнете дали е {url число на "сума-произведение";https://en.wikipedia.org/wiki/Sum-product_number}. С други думи, дали е равно на сумата на цифрите си, умножено по умнежнието на цифрите. -:table_2 +:table +:2 |= Вход |= Изход @@ -421,14 +444,16 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: Not a sum-product number + ### Задача 13 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise13.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise13.cpp} От входа получавате цяло положително число. Трябва да върнете всички негови делители. -:table_2 +:table +:2 |= Вход |= Изход @@ -448,19 +473,21 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: 1 2 3 4 6 8 9 12 16 18 24 27 32 36 48 54 72 96 108 144 216 288 432 864 + ### Задача 14 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise14.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise14.cpp} От входа получавате две цели неотрицателни числа. -Трябва да намерите [url https://en.wikipedia.org/wiki/Tetration тетрацията] на първото числото на степен второто число. +Трябва да намерите {url тетрацията;https://en.wikipedia.org/wiki/Tetration} на първото числото на степен второто число. Както нормалното степенуване е повторено умножение, така тетрацията е повторено степенуване. Число на тетрация "степен" озачава, че числото се повдига на нормална степен себе си, тетрация степен на брой пъти. Тетрацията расте бързо, използвайте най-големия възможен тип. -:table_2 +:table +:2 |= Вход |= Изход @@ -480,16 +507,18 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: 16777216 + ### Задача 15 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise15.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise15.cpp} От входа получавате 8 цели неотрицателни числа. Трябва да върнете най-малкото общо кратно на всеки две съседни числа. Най-малко общо кратно е най-малкото число, което се дели без остатък на двете числа. -:table_2 +:table +:2 |= Вход |= Изход @@ -500,18 +529,20 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: 12 18 3501 5057 13 26 8 + ### Задача 16 От входа получавате две реални числа: координати на точка в равнината. Спрямо следното изображение: -[image ./img/rectangles_and_circle.png] +{img ./img/rectangles_and_circle.png} изкарайте дали точката е в защрихованата област или не. Зачитайте, че всяка сива права отбелязва брой единици разстояние от нулата. -:table_2 +:table +:2 |= Вход |= Изход @@ -540,16 +571,18 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: Outside + ### Задача 17 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise17.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise17.cpp} -От входа получавате две естествени числа, [`a`] и [`b`]. -Трябва да върнете дали [`a`] е [url https://en.wikipedia.org/wiki/Unitary_divisor унитарен делител] на [`b`]. +От входа получавате две естествени числа, {` a} и {` b}. +Трябва да върнете дали {` a} е {url унитарен делител;https://en.wikipedia.org/wiki/Unitary_divisor} на {` b}. -Това е изпълнено, когато [`a`] е делител на [`b`] и най-големия общ делител на [`a`] и [`b / a`] е 1. +Това е изпълнено, когато {` a} е делител на {` b} и най-големия общ делител на {` a} и {` b / a} е 1. -:table_2 +:table +:2 |= Вход |= Изход @@ -569,14 +602,16 @@ What is the smallest positive integer whose square ends in the digits 269,696? |: Not a unitary divisor + ### Задача 18 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise18.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week06/Exercise18.cpp} От входа получавате 10 реални числа. -Трябва да върнете най-голямата възможна сума, получена чрез събиране на колкото и дълга [=последователна=] редица от елементи. +Трябва да върнете най-голямата възможна сума, получена чрез събиране на колкото и дълга {b последователна} редица от елементи. -:table_2 +:table +:2 |= Вход |= Изход diff --git a/src/teaching/upp-2025/week07/index.du b/src/teaching/upp-2025/week07/index.du index 3f671b0..8c1cbfc 100644 --- a/src/teaching/upp-2025/week07/index.du +++ b/src/teaching/upp-2025/week07/index.du @@ -1,17 +1,17 @@ -# Задачи - УПП, Седмица 7, 13.11.2025 +'def title Задачи - УПП, Седмица 7, 13.11.2025 +'def desc Условията на задачите за упражнение. -'define expected-reading 13 min -'define created 10 November 2025 -'define edited 14 November 2025 -[$pagenav] +# {title} -GitHub Classroom: [url https://classroom.github.com/a/clYBilXQ] +{pagenav 13 min;10 November 2025;14 November 2025} + +GitHub Classroom: {url https://classroom.github.com/a/clYBilXQ} :important -.p Както при [`if`]-ове, следното е лоша практика и ще се вземат точки: +.p Както при {` if}-ове, следното е лоша практика и ще се вземат точки: -```c++ +```cpp bool f() { if (condition) return true; @@ -22,9 +22,9 @@ bool f() { :important -.p Следното е [=грешно=] и ще се вземат точки: +.p Следното е {b грешно} и ще се вземат точки: -```c++ +```cpp int* f() { int numbers[5] = { 0 }; return numbers; @@ -35,18 +35,19 @@ int* f() { ### Задача 1 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise01.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise01.cpp} Напишете функция, която приема цяло число и връща дали е четно и положително. Нека вашата функция да следва декларацията: -```c++ +```cpp bool evenAndPositive(int x); От входа получавате цяло число. -Използвайки [`evenAndPositive`], върнете дали е четно и положително. +Използвайки {` evenAndPositive}, върнете дали е четно и положително. -:table_2 +:table +:2 |= Вход |= Изход @@ -60,22 +61,24 @@ bool evenAndPositive(int x); |: Not even and positive + ### Задача 2 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise02.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise02.cpp} -Напишете функция, която приема цяло неотрицателно число [`n`] и връща n-тото число на фибоначи. +Напишете функция, която приема цяло неотрицателно число {` n} и връща n-тото число на фибоначи. Припомняме, че нулевото число на фибоначи е 0, първото число е 1 и всяко следващо е сумата на предходните две. Нека вашата функция да следва декларацията: -```c++ +```cpp unsigned int fib(unsigned int n); От входа получавате цяло неотрицателно число. -Използвайки [`fib`], трябва да изкарате n-тото число на фибоначи. +Използвайки {` fib}, трябва да изкарате n-тото число на фибоначи. -:table_2 +:table +:2 |= Вход |= Изход @@ -98,23 +101,25 @@ unsigned int fib(unsigned int n); |: 3524578 + ### Задача 3 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise03.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise03.cpp} Напишете функция, която приема масив от 15 цели числа и намира средното аритметично на всички тях. Нека вашата функция да следва декларацията: -```c++ +```cpp double average(int numbers[15]); От входа получавате 15 цели числа. -Използвайки [`average`], трябва да изкарате средното аритметично на всички тях. +Използвайки {` average}, трябва да изкарате средното аритметично на всички тях. .note -[*(14.11.2025)*] Оправен изхода на втори пример. +{i (14.11.2025)} Оправен изхода на втори пример. -:table_2 +:table +:2 |= Вход |= Изход @@ -128,24 +133,26 @@ double average(int numbers[15]); |: -4.93333 + ### Задача 4 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise04.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise04.cpp} -Напишете функция, която приема число с плаваща запетая и [*връща*] две числа: +Напишете функция, която приема число с плаваща запетая и {i връща} две числа: .numbered 1. числото, разделено на половина и 2. числото, закръглено надолу към най-близкото цяло число. Нека вашата функция да следва декларацията: -```c++ +```cpp void calc(float number, double &half, int* integer); От входа получавате число с плаваща запетая. -Използвайки [`calc`], трябва да изкарате двете [*върнати*] стойности. +Използвайки {` calc}, трябва да изкарате двете {i върнати} стойности. -:table_2 +:table +:2 |= Вход |= Изход @@ -156,19 +163,21 @@ void calc(float number, double &half, int* integer); |: -4.995 -9 + ### Задача 5 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise05.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise05.cpp} -Напишете функция [`maxElem`], която приема масив от числа с плаваща запетая и негов размер [=поотделно=]! +Напишете функция {` maxElem}, която приема масив от числа с плаваща запетая и негов размер {b поотделно}! Това означава, че на функцията може да ѝ бъде подаден масив с 10, 15, 2 или ... елемента. Нека вашата функция да върне най-големия елемент в масива. От входа получавате една редица от 5 реални числа и втора редица от 7 реални числа. -Използвайки [`maxElem`], върнете най-големия елемент в първата и във втората редица. +Използвайки {` maxElem}, върнете най-големия елемент в първата и във втората редица. -:table_2 +:table +:2 |= Вход |= Изход @@ -187,20 +196,22 @@ void calc(float number, double &half, int* integer); |: 50.5 37.9 + ### Задача 6 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise06.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise06.cpp} -Напишете функция, която приема масив с произволна дължина (масива и размера се подават поотделно), съствен от цели числа, и [*върнете*] най-големия и най-малкия му елемент. +Напишете функция, която приема масив с произволна дължина (масива и размера се подават поотделно), съствен от цели числа, и {i върнете} най-големия и най-малкия му елемент. Нека вашата функция да следва декларацията: -```c++ +```cpp void minmaxElems(int* arr, unsigned size, int* min, int* max); От входа получавате две редици от по 10 и 8 цели числа съответно. -Използвайки [`minmaxElems`], върнете най-големия и най-малкия елемент на всяка редица. +Използвайки {` minmaxElems}, върнете най-големия и най-малкия елемент на всяка редица. -:table_2 +:table +:2 |= Вход |= Изход @@ -225,9 +236,10 @@ void minmaxElems(int* arr, unsigned size, int* min, int* max); 86 -97 + ### Задача 7 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise07.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise07.cpp} Напишете функция, която приема масив с произволна дължина, съставен от цели числа, и връща сумата на всички елементи. Нека вашата функция да следва декларацията: @@ -236,14 +248,15 @@ void minmaxElems(int* arr, unsigned size, int* min, int* max); unsigned sumElems(int* arr, unsigned size); От входа получавате 11 цели числа. -Трябва да върнете първата последователност от 3 елемента, чиято сума е 0, използвайки [`sumElems`]. +Трябва да върнете първата последователност от 3 елемента, чиято сума е 0, използвайки {` sumElems}. Ако няма такава, не изкарвайте нищо. .note -[*(14.11.2025)*] Оправен изхода на трети пример. +{i (14.11.2025)} Оправен изхода на трети пример. -:table_2 +:table +:2 |= Вход |= Изход @@ -257,24 +270,26 @@ unsigned sumElems(int* arr, unsigned size); |: -1 0 1 + ### Задача 8 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise08.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise08.cpp} Напишете функция, която приема масив с произволен размер, съставен от цели неотрицателни числа, и неотрицателно число: ротация. Трябва да завъртите елементите в масива с ротация на брой позиции на дясно. -Тоест, ако масива е [`1 2 3 4`], тогава след ротация с една позиция, масива ще е [`4 1 2 3`]. -Ако имахме две ротации, тогава щяхме да получим [`3 4 1 2`]. +Тоест, ако масива е {` 1 2 3 4}, тогава след ротация с една позиция, масива ще е {` 4 1 2 3}. +Ако имахме две ротации, тогава щяхме да получим {` 3 4 1 2}. Не модифицирайте оригиналния масив! -Трябва да [*върнете*] друг масив със завъртяните елементи. +Трябва да {i върнете} друг масив със завъртяните елементи. От входа получавате две редици от по 6 и 7 цели числа. След всяка редица получавате ротация. Трябва да изкарате двете редици, обаче завъртяни, използвайки вашата функция. -:table_2 +:table +:2 |= Вход |= Изход @@ -299,37 +314,39 @@ unsigned sumElems(int* arr, unsigned size); 5 6 7 1 2 3 4 + ### Задача 9 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise09.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise09.cpp} .note -[*(14.11.2025)*] Оправена декларацията на функцията, примери и добавено упътване. +{i (14.11.2025)} Оправена декларацията на функцията, примери и добавено упътване. .warn -НЕ може да използвате "вградената" функция [`pow`]! +НЕ може да използвате "вградената" функция {` pow}! Напишете функция, която приема число с плаваща запетая и цяло неотрицателно число, и връща първото число на степен второто. Нека вашата функция да следва декларацията: -```c++ +```cpp double topower(double x, unsigned int a); От входа получавате 11 реални числа. Първите 10 са коефициентите в полином от 10та степен. 11тото е потенциален корен. -Трябва да върнете дали 11тото действително е корен на уравнението, използвайки [`topower`]. +Трябва да върнете дали 11тото действително е корен на уравнението, използвайки {` topower}. -Припомняме, че едно число [`x`] е корен на полином от 10та степен, когато: +Припомняме, че едно число {` x} е корен на полином от 10та степен, когато: -[image ./img/polynomial.png] +{img ./img/polynomial.png} -[=Упътване:=] +{b Упътване:} За някои примери, прецизността на въведения корен не е достатъчна. Може да приемете, че ако (абсолютната стойност на) сумата е по-малка от 0.0001, то сумата на практика е 0. -:table_2 +:table +:2 |= Вход |= Изход @@ -358,25 +375,27 @@ double topower(double x, unsigned int a); |: Not a root + ### Задача 10 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise10.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise10.cpp} Напишете функция, която приема два масива с произволни размери, съставени от цели числа, и връща колко от елементите на двата масива съвпадат по стойност на еднакви индекси. Тоест, на колко еднакви позиции срещаме еднакви елементи. Нека вашата функция да следва декларацията: -```c++ +```cpp unsigned int countSameElementsOnSameIndecies(int* arr1, unsigned int size1, int* arr2, unsigned int size2); От входа получавате две редици от по 10 и 15 цели числа. -Трябва да върнете бройката на съвпадащи стойности на съвпадащи индекси, използвайки [`countSameElementsOnSameIndecies`]. +Трябва да върнете бройката на съвпадащи стойности на съвпадащи индекси, използвайки {` countSameElementsOnSameIndecies}. .note -[*14.11.2025*] Оправен вход на последния пример. +{i 14.11.2025} Оправен вход на последния пример. -:table_2 +:table +:2 |= Вход |= Изход @@ -402,18 +421,20 @@ unsigned int countSameElementsOnSameIndecies(int* arr1, unsigned int size1, int* |: 4 + ## За самоподготовка ### Задача 11 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise11.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise11.cpp} Напишете функция, която приема неотрицателно цяло число и връща дали е просто. От входа получавате две естествени числа. Трябва да върнете бройката на всички прости числа между тези две числа (включително), използвайки вашата функция. -:table_2 +:table +:2 |= Вход |= Изход @@ -427,16 +448,18 @@ unsigned int countSameElementsOnSameIndecies(int* arr1, unsigned int size1, int* |: 139 + ### Задача 12 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise12.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise12.cpp} Напишете функция, която получава масив с произволен размер, съствен от цели числа, и инкрементира всеки елемент. Получавате две редици от по 10 и 9 елемента. Трябва да върнете двете редици, обаче всеки елемент е инкрементиран, използвайки вашата фунцкия. -:table_2 +:table +:2 |= Вход |= Изход @@ -461,18 +484,20 @@ unsigned int countSameElementsOnSameIndecies(int* arr1, unsigned int size1, int* 26 101 29 -31 33 -69 -94 -97 -85 + ### Задача 13 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise13.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise13.cpp} Напишете функция, която получава масив от 4 букви и връща дали трите буква образуват последователност "буква, цифра, буква, цифра". От входа получавате 12 букви и трябва да върнете дали целия масив образува последователността "буква, цифра, буква, цифра, буква, цифрва, ...", използвайки вашата функция. .note -[*(14.11.2025)*] Оправен трети пример. +{i (14.11.2025)} Оправен трети пример. -:table_2 +:table +:2 |= Вход |= Изход @@ -486,21 +511,23 @@ unsigned int countSameElementsOnSameIndecies(int* arr1, unsigned int size1, int* |: Follows pattern + ### Задача 14 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise14.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise14.cpp} -Напишете функция, която получава масив от 10 реални числа и [*връща*] масив от 5 реални числа. +Напишете функция, която получава масив от 10 реални числа и {i връща} масив от 5 реални числа. Резултатния масив се формира по следния начин: .numbered -1. Първия елемент на [*върнатия*] масив е разликата на втория от първия елемент на входния (получения) масив. -2. Втория елемент на [*върнатия*] масив е разликата на четвъртия от третия елемент на входния масив. +1. Първия елемент на {i върнатия} масив е разликата на втория от първия елемент на входния (получения) масив. +2. Втория елемент на {i върнатия} масив е разликата на четвъртия от третия елемент на входния масив. 3. И така нататък. От входа получавате масив с 10 елемента. -Трябва да [*върнете*] резултатния 5-елементен масив от вашата функция. +Трябва да {i върнете} резултатния 5-елементен масив от вашата функция. -:table_2 +:table +:2 |= Вход |= Изход @@ -517,9 +544,10 @@ unsigned int countSameElementsOnSameIndecies(int* arr1, unsigned int size1, int* |: 32 118 69 82 -49 + ### Задача 15 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise15.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week07/Exercise15.cpp} Напишете две функции, всяка от които приема масив с 5 естествени числа. Нека първата да повдига всяко число на втора степен и втората да умножава всяко число по 3. @@ -532,9 +560,10 @@ unsigned int countSameElementsOnSameIndecies(int* arr1, unsigned int size1, int* Допуснете, че винаги ще срещнете целевото число. Използвайте вашите функции. .note -[*(14.11.2025)*] Оправени входове на първите два примера. +{i (14.11.2025)} Оправени входове на първите два примера. -:table_2 +:table +:2 |= Вход |= Изход diff --git a/src/teaching/upp-2025/week08/index.du b/src/teaching/upp-2025/week08/index.du index 4b75284..f7b2eaa 100644 --- a/src/teaching/upp-2025/week08/index.du +++ b/src/teaching/upp-2025/week08/index.du @@ -1,22 +1,23 @@ -# Задачи - УПП, Седмица 8, 20.11.2025 +'def title Задачи - УПП, Седмица 8, 20.11.2025 +'def desc Условията на задачите за упражнение. -'define expected-reading 34 min -'define created 15 November 2025 -'define edited 23 November 2025 -[$pagenav] +# {title} -GitHub Classroom: [url https://classroom.github.com/a/rhpKbNmH] +{pagenav 34 min;15 November 2025;23 November 2025} + +GitHub Classroom: {url https://classroom.github.com/a/rhpKbNmH} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise01.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise01.cpp} От входа получавате матрица 5 на 5 от цели числа. -Трябва да върнете дали е разредена матрица: дали има [*повече*] нули отколкото други числа. +Трябва да върнете дали е разредена матрица: дали има {i повече} нули отколкото други числа. -:table_2 +:table +:2 |= Вход |= Изход @@ -45,9 +46,10 @@ Not sparse Sparse + ### Задача 2 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise02.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise02.cpp} Напишете функция, която получава матрица с произволен размер и масив, чиято дължина е същата като на един ред в матрицата. @@ -56,7 +58,8 @@ Sparse От входа получавате матрица 7 на 3 от цели неотрицателни числа. Използвайки вашата функция, намерете сумата на всички редове и я изкарайте. -:table_2 +:table +:2 |= Вход |= Изход @@ -89,9 +92,10 @@ Sparse 204 208 379 + ### Задача 3 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise03.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise03.cpp} Напишете функция, която получава две матрици с произволни размери, съствени от реални числа. Може да допуснете, че размера на втората матрица е по-малък от тази на първата. @@ -100,14 +104,15 @@ Sparse Тоест, всички елементи от горния ляв ъгъл, надолу и надясно колкото е размера на втората матрица. От входа получавате матрица 6 на 6 от реални числа. -След това получавате 4 неотрицателни числа: първите две са координат в матрицата (където горния ляв ъгъл е [`(0, 0)`]), вторите две са нейни размери. +След това получавате 4 неотрицателни числа: първите две са координат в матрицата (където горния ляв ъгъл е {` (0, 0)}), вторите две са нейни размери. -Използвайки вашата функция, трябва да изкарате подматрицата с начало подадения координат и размери подадените размери [=използвайки=] вашата функция. +Използвайки вашата функция, трябва да изкарате подматрицата с начало подадения координат и размери подадените размери {b използвайки} вашата функция. .note -[=(23.11.2025)=] Опростени някои примери. +{b (23.11.2025)} Опростени някои примери. -:table_2 +:table +:2 |= Вход |= Изход @@ -180,26 +185,28 @@ Sparse 100 64 46.204 30812 + ### Задача 4 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise04.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise04.cpp} City Bloxx е известна мобилна игра за строене на сгради. В нейния "Build city" режим, целта е построените сгради да се подредят в матрица 5 на 5. Нека да разгледаме следните правила за сгради (в самата игра има някои разлики): .numbered -1. [*Жилищните сгради*] може да се поставят навсякъде. -2. [*Търговските сгради*] трябва да бъдат поставени до поне една жилищна сграда. -3. [*Офис сградите*] трябва да бъдат поставени до поне една жилищна и една търговска. -4. [*Луксозните сгради*] трябва да бъдат поставени до поне една жилищна, една търговска и една офис сграда. +1. {i Жилищните сгради} може да се поставят навсякъде. +2. {i Търговските сгради} трябва да бъдат поставени до поне една жилищна сграда. +3. {i Офис сградите} трябва да бъдат поставени до поне една жилищна и една търговска. +4. {i Луксозните сгради} трябва да бъдат поставени до поне една жилищна, една търговска и една офис сграда. -Сгради са съседни само по вертикал и хоризонтал, [=не=] по диагонал. +Сгради са съседни само по вертикал и хоризонтал, {b не} по диагонал. От входа получавате масив 5 на 5 с цели числа, където с 1 до 4 се обозначават сградите, от жилищни до луксозни. Изкарайте дали подредбата на сградите е позволена (следва горните правила). -:table_2 +:table +:2 |= Вход |= Изход @@ -254,14 +261,16 @@ City Bloxx е известна мобилна игра за строене на |: Valid + ### Задача 5 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise05.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise05.cpp} От входа получавате матрица 3 на 3, съствена от цели числа. Трябва да я транспонирате: да смените елементите над и под главния диагонал, и да изкарате резултата. -:table_2 +:table +:2 |= Вход |= Изход @@ -290,9 +299,10 @@ City Bloxx е известна мобилна игра за строене на 0 2 5 + ### Задача 6 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise06.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise06.cpp} Напишете функция, която приема матрица с произволни размери, съствена от реални числа, заедно с два индекса. Разменете колоните на подадените индекси, ако това е възможно. @@ -302,9 +312,10 @@ City Bloxx е известна мобилна игра за строене на Трябва да размените двете колони, използвайки вашата функция, и да изкарате резултата. -[*Вашия изход не е нужно да бъде подравнен.*] +{i Вашия изход не е нужно да бъде подравнен.} -:table_2 +:table +:2 |= Вход |= Изход @@ -348,17 +359,19 @@ City Bloxx е известна мобилна игра за строене на 16.84 53.84 0 -21.11 23.22 + ### Задача 7 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise07.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise07.cpp} От входа получавате матрица от букви 3 на 3. -Тя определя шаблон, където буквата [`*`] означава, че всяка стойност е позволена. +Тя определя шаблон, където буквата {` *} означава, че всяка стойност е позволена. След това от входа получавате матрица 6 на 6, съствена от букви. -Трябва да намерите всички срещания на шаблона в тази матрица, като [=срещанията може да се застъпват!=] +Трябва да намерите всички срещания на шаблона в тази матрица, като {b срещанията може да се застъпват!} -:table_2 +:table +:2 |= Вход |= Изход @@ -419,17 +432,19 @@ City Bloxx е известна мобилна игра за строене на |: 16 + ### Задача 8 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise08.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise08.cpp} От входа получавате две матрици 3 на 3, съствени от цели неотрицателни числа. Пресметнете умножението на матриците (ред по стълб) и изкарайте резултата. .note -[=(23.11.2025)=] Оправен входа на втория пример. +{b (23.11.2025)} Оправен входа на втория пример. -:table_2 +:table +:2 |= Вход |= Изход @@ -464,30 +479,32 @@ City Bloxx е известна мобилна игра за строене на 17 13 14 + ### Задача 9 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise09.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise09.cpp} При изграждането на устройства като клавиатури, често се използва "бутонна матрица". -Няма да навлизаме в електрониката, но идеята е че когато натиснеш бутон, съответната колона [=и=] ред са "свързани"/активни. +Няма да навлизаме в електрониката, но идеята е че когато натиснеш бутон, съответната колона {b и} ред са "свързани"/активни. -[=Тоест, когато активни ред и колона се пресичат, тогава съответния бутон е натиснат.=] +{b Тоест, когато активни ред и колона се пресичат, тогава съответния бутон е натиснат.} Това означава, че се нуждаем да погледнем само състоянията на всеки ред и колона, и ще знаем всички натиснати бутони (вместо да поглеждаме всеки бутон поотделно). 'footnote keypad_image_attrib Изображение от Sakurambo - създадено чрез Adobe Illustrator CS2, Публичен домейн, [url https://commons.wikimedia.org/w/index.php?curid=2048341] -Нека да разглеждаме стандартна 4 на 3 телефонна клавиатура[$keypad_image_attrib]: +Нека да разглеждаме стандартна 4 на 3 телефонна клавиатура{keypad_image_attrib}: -[image https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Telephone-keypad2.svg/330px-Telephone-keypad2.svg.png] +{img https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Telephone-keypad2.svg/330px-Telephone-keypad2.svg.png} От входа първо получавате 4 булеви стойности: дали реда е активен (отгоре надолу). След това получавате още 3 булеви стойности: дали колоната е активна (отляво надясно). -Изкарайте кои бутони са натиснати, използвайки цифровите знаци, звезда ([`*`]) и диез ([`#`]). +Изкарайте кои бутони са натиснати, използвайки цифровите знаци, звезда ({` *}) и диез ({` #}). Ако няма натиснати, изкарайте съответно съобщение. -:table_2 +:table +:2 |= Вход |= Изход @@ -510,43 +527,44 @@ City Bloxx е известна мобилна игра за строене на |: Nothing pressed + ### Задача 10 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise10.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise10.cpp} -[url https://en.wikipedia.org/wiki/Pascal%27s_triangle Триъгълника на Паскал] е изчисление, при което се конструира триъгълник от числа. +{url Триъгълника на Паскал;https://en.wikipedia.org/wiki/Pascal%27s_triangle} е изчисление, при което се конструира триъгълник от числа. По двете "рамене" има единици, и всяко вътрешно число е сумата на горните две. 'footnote pascal_animation_attrib Анимация от Hersfold - собствен труд, Публичен домейн, [url https://commons.wikimedia.org/w/index.php?curid=3902538] -Пояснителна анимация[$pascal_animation_attrib]: +Пояснителна анимация{pascal_animation_attrib}: -[image https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAnimated2.gif] +{img https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAnimated2.gif} -[=Генерирайте=] и изкарайте триъгълника на паскал в матрица 11 на 11, където двете страни на триъгълника са първата колона и главния диагонал. +{b Генерирайте} и изкарайте триъгълника на паскал в матрица 11 на 11, където двете страни на триъгълника са първата колона и главния диагонал. Нека стойностите извън триъгълника да са нули. -[=Изход:=] [*(не е нужно да бъде подравнен)*] +{b Изход:} {i (не е нужно да бъде подравнен)} .comment https://www.fcfung2000.com/ufcfiles/ufcmatrk.htm ``` -[=1=] 0 0 0 0 0 0 0 0 0 0 -[=1=] [=1=] 0 0 0 0 0 0 0 0 0 -[=1=] 2 [=1=] 0 0 0 0 0 0 0 0 -[=1=] 3 3 [=1=] 0 0 0 0 0 0 0 -[=1=] 4 6 4 [=1=] 0 0 0 0 0 0 -[=1=] 5 10 10 5 [=1=] 0 0 0 0 0 -[=1=] 6 15 20 15 6 [=1=] 0 0 0 0 -[=1=] 7 21 35 35 21 7 [=1=] 0 0 0 -[=1=] 8 28 56 70 56 28 8 [=1=] 0 0 -[=1=] 9 36 84 126 126 84 36 9 [=1=] 0 -[=1=] 10 45 120 210 252 210 120 45 10 [=1=] +{b 1} 0 0 0 0 0 0 0 0 0 0 +{b 1} {b 1} 0 0 0 0 0 0 0 0 0 +{b 1} 2 {b 1} 0 0 0 0 0 0 0 0 +{b 1} 3 3 {b 1} 0 0 0 0 0 0 0 +{b 1} 4 6 4 {b 1} 0 0 0 0 0 0 +{b 1} 5 10 10 5 {b 1} 0 0 0 0 0 +{b 1} 6 15 20 15 6 {b 1} 0 0 0 0 +{b 1} 7 21 35 35 21 7 {b 1} 0 0 0 +{b 1} 8 28 56 70 56 28 8 {b 1} 0 0 +{b 1} 9 36 84 126 126 84 36 9 {b 1} 0 +{b 1} 10 45 120 210 252 210 120 45 10 {b 1} ### Задача 11 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise11.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise11.cpp} От входа получавате матрица 10 на 10 от цели неотрицателни числа. След това получавате размер между 0 и 10. @@ -559,11 +577,12 @@ City Bloxx е известна мобилна игра за строене на Не добавяйте към средното аритметично несъществуващи клетки (напр. клетката в горния ляв ъгъл няма клетки над или в ляво от себе си). .note -[=(23.11.2025)=] Добавени още примери. +{b (23.11.2025)} Добавени още примери. -[*(Вашия изход не е нужно да бъде подравнен.)*] +{i (Вашия изход не е нужно да бъде подравнен.)} -:table_2 +:table +:2 |= Вход |= Изход @@ -649,61 +668,65 @@ City Bloxx е известна мобилна игра за строене на 0 0 0 0 0 0 2 0 0 0 + ### Задача 12 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise12.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise12.cpp} От входа получавате два реални координата, между (0,0) и (10,10). -Трябва да върнете матрица 10 на 10 от знаци, която се съставя единствено от шпации (spaces) и хиксове ([`x`]). +Трябва да върнете матрица 10 на 10 от знаци, която се съставя единствено от шпации (spaces) и хиксове ({` x}). Зачитаме, че координатите директно съответстват на матрицата, като (0,0) се намира в горния ляв ъгъл и (10,10) в долния десен. В тази матрица, по подразбиране стоят само шпации. Хиксовете се намират там, където начертаната отсечка между входните точки би застъпила матрицата. Примерна диаграма: -[image ./img/line_interpolation.png] +{img ./img/line_interpolation.png} Тази операция се нарича интерполация. .note -[=(23.11.2025)=] Добавени още примери. +{b (23.11.2025)} Добавени още примери. -:table_2 +:table +:2 |= Вход |= Изход |: 1 8.5 8.5 2.5 |: ``` -'include ./text/output_interpolation_1.txt +'snippet 1 $ ./text/output_interpolation_1.txt |: 0 0 10 10 |: ``` -'include ./text/output_interpolation_2.txt +'snippet 1 $ ./text/output_interpolation_2.txt |: 2.3 1.8 9.9 7 |: ``` -'include ./text/output_interpolation_3.txt +'snippet 1 $ ./text/output_interpolation_3.txt |: 0 5 10 5 |: ``` -'include ./text/output_interpolation_4.txt +'snippet 1 $ ./text/output_interpolation_4.txt + ## За самоподготовка ### Задача 13 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise13.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise13.cpp} От входа получавате матрица 8 на 8, съставена от символите точка и плюс. Трябва да върнете височината и ширината на най-големия правоъгълник, който застъпва всички плюсове. -:table_2 +:table +:2 |= Вход |= Изход @@ -747,14 +770,16 @@ City Bloxx е известна мобилна игра за строене на |: 8 8 + ### Задача 14 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise14.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise14.cpp} От входа приемате масив от 6 елемента и матрица с 6 реда и 3 колони, всички съставени от реални числа. Трябва да реализирате умножение на вектор по матрица (където масива е вектора). -:table_2 +:table +:2 |= Вход |= Изход @@ -783,16 +808,18 @@ City Bloxx е известна мобилна игра за строене на |: 8 7 41.8 + ### Задача 15 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise15.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week08/Exercise15.cpp} От входа получавате матрица 9 на 7 с реални числа. След това получавате още едно реално число: максимална разлика. Проверете дали данните са гладки: стойността във всяка една клетка да се различава с най-много максималната разлика от всички свои съседни клетки (по хоризонтала, вертикала и диагонала). -:table_2 +:table +:2 |= Вход |= Изход @@ -857,6 +884,7 @@ City Bloxx е известна мобилна игра за строене на |: Not smooth + ### Задача 16 Напишете функция която приема матрица с произволни размери и "връща" матрица, която е като входната матрица, но всички елементи са "завъртяни" на дясно с 90 градуса. @@ -867,9 +895,10 @@ City Bloxx е известна мобилна игра за строене на Ако не можете, не записвайте нищо във върнатата. От входа получавате матрица 4 на 8, съставена от цели числа. -[=Използвайки вашата функция=], завъртете матрицата и изкарайте резултата. +{b Използвайки вашата функция}, завъртете матрицата и изкарайте резултата. -:table_2 +:table +:2 |= Вход |= Изход @@ -892,6 +921,7 @@ City Bloxx е известна мобилна игра за строене на 32 24 16 8 + ### Задача 17 Трябва да реализирате (опростен вариант на) "pixel binning": спрямо подаден коефициент, стойностите в клетки се смесват. @@ -901,7 +931,8 @@ City Bloxx е известна мобилна игра за строене на От входа получавате матрица 12 на 12 с цели неотрицателни числа и неотрицателен binning коефициент. Трябва да върнете матрицата след приложен binning. -:table_2 +:table +:2 |= Вход |= Изход @@ -937,6 +968,7 @@ City Bloxx е известна мобилна игра за строене на 2 2 0 0 0 0 0 0 0 0 12 12 + ### Задача 18 От входа получавате матрица 10 на 10 с цели неотрицателни числа. @@ -945,7 +977,8 @@ City Bloxx е известна мобилна игра за строене на Сравнявайте матриците по техния размер, тоест броя елементи. Ако има няколко еднакво големи подматрици, може да изкарате която и да е от тях. -:table_2 +:table +:2 |= Вход |= Изход @@ -970,6 +1003,7 @@ City Bloxx е известна мобилна игра за строене на 1 1 1 + ### Задача 19 От входа получавате матрица 8 на 8 от реални числа. @@ -984,7 +1018,8 @@ City Bloxx е известна мобилна игра за строене на Накрая изкарате резултатното число. -:table_2 +:table +:2 |= Вход |= Изход @@ -1020,9 +1055,10 @@ City Bloxx е известна мобилна игра за строене на 160 155 + ### Задача 20 -[=Генерирайте=] и изкарайте [url https://en.wikipedia.org/wiki/Bell_triangle триъгълника на Бел] в долния ляв ъгъл на матрица 11 на 11. +{b Генерирайте} и изкарайте {url триъгълника на Бел;https://en.wikipedia.org/wiki/Bell_triangle} в долния ляв ъгъл на матрица 11 на 11. Това означава, че страните на триъгълника включват първата колона и главния диагонал. .bulleted @@ -1033,13 +1069,13 @@ City Bloxx е известна мобилна игра за строене на 'footnote bell_animation_attrib Анимация от Xanthoxyl - собствен труд, CC BY-SA 3.0, [url https://commons.wikimedia.org/w/index.php?curid=5832904] -Пояснителна анимация[$bell_animation_attrib]: +Пояснителна анимация{bell_animation_attrib}: -[image https://upload.wikimedia.org/wikipedia/commons/a/ab/BellNumberAnimated.gif] +{img https://upload.wikimedia.org/wikipedia/commons/a/ab/BellNumberAnimated.gif} -Тази задача е подобна на [url #-10 Задача 10]. +Тази задача е подобна на {url Задача 10;#-10}. -[=Изход:=] [*(не е нужно да бъде подравнен)*] +{b Изход:} {i (не е нужно да бъде подравнен)} .comment https://oeis.org/A011971 @@ -1068,7 +1104,8 @@ https://www.apcomputersciencetutoring.com/2d-array-practice-exercises/#grow-meth Ако изходната матрица е по-голяма, попълнете празните позиции с нули. -:table_2 +:table +:2 |= Вход |= Изход @@ -1101,6 +1138,7 @@ https://www.apcomputersciencetutoring.com/2d-array-practice-exercises/#grow-meth 7 8 + ### Задача 22 От входа получавате матрица 3 на 3 със знаци. @@ -1108,11 +1146,12 @@ https://www.apcomputersciencetutoring.com/2d-array-practice-exercises/#grow-meth Трябва да изкарате матрица със знаци 9 на 9, в която е попълнено изображението спрямо режима. .numbered -1. [=Режим 1=] обозначава повтаряне, където изображението се повтаря последователно -2. [=Режим 2=] обозначава "border", където изображението се слага в центъра и останалта част се попълва със знак диес [`#`]. -3. [=Режим 3=] обозначава "clamp", изображението се слага в центъра и останалата част се попълва като се повтаря последната буква. Тоест, дясното 3 на 3 се попълва с повторение на десния знак. +1. {b Режим 1} обозначава повтаряне, където изображението се повтаря последователно +2. {b Режим 2} обозначава "border", където изображението се слага в центъра и останалта част се попълва със знак диес {` #}. +3. {b Режим 3} обозначава "clamp", изображението се слага в центъра и останалата част се попълва като се повтаря последната буква. Тоест, дясното 3 на 3 се попълва с повторение на десния знак. -:table_2 +:table +:2 |= Вход |= Изход @@ -1144,6 +1183,7 @@ f g h |: ``` +'emplace # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -1153,6 +1193,7 @@ f g h # # # # # # # # # # # # # # # # # # # # # # # # # # # +'endemplace |: ``` @@ -1174,6 +1215,7 @@ f f f g g g h h h f f f g g g h h h + ### Задача 23 От входа получавате цяло неотрицателно число, по-малко от 50. @@ -1181,9 +1223,10 @@ f f f g g g h h h Зачитайте, че 0 винаги е в центъра на спиралата и се въртите първо с една позиция разстояние, после с две и так. нат. -[*(Вашия изход не е нужно да бъде подравнен.)*] +{i (Вашия изход не е нужно да бъде подравнен.)} -:table_2 +:table +:2 |= Вход |= Изход @@ -1215,6 +1258,7 @@ f f f g g g h h h 15 14 13 12 + ## За любознателни ### Задача 24 @@ -1222,24 +1266,24 @@ f f f g g g h h h Реализирайте матричен калкулатор. От входа получавате матрица 4 на 4 с реални числа и след това получавате редица операции. -Всяка операция започва с буква, като буквата [`$`] сигнализира край на програмата. +Всяка операция започва с буква, като буквата {` $} сигнализира край на програмата. След всеки знак има няколко аргумента, т.е. допълнителни стойности които трябва да се въведат, преди операцията да се изпълни. .bulleted -- Операцията [`*`] обозначава умножение на ред, и след знака има цяло неотрицателно число за индекс на ред и след него е реално число (коефициент с който да умножим реда). -- Операцията [`+`] обозначава сума на редове, след знака се очакват два неотрицателни индекса на редове, първия ред се сумира в втория -- Операцията [`^`] обозначава размяна на редове, след знака се очакват два неотрицателни индекса на редове и стойностите им се разменят. +- Операцията {` *} обозначава умножение на ред, и след знака има цяло неотрицателно число за индекс на ред и след него е реално число (коефициент с който да умножим реда). +- Операцията {` +} обозначава сума на редове, след знака се очакват два неотрицателни индекса на редове, първия ред се сумира в втория +- Операцията {` ^} обозначава размяна на редове, след знака се очакват два неотрицателни индекса на редове и стойностите им се разменят. -След всяка операция (освен [`$`]) трябва да изкарате състоянието на матрицата. +След всяка операция (освен {` $}) трябва да изкарате състоянието на матрицата. ### Задача 25 -Трябва да реализирате [url https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life Играта "Живот"]. +Трябва да реализирате {url Играта "Живот";https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life}. От входа получавате матрица 10 на 10 с булеви стойности. След това получавате неотрицателно число: брой генерации (ходове). -Всяка клетка наричаме жива или мъртва (съответно на [`true`] или [`false`]). +Всяка клетка наричаме жива или мъртва (съответно на {` true} или {` false}). В една генерация (ход) на играта, всяка клетка променя своя статус (стойност) по следните правила: .bulleted - всяка жива клетка с по-малко от два живи съседа (вертикално, хоризонтално и диагонално) умира diff --git a/src/teaching/upp-2025/week09/index.du b/src/teaching/upp-2025/week09/index.du index 55febbf..a737cae 100644 --- a/src/teaching/upp-2025/week09/index.du +++ b/src/teaching/upp-2025/week09/index.du @@ -1,14 +1,14 @@ -# Задачи - УПП, Седмица 9, 27.11.2025 +'def title Задачи - УПП, Седмица 9, 27.11.2025 +'def desc Условията на задачите за упражнение. -'define expected-reading 12 min -'define created 24 November 2025 -'define edited 26 November 2025 -[$pagenav] +# {title} + +{pagenav 12 min;24 November 2025;26 November 2025} .important Реализирайте единствено архитектурни решения! -GitHub Classroom: [url https://classroom.github.com/a/ZYFDdLi4] +GitHub Classroom: {url https://classroom.github.com/a/ZYFDdLi4} ## За решаване @@ -30,41 +30,41 @@ GitHub Classroom: [url https://classroom.github.com/a/ZYFDdLi4] Всеки хигрометър измерва процента влажност. В условието не са дадени подробности относно формата на тази стойност, затова ще използваме тип с плаваща запетая, който ще покрие всички реални стойности. -Ще изведем в глобална константа [`SIZE`] размера на едно измерение на матрицата, и самата матрица ще съдържа влажността в стойности от тип [`double`]. +Ще изведем в глобална константа {` SIZE} размера на едно измерение на матрицата, и самата матрица ще съдържа влажността в стойности от тип {` double}. -За намиране на средната влажност в града, ще изградим функцията [`average`], която изглежда по следния начин: +За намиране на средната влажност в града, ще изградим функцията {` average}, която изглежда по следния начин: -```c++ +```cpp double average(const double hygrometers[SIZE][SIZE]); Функцията приема матрицата със стойности на влажност от всеки хигрометър и връща средната стойност. Реализацията изисква линейно итериране през цялата матрица, като се пази сума на всички елементи. Върнатата стойност е сумата, разделена на броя хигрометри. -За намиране на най-влажен и най-сух квадрант ще реализираме функцията [`quadrantHumidity`], чиято декларация е: +За намиране на най-влажен и най-сух квадрант ще реализираме функцията {` quadrantHumidity}, чиято декларация е: -```c++ +```cpp double quadrantHumidity(const double hygrometers[SIZE][SIZE], unsigned startRow, unsigned startCol); Функцията приема матрицата с влажности и начални индекси по ред и колона на съответния квадрант. Знаем, че един квадрант ще бъде една четвърт от размера на матрицата (половината височина и ширина), затова не е нужно той да бъде подаден. -В имплементацията, ще итерираме през матрицата, като започнем от началните редове и колона, и обиколим точно [`SIZE / 2`] реда и колони. +В имплементацията, ще итерираме през матрицата, като започнем от началните редове и колона, и обиколим точно {` SIZE / 2} реда и колони. Ще пазим сума на всички елементи и накрая ще разделим на броя елементи, т.е. ще върнем средната стойност на влажност в квадранта. В заглавната функция ще дефинираме матрицата и ще попълним входните влажности. -След това ще изкараме стойността, върната от извикване на [`average`]. +След това ще изкараме стойността, върната от извикване на {` average}. За сух и влажен квадрант, ще създадем две променливи за най-голяма и най-малка стойност. -След това ще извикваме [`quadrantHumidity`], като ще запазим върната стойност като най-голяма и най-малка спрямо текущите стойности. +След това ще извикваме {` quadrantHumidity}, като ще запазим върната стойност като най-голяма и най-малка спрямо текущите стойности. -Началните ред и колона ще подаваме с вложен цикъл, който ще итерира колоните и редовете от най-първите (на индекси 0,0) и ще увеличава всеки индекс с размера на страната на квадрант ([`SIZE / 2`]). +Началните ред и колона ще подаваме с вложен цикъл, който ще итерира колоните и редовете от най-първите (на индекси 0,0) и ще увеличава всеки индекс с размера на страната на квадрант ({` SIZE / 2}). След цикъла и всички извиквания ще имаме стойностите в нашите променливи и ще ги изкараме. ### Задача 1 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week09/Exercise01.txt Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week09/Exercise01.txt} Сграда разполага с два асансьора и 5 етажа. Инженерите на асансьорите са забелязали, че асансьора се качва по-бързо отколкото слиза. @@ -74,7 +74,7 @@ double quadrantHumidity(const double hygrometers[SIZE][SIZE], unsigned startRow, ### Задача 2 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week09/Exercise02.txt Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week09/Exercise02.txt} Автобусна фирма в един град трябва да замени всички свои автобуси. В града има 6 автобусни линии и всяка линия има между 5 и 17 спирки. @@ -86,7 +86,7 @@ double quadrantHumidity(const double hygrometers[SIZE][SIZE], unsigned startRow, ### Задача 3 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week09/Exercise03.txt Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week09/Exercise03.txt} Фабрика купува 5 нови машини, всяка от които изработва по 10000 градивни елемента на час. Всеки час от 8 часов работен ден, работниците във фабриката отбелязват в счетоводни таблици дали всеки един елемент е дефектен или не. diff --git a/src/teaching/upp-2025/week10/index.du b/src/teaching/upp-2025/week10/index.du index 5ec2926..c8d7f63 100644 --- a/src/teaching/upp-2025/week10/index.du +++ b/src/teaching/upp-2025/week10/index.du @@ -1,20 +1,20 @@ -# Задачи - УПП, Седмица 10, 04.12.2025 +'def title Задачи - УПП, Седмица 10, 04.12.2025 +'def desc Условията на задачите за упражнение. -'define expected-reading 12 min -'define created 01 December 2025 -'define edited 03 December 2025 -[$pagenav] +# {title} + +{pagenav 12 min;01 December 2025;03 December 2025} .important -Едно от най-важните неща: [=всяка динамично-заделена памет трябва да се освободи преди края на програмата!=] +Едно от най-важните неща: {b всяка динамично-заделена памет трябва да се освободи преди края на програмата!} -GitHub Classroom: [url https://classroom.github.com/a/kDfmWmy7] +GitHub Classroom: {url https://classroom.github.com/a/kDfmWmy7} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise01.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise01.cpp} Потребителя ще въведе цяло неотрицателно число n. След това ще въведе n на брой реални числа. @@ -22,7 +22,8 @@ GitHub Classroom: [url https://classroom.github.com/a/kDfmWmy7] Няма ограничения върху размера n. -:table_2 +:table +:2 |= Вход |= Изход @@ -33,16 +34,18 @@ GitHub Classroom: [url https://classroom.github.com/a/kDfmWmy7] |: -24 -69 -45 93 -43 89 6 -91 -100 -15 -70 -82 -31.1 37 -53 -12 54 70 -56 86 -91 24 55 40 -19 94 -72 -90 5 91 70.01 57 -59 -59 87 -39 -46 10 -39 59 44 78 -28 63 -22 -98 45 -97 40.8 + ### Задача 2 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise02.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise02.cpp} -Реализирайте функцията [`average`], която приема масив, съставен от цели числа, с произволен размер, и връща средното аритметично на всички тези числа. +Реализирайте функцията {` average}, която приема масив, съставен от цели числа, с произволен размер, и връща средното аритметично на всички тези числа. От входа ще получите размер n и след това 2n на брой цели числа. Използвайки вашата функция, трябва да върнете средното аритметично на тези числа. -:table_2 +:table +:2 |= Вход |= Изход @@ -50,17 +53,19 @@ GitHub Classroom: [url https://classroom.github.com/a/kDfmWmy7] |: -20.125 + ### Задача 3 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise03.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise03.cpp} От входа получавате размерите на матрица, съставена от неотрицателни целочислени стойности, и след това всички стойности в самата матрица. -[=В паметта=] обърнете реда на редовете и изкарайте резултата. +{b В паметта} обърнете реда на редовете и изкарайте резултата. .question Може ли да се направи по по-прост начин, отколкото ако матрицата беше статично-заделена? -:table_2 +:table +:2 |= Вход |= Изход @@ -80,16 +85,18 @@ GitHub Classroom: [url https://classroom.github.com/a/kDfmWmy7] 1 2 3 + ### Задача 4 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise04.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise04.cpp} От входа получавате две матрици и трябва да върнете тяхното умножение (ред по стълб). За всяка матрица, първо получавате две цели неотрицателни стойности, размерите на матрицата, и след това получавате съответния брой реални числа. Ако умножението не е възможно, изкарайте съобщение за грешка. -:table_2 +:table +:2 |= Вход |= Изход @@ -127,19 +134,21 @@ GitHub Classroom: [url https://classroom.github.com/a/kDfmWmy7] Cannot multiply! + ### Задача 5 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise05.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise05.cpp} .note -[*(07.12.2025)*] Оправено условие и пример +{i (07.12.2025)} Оправено условие и пример -Реализирайте функция [`largest`], която приема матрица, съставена от цели числа, с произволни размери, и връща най-големия елемент в нея. +Реализирайте функция {` largest}, която приема матрица, съставена от цели числа, с произволни размери, и връща най-големия елемент в нея. От входа получавате две числа, размери на матрица, и след това всички елементи в матрицата. Използвайки вашата функция, върнете най-голямото число. -:table_2 +:table +:2 |= Вход |= Изход @@ -157,15 +166,17 @@ Cannot multiply! |: 97 + ### Задача 6 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise06.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise06.cpp} От входа получавате цели числа, докато не получите числото 0. Трябва да върнете редицата, където всяко число е равно на сумата на себе си и следващото число. Последното число не го променяйте. -:table_2 +:table +:2 |= Вход |= Изход @@ -176,9 +187,10 @@ Cannot multiply! |: 1292 1284 1266 1300 1291 1280 780 777 0 + ### Задача 7 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise07.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise07.cpp} Змия пълзи върху произволно голяма дъска, разделена на квадратна решетка. Тя започва в клетка (0,0), която ще зачитаме за горния ляв ъгъл на дъската. @@ -190,9 +202,10 @@ Cannot multiply! След това получавате координат в дъската, трябва да върнете дали змията някога е посетила тази клетка. .note -[*(07.12.2025)*] Разменени ред и колона в примерите +{i (07.12.2025)} Разменени ред и колона в примерите -:table_2 +:table +:2 |= Вход |= Изход @@ -215,9 +228,10 @@ Cannot multiply! |: Not visited + ### Задача 8 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise08.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise08.cpp} От входа получавате преплетени елементите в два масива, съдържащи цели числа. Тоест, първия елемент е първи на първия масив, втори елемент е първи на втория масив, третия елемент е втори на първия масив и так. нат. @@ -226,7 +240,8 @@ Cannot multiply! Числото 0 обозначава край на преплетената редица. -:table_2 +:table +:2 |= Вход |= Изход @@ -237,9 +252,10 @@ Cannot multiply! |: 10 1 2 + ### Задача 9 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise09.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise09.cpp} От входа получавате стойностите на "jagged" матрица: такава, където редовете имат различни размери в паметта. Тоест, получавате размер на текущия ред и след това всичките му стойности. @@ -248,7 +264,8 @@ Cannot multiply! Трябва да изкарате, на отделни редове, стойностите във всяка "колона" отгоре надолу, започвайки от последната "колона" към първата. Игнорирайте "дупки" от елементи. -:table_2 +:table +:2 |= Вход |= Изход @@ -269,9 +286,10 @@ Cannot multiply! 1 5 7 3 + ### Задача 10 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise10.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise10.cpp} .important Заемайте възможно най-малко памет! @@ -286,9 +304,10 @@ Cannot multiply! Трябва да върнете елементите по контура (краищата) на часовника, следвайки горното правило. .note -[*(07.12.2025)*] Поправен примера с четния размер +{i (07.12.2025)} Поправен примера с четния размер -:table_2 +:table +:2 |= Вход |= Изход @@ -323,11 +342,12 @@ Cannot multiply! |: 1 2 3 4 5 8 9 0 3 4 5 6 7 2 9 6 + ## За упражнение ### Задача 11 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise11.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise11.cpp} От входа получавате цяло неотрицатлно число n, което обозначава степеннта на полином. След това получавате реалните коефициенти пред всяка степен (започвайки от най-голямата, n). @@ -336,9 +356,10 @@ Cannot multiply! Трябва да върнете дали числото е корен на съответния полином. .note -[*(07.12.2025)*] Поправени примерите с първа степен полином +{i (07.12.2025)} Поправени примерите с първа степен полином -:table_2 +:table +:2 |= Вход |= Изход @@ -367,9 +388,10 @@ Cannot multiply! |: Is a root + ### Задача 12 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise12.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week10/Exercise12.cpp} .important Заемайте възможно най-малко памет! @@ -381,7 +403,8 @@ Cannot multiply! След това получавате индекс и трябва да върнете стойността на съответния елемент. -:table_2 +:table +:2 |= Вход |= Изход @@ -392,6 +415,7 @@ Cannot multiply! |: 0 + ### Задача 13 Магазин продава всеки ден стоки. @@ -400,24 +424,24 @@ Cannot multiply! След това влизате в "потребителски интерфейс", където от входа получавате буква, обозначаваща команда върху дневника. Командите са: .bulleted -- [`e`] обозначава край на програмата -- [`m`], получавате индекс на ден и трябва да върнете максималната продажба в този ден -- [`M`], трябва да върнете индекса на най-печелившия ден +- {` e} обозначава край на програмата +- {` m}, получавате индекс на ден и трябва да върнете максималната продажба в този ден +- {` M}, трябва да върнете индекса на най-печелившия ден -[=Пример:=] [*(вход и изход са смесени, изходът е удебелен)*] +{b Пример:} {i (вход и изход са смесени, изходът е удебелен)} ``` 3 4 0.5 100 19.99 7 0 2 500 8 m 0 -[=100=] +{b 100} m 1 -[=0=] +{b 0} m 2 -[=500=] +{b 500} M -[=2=] +{b 2} e ### Задача 14 @@ -435,7 +459,8 @@ e След това, от входа получавате ред и колона. Трябва да изкарате матрицата, без съответния ред и стълб. -:table_2 +:table +:2 |= Вход |= Изход diff --git a/src/teaching/upp-2025/week11/index.du b/src/teaching/upp-2025/week11/index.du index a381246..b88bd75 100644 --- a/src/teaching/upp-2025/week11/index.du +++ b/src/teaching/upp-2025/week11/index.du @@ -1,18 +1,18 @@ -# Задачи - УПП, Седмица 11, 11.12.2025 +'def title Задачи - УПП, Седмица 11, 11.12.2025 +'def desc Условията на задачите за упражнение. -'define expected-reading 7 min -'define created 10 December 2025 -'define edited 14 December 2025 -[$pagenav] +# {title} + +{pagenav 7 min;10 December 2025;14 December 2025} :question Има два начина да приемем низ от входа: -```c++ +```cpp cin.getline(char*, size_t, char); -```c++ +```cpp cin.get(char&); Кога бихме избрали всеки от тях? @@ -24,12 +24,13 @@ GitHub Classroom: [url https://classroom.github.com/a/z_C3UMi8] ### Задача 1 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise01.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise01.cpp} От входа получавате 20 буквен низ: име. -Трябва да изкарате съобщението "Hello [*[име]*]!" +Трябва да изкарате съобщението "Hello {i [име]}!" -:table_2 +:table +:2 |= Вход |= Изход @@ -40,14 +41,16 @@ GitHub Classroom: [url https://classroom.github.com/a/z_C3UMi8] |: Hello Aleksandur! + ### Задача 2 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise02.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise02.cpp} От входа получавате изречение: низ, завършващ на точка. Трябва да изкарате броя букви (малки или големи) в изречението. -:table_2 +:table +:2 |= Вход |= Изход @@ -58,9 +61,10 @@ GitHub Classroom: [url https://classroom.github.com/a/z_C3UMi8] |: 10 + ### Задача 3 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise03.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise03.cpp} От входа получавате изречение: низ, завършващ на точка. Трябва да изкарате броя полета в низа. @@ -69,31 +73,33 @@ GitHub Classroom: [url https://classroom.github.com/a/z_C3UMi8] Изключвайте крайната точка в бройката на полетата. .note -[*(14.12.2025)*] Добавени точки в края на изреченията. +{i (14.12.2025)} Добавени точки в края на изреченията. -:table_2 +:table +:2 |= Вход |= Изход -|: [`first second third fourth.`] +|: {` first second third fourth.} |: 4 -|: [`I'm glad you're here.`] +|: {` I'm glad you're here.} |: 4 -|: [` a b c d 8 k * * .`] +|: {` a b c d 8 k * * .} |: 8 ### Задача 4 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise04.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise04.cpp} От входа получавате текст, докато не срещнете първия празен ред. Трябва да изкарате броя редове в текста. -:table_2 +:table +:2 |= Вход |= Изход @@ -115,14 +121,16 @@ trail led eastward through the fat spruce timberland.\n |: 4 + ### Задача 5 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise05.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise05.cpp} От входа получавате низ, завършващ на двоеточие и след това две реални числа. За всяко срещане на думата "sum" в низа, трябва да изкарате сумата на числата, и за всяко срещане на "sub" в низа, трябва да изкарате разликата на числата. -:table_2 +:table +:2 |= Вход |= Изход @@ -139,19 +147,21 @@ trail led eastward through the fat spruce timberland.\n |: 3 -1 3 + ### Задача 6 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise06.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise06.cpp} От входа получавате ред, обозначаващ число в 16-тича бройна система. -Тоест, реда започва с [`0x`] и останалото са 16-тични цифри. +Тоест, реда започва с {` 0x} и останалото са 16-тични цифри. -Трябва да изкарате стойността на числото в 10-тична бройна система, [=като направите конвертирането ръчно!=] -Тоест [=не е позволено да използвате функционалност от стандартната библиотека!=] +Трябва да изкарате стойността на числото в 10-тична бройна система, {b като направите конвертирането ръчно!} +Тоест {b не е позволено да използвате функционалност от стандартната библиотека!} -Приемете, че буквите A-F са главни и че няма да имате водещи нули (напр. [`0x0001`]). +Приемете, че буквите A-F са главни и че няма да имате водещи нули (напр. {` 0x0001}). -:table_2 +:table +:2 |= Вход |= Изход @@ -180,14 +190,16 @@ trail led eastward through the fat spruce timberland.\n |: 1597463007 + ### Задача 7 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise07.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise07.cpp} От входа получавате 5 буквен низ и след това един ред текст. Трябва да изкарате всички срещания на първия низ във втория (като препокривания са позволени). -:table_2 +:table +:2 |= Вход |= Изход @@ -206,16 +218,18 @@ aaaaaaaaaaaaaaaaaaaa |: 16 + ### Задача 8 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise08.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise08.cpp} От входа получавате букви, докато не срещнете низа "end". Трябва да изкарате всички полета в обратен ред. Поле наричаме всяка последователност от букви, която не съдържа шпация. -:table_2 +:table +:2 |= Вход |= Изход @@ -226,14 +240,16 @@ aaaaaaaaaaaaaaaaaaaa |: weekend the on free is he said They + ### Задача 9 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise09.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise09.cpp} От входа получавате две полета, съставени от главни и малки латински букви. Трябва да върнете общата бройка срещания на всяка буква от второто поле в първото. -:table_2 +:table +:2 |= Вход |= Изход @@ -244,16 +260,18 @@ aaaaaaaaaaaaaaaaaaaa |: 0 + ## За упражнение ### Задача 10 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise10.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise10.cpp} От входа получавате ред с текст. -Трябва да върнете дали е [url https://bg.wikipedia.org/wiki/%D0%9F%D0%B0%D0%BD%D0%B3%D1%80%D0%B0%D0%BC%D0%B0 панграма] на латинската азбука: дали всяка буква се среща поне веднъж (без значение дали е главна или малка). +Трябва да върнете дали е {url панграма;https://bg.wikipedia.org/wiki/%D0%9F%D0%B0%D0%BD%D0%B3%D1%80%D0%B0%D0%BC%D0%B0} на латинската азбука: дали всяка буква се среща поне веднъж (без значение дали е главна или малка). -:table_2 +:table +:2 |= Вход |= Изход @@ -267,14 +285,16 @@ aaaaaaaaaaaaaaaaaaaa |: Not a pangram + ### Задача 11 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise11.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise11.cpp} От входа получавате два реда. Трябва да премахнете всяко срещане на втория ред в първия и да изкарате резултата. -:table_2 +:table +:2 |= Вход |= Изход @@ -297,9 +317,10 @@ buffalo Buffalo Buffalo Buffalo + ### Задача 12 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise12.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise12.cpp} От входа получавате ред с текст. Зачитайки го за парола, трябва да върнете колко силна е паролата. @@ -315,9 +336,10 @@ Buffalo Buffalo Buffalo Накрая тряба да върнете оценката на паролата. .note -[*(14.12.2025)*] Оправени оценки в примерите +{i (14.12.2025)} Оправени оценки в примерите -:table_2 +:table +:2 |= Вход |= Изход @@ -334,12 +356,13 @@ Buffalo Buffalo Buffalo |: 5 + ### Задача 13 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise13.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise13.cpp} Хешираща функция е функция, която превръща низ в число. -Една много често използвана е функцията на [url https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function Fowler-Noll-Vo]. +Една много често използвана е функцията на {url Fowler-Noll-Vo;https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function}. Тя работи по следния начин: .bulleted @@ -352,36 +375,39 @@ Buffalo Buffalo Buffalo Използвайки 32-битовите offset basis (2166136261) и FNV простото число (16777619), изкарайте хешираната стойност на подадения ред текст. .note -[*(14.12.2025)*] Поправен хеш на последния пример. +{i (14.12.2025)} Поправен хеш на последния пример. -:table_2 +:table +:2 |= Вход |= Изход -|: [`Hello World`] +|: {` Hello World} |: 310551791 -|: [`Nothing`] +|: {` Nothing} |: 383317984 -|: [`!`] +|: {` !} |: 84696382 -|: [`The most effective debugging tool is still careful thought, coupled with judiciously placed print statements.`] +|: {` The most effective debugging tool is still careful thought, coupled with judiciously placed print statements.} |: 2408366471 + ### Задача 14 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise14.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week11/Exercise14.cpp} От входа получавате два реда с текст. -Трябва да върнете дали първия ред е [url https://en.wikipedia.org/wiki/Anagram анаграма] на втория, +Трябва да върнете дали първия ред е {url анаграма;https://en.wikipedia.org/wiki/Anagram} на втория, тоест дали втория низ може да се получи след някакво разместване на всички (латински) букви в първия низ. Игнорирайте дали буквата е главна или малка. -:table_2 +:table +:2 |= Вход |= Изход @@ -421,12 +447,13 @@ I am Lord Voldemort |: Anagram + ## За любознателните ### Задача 15 От входа получавате два реда с текст. -Трябва да пресметнете [url https://en.wikipedia.org/wiki/Levenshtein_distance разстоянието на Ливенщайн] между тях. +Трябва да пресметнете {url разстоянието на Ливенщайн;https://en.wikipedia.org/wiki/Levenshtein_distance} между тях. То се пресмята така: .numbered diff --git a/src/teaching/upp-2025/week12/index.du b/src/teaching/upp-2025/week12/index.du index 5fc86b8..1d1ff4d 100644 --- a/src/teaching/upp-2025/week12/index.du +++ b/src/teaching/upp-2025/week12/index.du @@ -1,19 +1,19 @@ -# Задачи - УПП, Седмица 12, 18.12.2025 +'def title Задачи - УПП, Седмица 12, 18.12.2025 +'def desc Условията на задачите за упражнение. -'define expected-reading 14 min -'define created 17 December 2025 -'define edited 23 December 2025 -[$pagenav] +# {title} -GitHub Classroom: [url https://classroom.github.com/a/zvYPAVPS] +{pagenav 14 min;17 December 2025;23 December 2025} + +GitHub Classroom: {url https://classroom.github.com/a/zvYPAVPS} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week12/Exercise01.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week12/Exercise01.cpp} -[url https://en.wikipedia.org/wiki/Caesar_cipher Шифъра на Цезар] е античен шифър, при който всяка буква от азбуката се отмества и замества. +{url Шифъра на Цезар;https://en.wikipedia.org/wiki/Caesar_cipher} е античен шифър, при който всяка буква от азбуката се отмества и замества. Например, при отместване от 3, A става D, B става E, Z става C и така нататък. От входа получавате един ред с текст на английски, който е шифриран с шифъра на Цезар. @@ -24,7 +24,8 @@ GitHub Classroom: [url https://classroom.github.com/a/zvYPAVPS] Игнорирайте дали буквите са главни или малки във вашите проверки по време на дешифриране. -:table_2 +:table +:2 |= Вход |= Изход @@ -38,9 +39,10 @@ GitHub Classroom: [url https://classroom.github.com/a/zvYPAVPS] |: DAY HAD DAWNED COLD AND GRAY WHEN the man turned aside from the main Yukon trail + ### Задача 2 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week12/Exercise02.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week12/Exercise02.cpp} От входа получавате един ред текст. След това получавате положително число: брой колони (където всяка една колона съдържа един знак). @@ -50,7 +52,8 @@ GitHub Classroom: [url https://classroom.github.com/a/zvYPAVPS] С други думи, не може да разделяте думи (полета) на повече от един ред! Ако има поле, което е по-дълго от броя колони, то ще запълни цял ред и ще "прелее" извън броя колони. -:table_2 +:table +:2 |= Вход |= Изход @@ -104,26 +107,28 @@ sky. It was a clear day. + ### Задача 3 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week12/Exercise03.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week12/Exercise03.cpp} От входа получавате две полета (низове, които не съдържат шпации). След това получавате положително число: брой колони (където една колона съдържа един знак). Трябва да разположите двете полета в колоните така, че разстоянието между полетата и разтоянията между всяко поле и краищата са еднакви. -С други думи, ако сме получили [`Hello`], [`World`] и 25 колони, трябва да изкараме следния низ (където [`|`] обграждат всичките колони): +С други думи, ако сме получили {` Hello}, {` World} и 25 колони, трябва да изкараме следния низ (където {` |} обграждат всичките колони): ``` | Hello World | -Разстоянието между [`|`] и [`H`] е същото като между [`o`] и [`W`], и между [`d`] и [`|`], а иммено 5 шпации. +Разстоянието между {` |} и {` H} е същото като между {` o} и {` W}, и между {` d} и {` |}, а иммено 5 шпации. Когато разстоянията не могат да са точни, трябва или средното да е по-късото, или и двата края да са по-къси. Ако буквите в думите са повече от броя колоните, тогава изкарайте думите слепени. -:table_2 +:table +:2 |= Вход |= Изход @@ -158,22 +163,24 @@ Loremipsum Lorem ipsum + ### Задача 4 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week12/Exercise04.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week12/Exercise04.cpp} От входа получавате едно поле (последователност от букви, която не съдържа шпация). Трябва да върнете типа на полето, спрямо тези правила: .ordered -1. [=Тип "integer":=] може да започне с [`+`] или [`-`] и всички останали букви са цифри -2. [=Тип "float":=] може да започне с [`+`] или [`-`] и след това съдържа цифри и точка, която точка трябва да се намира между цифри (т.е. не е преди или след всички цифри) -3. [=Тип "word":=] ако съдържа само латински букви (главни или малки) -4. [=Тип "time":=] може да започне или завърши с "AM" или "PM", след това (допускайки че е започва с низа) съдържа 1-2 цифри (часа), които са между 0 и 24 вкл., знака двоеточие [`:`] и накрая завършва на две цифри (минутите), които са между 0 и 59 вкл. -5. [=Тип "percentage":=] започва с поне една цифра, като след първите цифри може да има точка и още цифри, и накрая завършва на знака [`%`] -6. [=Тип "other"=], когато не можем да го свържем с никое от горните правила +1. {b Тип "integer":} може да започне с {` +} или {` -} и всички останали букви са цифри +2. {b Тип "float":} може да започне с {` +} или {` -} и след това съдържа цифри и точка, която точка трябва да се намира между цифри (т.е. не е преди или след всички цифри) +3. {b Тип "word":} ако съдържа само латински букви (главни или малки) +4. {b Тип "time":} може да започне или завърши с "AM" или "PM", след това (допускайки че е започва с низа) съдържа 1-2 цифри (часа), които са между 0 и 24 вкл., знака двоеточие {` :} и накрая завършва на две цифри (минутите), които са между 0 и 59 вкл. +5. {b Тип "percentage":} започва с поне една цифра, като след първите цифри може да има точка и още цифри, и накрая завършва на знака {` %} +6. {b Тип "other"}, когато не можем да го свържем с никое от горните правила -:table_2 +:table +:2 |= Вход |= Изход @@ -229,6 +236,7 @@ Lorem ipsum |: other + ### Задача 5 От входа получавате две положителни цели числа: месец и година. @@ -244,7 +252,8 @@ Mo Tu We Th Fr Sa Su Като дните трябва да са коректно подравнени. -:table_2 +:table +:2 |= Вход |= Изход @@ -289,13 +298,14 @@ Mo Tu We Th Fr Sa Su 24 25 26 27 28 29 + ## За самоподготовка ### Задача 6 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week12/Exercise06.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week12/Exercise06.cpp} -Модерните текстови редактори са визуални редактори: редактираш текста, който едновременно виждаш (подобно на лист хартия). Предшественик на тези редактори са [url https://en.wikipedia.org/wiki/Line_editor редовите редактори]: пускаш редица команди, всяка от които променя текста по някакъв начин. +Модерните текстови редактори са визуални редактори: редактираш текста, който едновременно виждаш (подобно на лист хартия). Предшественик на тези редактори са {url редовите редактори;https://en.wikipedia.org/wiki/Line_editor}: пускаш редица команди, всяка от които променя текста по някакъв начин. Минуса е, че не нямаш курсор с който да правиш промените директно, това да видиш текста и да го редактираш са отделни команди, които трябва да изписваш всеки път. Плюса е, че реализацията е много по-проста и лесно се правят автоматизации/скриптове. @@ -306,7 +316,7 @@ Mo Tu We Th Fr Sa Su Трябва да изпълните всяка команда или да изкарате съобщение за грешка, ако командата е невалидна. .question -За любознателните: дизайна на този редактор е базиран на [url https://www.gnu.org/software/ed/manual/ed_manual.html ed] +За любознателните: дизайна на този редактор е базиран на {url ed;https://www.gnu.org/software/ed/manual/ed_manual.html} #### Обсег и текущия ред @@ -324,17 +334,17 @@ Mo Tu We Th Fr Sa Su Обсега за един ред е една от 3 типа стойности: .numbered 1. цяло число (последователност от цифри), която определя реда в текущия текст -2. [`.`], което обозначава текущия ред -3. [`$`], което обозначава последния ред във файла +2. {` .}, което обозначава текущия ред +3. {` $}, което обозначава последния ред във файла -Ако въведем [=само=] обсег за един ред, то това обновява текущия ред. +Ако въведем {b само} обсег за един ред, то това обновява текущия ред. -Имаме и обсег за няколко реда, който е във формата [`начало,край`]. -[`начало`] и [`край`] са в същия формат като обсега за един ред. +Имаме и обсег за няколко реда, който е във формата {` начало,край}. +{` начало} и {` край} са в същия формат като обсега за един ред. Тоест, това са два обсега за един ред, слепени със запетая. -[`начало`] може да бъде пропуснато, в който случай по подразбиране е 1 (първия ред). -[`край`] може да бъде пропуснато, в който случай по подразбиране е [`$`] (последния ред). +{` начало} може да бъде пропуснато, в който случай по подразбиране е 1 (първия ред). +{` край} може да бъде пропуснато, в който случай по подразбиране е {` $} (последния ред). Трябва да върнете съобщение за грешка, ако е подаден невалиден обсег за текущия текст. @@ -344,19 +354,19 @@ Mo Tu We Th Fr Sa Su Това са всички команди: .numbered -1. [`p`] - изкарва редовете в обсега -2. [`n`] - изкарва редовете в обсега, като преди всеки е поставен неговия номер на реда -3. [`d`] - изтрива редовете в обсега -4. [`а`] - добавя текст [=след=] всеки ред в обсега -5. [`i`] - добавя текст [=преди=] всеки ред в обсега -6. [`q`] - прекратява програмата +1. {` p} - изкарва редовете в обсега +2. {` n} - изкарва редовете в обсега, като преди всеки е поставен неговия номер на реда +3. {` d} - изтрива редовете в обсега +4. {` а} - добавя текст {b след} всеки ред в обсега +5. {` i} - добавя текст {b преди} всеки ред в обсега +6. {` q} - прекратява програмата -Буквите, след командите [`a`] и [`i`] са текста, който трябва да бъде вмъкнат. +Буквите, след командите {` a} и {` i} са текста, който трябва да бъде вмъкнат. Може да се вмъкне само по един ред текст. -След въвеждане на ред чрез [`a`] или [`i`], текущия ред автоматично се обновява на ново-добавения ред. +След въвеждане на ред чрез {` a} или {` i}, текущия ред автоматично се обновява на ново-добавения ред. -След изтриване на ред чрез [`d`], трябва да обновите текущия ред, само когато има смисъл. +След изтриване на ред чрез {` d}, трябва да обновите текущия ред, само когато има смисъл. Например, ако текущия ред е 10 и изтриете ред 20, няма нужда от промяна. Ако текущия ред е 10 и изтриете редове 2 и 3, тогава текущия ред трябва да се намали с броя изтрите редове, а имменно, с 2, от 10 на 8. @@ -365,24 +375,27 @@ Mo Tu We Th Fr Sa Su Вход и изход не са смесени. Наклонения текст е допълнителен коментар на това, което се случва (тоест, вие не трябва да го подавате на вашата програма). -[=Вход 1:=] +{b Вход 1:} ``` +'emplace aThe man looked along the way he had come. aThe Yukon lay a mile wide and hidden under three feet of ice. aOn top of this ice were as many feet of snow. It was all pure white. ,p q +'endemplace -[=Изход 1:=] +{b Изход 1:} ``` The man looked along the way he had come. The Yukon lay a mile wide and hidden under three feet of ice. On top of this ice were as many feet of snow. It was all pure white. -[$br1] +{br1} -[=Вход 2:=] +{b Вход 2:} ``` +'emplace aThe Yukon lay a mile wide and hidden under three feet of ice. iThe man looked along the way he had come. $aOn top of this ice were as many feet of snow. It was all pure white. @@ -393,25 +406,27 @@ p ,i ,p q +'endemplace -[=Изход 2:=] +{b Изход 2:} ``` -[*Изход от ",2n"*] +{i Изход от ",2n"} 1 The man looked along the way he had come. 2 The Yukon lay a mile wide and hidden under three feet of ice. -[*Изход от първото "p"*] +{i Изход от първото "p"} On top of this ice were as many feet of snow. It was all pure white. -[*Изход от второто "p"*] +{i Изход от второто "p"} The Yukon lay a mile wide and hidden under three feet of ice. -[*Изход от ",p"*]\n +{i Изход от ",p"}\n The man looked along the way he had come.\n The Yukon lay a mile wide and hidden under three feet of ice.\n On top of this ice were as many feet of snow. It was all pure white. -[$br1] +{br1} -[=Вход 3:=] +{b Вход 3:} ``` +'emplace aNorth and south, as far as his eye could see, ait was unbroken white. aThe one thing that relieved @@ -428,30 +443,31 @@ icurved from the pine-covered .n ,p q +'endemplace -[=Изход 3:=] +{b Изход 3:} .note -[=(23.12.2025)=] Поправен този изход +{b (23.12.2025)} Поправен този изход ``` -[*Изход от "3,5p"*] +{i Изход от "3,5p"} The one thing that relieved the whiteness was a thin dark line that cruved from the pine-covered -[*Изход от ",n"*] +{i Изход от ",n"} 1 North and south, as far as his eye could see, 2 it was unbroken white. 3 The one thing that relieved 4 the whiteness was a thin dark line that 5 island to the south. -[*Изход от ".,$p"*] +{i Изход от ".,$p"} curved from the pine-covered the whiteness was a thin dark line that island to the south. -[*Изход от ".n"*] +{i Изход от ".n"} 3 curved from the pine-covered -[*Изход от ",p"*] +{i Изход от ",p"} The one thing that relieved the whiteness was a thin dark line that curved from the pine-covered diff --git a/src/teaching/upp-2025/week13/index.du b/src/teaching/upp-2025/week13/index.du index 1ff00e7..d8edf79 100644 --- a/src/teaching/upp-2025/week13/index.du +++ b/src/teaching/upp-2025/week13/index.du @@ -1,25 +1,26 @@ -# Задачи - УПП, Седмица 13, 08.01.2026 +'def title Задачи - УПП, Седмица 13, 08.01.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 15 min -'define created 05 January 2025 -'define edited 08 January 2025 -[$pagenav] +# {title} + +{pagenav 15 min;05 January 2025;08 January 2025} .important Използвайте рекурсия, за да решите всички тези задачи! -GitHub Classroom: [url https://classroom.github.com/a/8vTquPOY] +GitHub Classroom: {url https://classroom.github.com/a/8vTquPOY} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise01.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise01.cpp} Реализирайте програма, която по подаден положителен размер изкарва "стълбище" от плюсове. .warn Както с всички останали задачи, решете условието с рекурсия! -:table_2 +:table +:2 |= Вход |= Изход @@ -50,17 +51,19 @@ GitHub Classroom: [url https://classroom.github.com/a/8vTquPOY] +++++++ + ### Задача 2 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise02.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise02.cpp} -Припомняме, че в [url https://en.wikipedia.org/wiki/Fibonacci_sequence редицата на Фибоначи], всеки следвавщ елемент е сумата на предходните два, като първите два елемента са 0 и 1. +Припомняме, че в {url редицата на Фибоначи;https://en.wikipedia.org/wiki/Fibonacci_sequence}, всеки следвавщ елемент е сумата на предходните два, като първите два елемента са 0 и 1. От входа получавате неотрицателен индекс, трябва да изкарате съответното число на Фибоначи. .warn Както с всички останали задачи, решете условието с рекурсия! -:table_2 +:table +:2 |= Вход |= Изход @@ -86,16 +89,18 @@ GitHub Classroom: [url https://classroom.github.com/a/8vTquPOY] |: 3524578 + ### Задача 3 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise03.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise03.cpp} От входа получавате цяло неотрицателно число. Изкарайте сумата на всички негови цифри. .warn Както с всички останали задачи, решете условието с рекурсия! -:table_2 +:table +:2 |= Вход |= Изход @@ -109,14 +114,16 @@ GitHub Classroom: [url https://classroom.github.com/a/8vTquPOY] |: 38 + ### Задача 4 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise04.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise04.cpp} От входа получавате един ред с текст. Трябва да обърнете реда на всички букви в текста и да изкарате резултата. -:table_2 +:table +:2 |= Вход |= Изход @@ -134,17 +141,19 @@ He should not have built the fire under the pine tree. |: ``` -.eert enip eht rednu erif eht tliub evah ton dluohs eH +\.eert enip eht rednu erif eht tliub evah ton dluohs eH + ### Задача 5 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise05.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise05.cpp} От входа получавате цяло неотрицателно число. Изкарайте "хълм" от плюсове с размер, подаденото число. -:table_2 +:table +:2 |= Вход |= Изход @@ -184,16 +193,18 @@ He should not have built the fire under the pine tree. + + ### Задача 6 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise06.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise06.cpp} -Напишете рекурентна функция, която по подадени две цели числа [`a`] и [`b`], връща сумата [=и=] средното аритметично на всички числа между [`a`] и [`b`], включително. +Напишете рекурентна функция, която по подадени две цели числа {` a} и {` b}, връща сумата {b и} средното аритметично на всички числа между {` a} и {` b}, включително. От входа получавате две цели числа. -Използвайки вашата функция, изкарайте сумата и средното аритметично на всички цели числа в интервала [`[a, b]`]. +Използвайки вашата функция, изкарайте сумата и средното аритметично на всички цели числа в интервала {` [a, b]}. -:table_2 +:table +:2 |= Вход |= Изход @@ -204,14 +215,16 @@ He should not have built the fire under the pine tree. |: 69 3 + ### Задача 7 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise07.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise07.cpp} От входа получавате неотрицателно цяло число - брой битове. Изкарайте всички възможни двоични числа, съставени от броя битове. -:table_2 +:table +:2 |= Вход |= Изход @@ -236,17 +249,19 @@ He should not have built the fire under the pine tree. 111 + ### Задача 8 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise08.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise08.cpp} От входа получавате неотрицателен индекс, трябва да изкарате преплетената поредица от числа на Фибоначи, от първото до това на подадения индекс. По-точно, трябва резултатните елементи на четните индекси да представляват редицата на Фибоначи в нарастващ ред, и тези на нечетните индекси да са същата редица в намаляващ ред. .warn -Изполвайте [=само=] едно начално извикване на рекурентната ви функция. +Изполвайте {b само} едно начално извикване на рекурентната ви функция. -:table_2 +:table +:2 |= Вход |= Изход @@ -260,14 +275,16 @@ He should not have built the fire under the pine tree. |: 0 0 + ### Задача 9 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise09.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise09.cpp} От входа получавате низ, съставен само и единствено от отварящи и затварящи кръгли скоби. Трябва да върнете дали скобите са балансирани, т.е. дали след всяка отваряща скоба, съществува "нейна си" затаваряща скоба, по-нататък в низа. -:table_2 +:table +:2 |= Вход |= Изход @@ -302,16 +319,18 @@ He should not have built the fire under the pine tree. |: Balanced + ### Задача 10 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise10.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise10.cpp} -Използвайки [=опашкова рекурсия=], имплементирайте функция която приема масив от реални числа и връща сумата на всички тях. +Използвайки {b опашкова рекурсия}, имплементирайте функция която приема масив от реални числа и връща сумата на всички тях. От входа получавате неотрицателно число N и след това N на брой реални числа. Използвайки вашата функция, изкарайте сумата на всички реални числа. -:table_2 +:table +:2 |= Вход |= Изход @@ -322,17 +341,19 @@ He should not have built the fire under the pine tree. |: 141.83 + ### Задача 11 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise11.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise11.cpp} -Напишете програма, която решава [url https://en.wikipedia.org/wiki/Ages_of_Three_Children_puzzle пъзела с възрастта на трите деца]. +Напишете програма, която решава {url пъзела с възрастта на трите деца;https://en.wikipedia.org/wiki/Ages_of_Three_Children_puzzle}. В пъзела знаете сумата на възрастите на трите деца, умножението на възрастите, както и факта, че едно от децата е най-голямо. От входа получавате две положителни числа: сумата и произведението на възрастите. Трябва да изкарате резултата: -:table_2 +:table +:2 |= Вход |= Изход @@ -343,17 +364,19 @@ He should not have built the fire under the pine tree. |: 2 2 9 + ### Задача 12 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise12.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise12.cpp} От входа получавате неотрицателно число N и след това N на брой цели числа. -Трябва да изкарате дължината на най-дългата [=строго нарастваща=] подредица (под-последователност) от числа. +Трябва да изкарате дължината на най-дългата {b строго нарастваща} подредица (под-последователност) от числа. .note -[*(11.01.2026)*] Поправени примери +{i (11.01.2026)} Поправени примери -:table_2 +:table +:2 |= Вход |= Изход @@ -373,11 +396,12 @@ He should not have built the fire under the pine tree. |: 6 + ### Задача 13 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise13.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise13.cpp} -Напишете програма, която решава [url https://en.wikipedia.org/wiki/Takuzu Такузу пъзели]. +Напишете програма, която решава {url Такузу пъзели;https://en.wikipedia.org/wiki/Takuzu}. Пъзлите са формулирани така: в дъска 4 на 4 трябва да се попълнят нули и единици, така че на всяка колона и ред да има еднакъв брой нули и единици. Допълнително, на всеки ред и колона, не може да има повече от две последователни еднакви числа. @@ -385,7 +409,8 @@ He should not have built the fire under the pine tree. От входа получавате нерешен такузу пъзел, където "празните" позиции са маркирани с -1. Трябва да изкарате решение на пъзела. -:table_2 +:table +:2 |= Вход |= Изход @@ -432,21 +457,23 @@ He should not have built the fire under the pine tree. 1 1 0 0 + ## За упражнение ### Задача 14 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise14.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise14.cpp} -Един от най-простите алгоритми за псевдо-случайни числа е [url https://en.wikipedia.org/wiki/Lehmer_random_number_generator генератора на Лемер]. -Започвайки от "seed" [`X[_0_]`], всяко следващо случайно число [`X[_k+1_]`] е равно на [`(a * X[_k_]) mod m`], където [`а`] и [`m`] са константи. +Един от най-простите алгоритми за псевдо-случайни числа е {url генератора на Лемер;https://en.wikipedia.org/wiki/Lehmer_random_number_generator}. +Започвайки от "seed" {` X{_ 0}}, всяко следващо случайно число {` X{_ k+1}} е равно на {` (a * X{_ k}) mod m}, където {` а} и {` m} са константи. -Нека да фиксираме [`a = 16807`] и [`m = 2[^31^] - 1`]. -От входа получавате две положителни цели числа: "seed" и бройка [`N`]. +Нека да фиксираме {` a = 16807} и {` m = 2{^ 31} - 1}. +От входа получавате две положителни цели числа: "seed" и бройка {` N}. -Трябва да изкарате всички произволни числа [`X[_1_]`] до [`X[_N_]`]. +Трябва да изкарате всички произволни числа {` X{_ 1}} до {` X{_ N}}. -:table_2 +:table +:2 |= Вход |= Изход @@ -460,25 +487,27 @@ He should not have built the fire under the pine tree. |: 16807 282475249 1622647863 947787490 1578127215 + ### Задача 15 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise15.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise15.cpp} Във физиката, можем да определим позицията на едно тяло по елиптична (Кеплерова) орбита чрез екцентричната аномалия. Обаче, на практика тя не се намира директно, ами се изчисляват средната аномалия и ексцентрицитетът на елипсата. -Чрез [url https://en.wikipedia.org/wiki/Kepler%27s_equation уравнението на Кеплер], можем да изведем следната рекурентна връзка за екцентричната аномалия: +Чрез {url уравнението на Кеплер;https://en.wikipedia.org/wiki/Kepler%27s_equation}, можем да изведем следната рекурентна връзка за екцентричната аномалия: -[image ./img/eccentric-anomaly.png] +{img ./img/eccentric-anomaly.png} -Където [`M`] е средната аномалия и [`e`] е ексцентрицитетът на елипсата. -От входа получавате две реални числа, [`M`] и [`e`], както и цяло положително число "дълбочина". +Където {` M} е средната аномалия и {` e} е ексцентрицитетът на елипсата. +От входа получавате две реални числа, {` M} и {` e}, както и цяло положително число "дълбочина". Трябва да върнете (приближение на) екцентричната аномалия, като рекурсията ви трябва да се "вложи" максимум "дълбочина" на брой пъти. -За дъно на рекурсията, може да върнете стойността [`M`]. -Използвайте [`<cmath>`] за синус функцията. +За дъно на рекурсията, може да върнете стойността {` M}. +Използвайте {` <cmath>} за синус функцията. -:table_2 +:table +:2 |= Вход |= Изход @@ -492,16 +521,18 @@ He should not have built the fire under the pine tree. |: 1.42528 + ### Задача 16 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise16.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise16.cpp} От входа получавате две неотрицателни цели числа. -Изкарайте техния най-голям общ делител, използвайки [url https://en.wikipedia.org/wiki/Euclidean_algorithm алгоритъма на Евклид]: +Изкарайте техния най-голям общ делител, използвайки {url алгоритъма на Евклид;https://en.wikipedia.org/wiki/Euclidean_algorithm}: -[image ./img/gcd-euclid.png] +{img ./img/gcd-euclid.png} -:table_2 +:table +:2 |= Вход |= Изход @@ -515,14 +546,16 @@ He should not have built the fire under the pine tree. |: 1 + ### Задача 17 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise17.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise17.cpp} От входа получавате един ред с текст. Трябва да изкарате дали текста е палиндром. -:table_2 +:table +:2 |= Вход |= Изход @@ -539,14 +572,16 @@ racecar racecar |: Is a palindrome + ### Задача 18 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise18.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise18.cpp} От входа получавате цяло неотрицателно число и цифра, между 1 и 9. Трябва да изкарате бройката срещания на цифрата в числото. -:table_2 +:table +:2 |= Вход |= Изход @@ -560,18 +595,20 @@ racecar racecar |: 4 + ### Задача 19 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise19.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise19.cpp} Един от начините да изчислим стойността на биномен коефициент е чрез следната рекурентна връзка: -[image ./img/binom.png] +{img ./img/binom.png} -От входа получавате две неотрицателни цели числа [`n`] и [`k`]. +От входа получавате две неотрицателни цели числа {` n} и {` k}. Трябва да изкарате съответния биномен коефициент, използвайки рекурентната връзка. -:table_2 +:table +:2 |= Вход |= Изход @@ -585,11 +622,13 @@ racecar racecar |: 1 + ### Задача 20 Напишете програма, която "изиграва" всички възможни игри на морски шах и връща в колко тях някой печели и в колко от тях никой не печели. -:table_2 +:table +:2 |= Вход |= Изход @@ -598,21 +637,23 @@ racecar racecar .comment Source: http://www.se16.info/hgb/tictactoe.htm + ### Задача 21 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise21.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise21.cpp} -[url https://en.wikipedia.org/wiki/Levenshtein_distance Разстоянието на Ливенщайн] е метод за измерване на разликата между два низа. +{url Разстоянието на Ливенщайн;https://en.wikipedia.org/wiki/Levenshtein_distance} е метод за измерване на разликата между два низа. Смята се по следния начин: -[image ./img/levenshtein.png] +{img ./img/levenshtein.png} -Където с [`x[1..]`] бележим остатък от низа [`x`], след първата буква. +Където с {` x[1..]} бележим остатък от низа {` x}, след първата буква. От входа получавате два реда с текст. Трябва да върнете разстоянието на Ливенщайн между тях. -:table_2 +:table +:2 |= Вход |= Изход @@ -638,18 +679,20 @@ Winterland |: 1 + ### Задача 22 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise22.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise22.cpp} -Аритметико-геометричното на две числа [`a`] и [`b`] се дефинира чрез следната рекурентна връзка: +Аритметико-геометричното на две числа {` a} и {` b} се дефинира чрез следната рекурентна връзка: -[image ./img/agm.png] +{img ./img/agm.png} -От входа получавате две реални числа, [`a`] и [`b`], и брой итерации [`n`]. -Изкарайте резултатното аритметико-геометрично число, като за дъно на рекурсията можете да върнете [`a[_n+1_]`]. +От входа получавате две реални числа, {` a} и {` b}, и брой итерации {` n}. +Изкарайте резултатното аритметико-геометрично число, като за дъно на рекурсията можете да върнете {` a{_ n+1}}. -:table_2 +:table +:2 |= Вход |= Изход @@ -663,16 +706,18 @@ Winterland |: 0.189868 + ### Задача 23 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise23.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise23.cpp} -Използвайки [=опашкова рекурсия=], напишете функция, която получава масив от цели числа и връща най-големия елемент от тях. +Използвайки {b опашкова рекурсия}, напишете функция, която получава масив от цели числа и връща най-големия елемент от тях. -От входа получавате неотрицателно цяло [`N`] и след това [`N`] на брой цели числа. +От входа получавате неотрицателно цяло {` N} и след това {` N} на брой цели числа. Използвайки вашата функция, изкарайте най-голямото число. -:table_2 +:table +:2 |= Вход |= Изход @@ -683,19 +728,21 @@ Winterland |: 1 + ### Задача 24 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise24.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week13/Exercise24.cpp} Чрез бездънни дроби можем да представим редица функции/изрази, за които няма точна формула. -От входа получавате реално число [`x`] и дълбочина [`n`], върнете [`e[^x^]`] използвайки: +От входа получавате реално число {` x} и дълбочина {` n}, върнете {` e{^ x}} използвайки: -[image ./img/eulers_identity.png] +{img ./img/eulers_identity.png} Като, всеки "етаж" от дробта е единица дълбочина (и първото ниво е 0). -:table_2 +:table +:2 |= Вход |= Изход @@ -712,10 +759,11 @@ Winterland |: 23.1406 + ### Задача 25 От входа получавате положителни цели размери на матрица от букви. -След това получавате стойностите на самата матрица, като буквата [`#`] определя стена и [`.`] определя празно пространство. +След това получавате стойностите на самата матрица, като буквата {` #} определя стена и {` .} определя празно пространство. Накрая получавате двойка индекси (координат) в матрицата. Трябва да запълните всички празни клетки, които са достижими от подадения координат (като не може да се минаава през стените). @@ -725,12 +773,13 @@ Winterland От входа получавате недовършен судоку пъзел, където празните клетки са отбелязани с -1. Трябва да намерите и изкарате решение(то) на пъзела. -:table_2 +:table +:2 |= Вход |= Изход |: -:code +```` 6 -1 3 2 -1 5 7 -1 1 -1 2 -1 -1 -1 -1 -1 9 -1 9 -1 -1 6 -1 7 -1 -1 3 @@ -745,7 +794,7 @@ Winterland |: -:code +```` 6 4 3 2 9 5 7 8 1 5 2 7 8 1 3 4 9 6 9 1 8 6 4 7 5 2 3 @@ -760,18 +809,20 @@ Winterland + ### Задача 27 -[url https://en.wikipedia.org/wiki/Recaman%27s_sequence#bodyContent Редицата на Рекаман] се дефинира по следния начин: +{url Редицата на Рекаман;https://en.wikipedia.org/wiki/Recaman%27s_sequence#bodyContent} се дефинира по следния начин: .unordered -- първия елемент (с индекс [`n = 0`]) е 0 -- всеки следващ елемент е равен на предходния минус [`n`], ако резултата ще е положително и резултата не е срещан преди -- иначе, всеки следващ елемент е равен на предходния плюс [`n`] +- първия елемент (с индекс {` n = 0}) е 0 +- всеки следващ елемент е равен на предходния минус {` n}, ако резултата ще е положително и резултата не е срещан преди +- иначе, всеки следващ елемент е равен на предходния плюс {` n} -От входа получавате цяло неотрицателно чило [`n`], изкарайте [`n`]-тото число от редицата на Рекаман. +От входа получавате цяло неотрицателно чило {` n}, изкарайте {` n}-тото число от редицата на Рекаман. -:table_2 +:table +:2 |= Вход |= Изход @@ -788,15 +839,17 @@ Winterland |: 1 + ### Задача 28 -Напишете програма, която връща [=бройката решения=] на [url https://en.wikipedia.org/wiki/Eight_queens_puzzle пъзела на 8те царици]. +Напишете програма, която връща {b бройката решения} на {url пъзела на 8те царици;https://en.wikipedia.org/wiki/Eight_queens_puzzle}. Пъзела е формулиран така: имате шахматна дъска (8 на 8) и върху нея имате 8 царици. Припомняме, че царицата се движи вертикално, хоризонтално и диагонално по дъската. Целта на пъзела е цариците да се поставят така, че нито една царица да не може да вземе никоя друга. -:table_2 +:table +:2 |= Вход |= Изход @@ -804,10 +857,11 @@ Winterland |: 92 + ### Задача 29 От входа получавате положителни цели размери на матрица от букви. -След това получавате стойностите на самата матрица, като буквата [`#`] определя стена и [`.`] определя празно пространство. +След това получавате стойностите на самата матрица, като буквата {` #} определя стена и {` .} определя празно пространство. Накрая получавате две двойки координати (индекси) в матрицата. Трябва да изкарате дали има път по празните пространства, така че да се придвижите от началните (първите) координати до финалните (вторите). @@ -821,7 +875,7 @@ Winterland Целта е да изкараме дали подадения низ съответства на шаблона. За нашите цели, регулярнят израз ще има следния формат: започвайки от началото, всяка буква директно съответства на буква в подадения низ. -Обаче, имаме специалната буква [`*`], която казва, че предходната буква може да се повтори нула или повече пъти. +Обаче, имаме специалната буква {` *}, която казва, че предходната буква може да се повтори нула или повече пъти. -Тоест, ако в регулярния израз нямаме [`*`], на практика проверяваме дали двата низа съвпадат. -В случаите когато имаме [`*`], [*пробваме*] да съпоставим буквата, например в регулярен израз "a*", низовете "", "a", "aa", "aaa" съответстват. +Тоест, ако в регулярния израз нямаме {` *}, на практика проверяваме дали двата низа съвпадат. +В случаите когато имаме {` *}, {i пробваме} да съпоставим буквата, например в регулярен израз "a*", низовете "", "a", "aa", "aaa" съответстват. diff --git a/src/teaching/upp-2025/week14/bitwise-and-binary-representation.du b/src/teaching/upp-2025/week14/bitwise-and-binary-representation.du index 8369230..ac76e8e 100644 --- a/src/teaching/upp-2025/week14/bitwise-and-binary-representation.du +++ b/src/teaching/upp-2025/week14/bitwise-and-binary-representation.du @@ -1,11 +1,11 @@ -# Побитови операции и представяне на числени данни - УПП, Седмица 14, 15.01.2026 +'def title Побитови операции и представяне на числени данни - УПП, Седмица 14, 15.01.2026 +'def desc Презентация върху размери на типове данни, 1s complement, 2s complement и IEEE754 -'define expected-reading 4 min -'define created 13 January 2026 -'define edited 14 January 2026 -[$pagenav] +# {title} -[$presentation-controller] +{pagenav 4 min;13 January 2026;14 January 2026} + +{presentation-controller} :title_slide @@ -16,17 +16,17 @@ ## Какво е бит? -[$br4] +{br4} :unordered - всичко в компютъра се представя в двоична бройна система -- [*бит*] е най-малката единица памет +- {i бит} е най-малката единица памет -- [*байт*] (byte) е най-малката [=адресируема=] единица памет +- {i байт} (byte) е най-малката {b адресируема} единица памет -- [*дума*] (word) е най-голямата [=обработваема=] единица памет +- {i дума} (word) е най-голямата {b обработваема} единица памет @@ -35,74 +35,76 @@ :slide35 -[$br3] +{br3} :unordered -- На [=модерни=] процесори: - [`x86-64`] (Intel/AMD), [`ARM`] (Apple M series/Snapdragon/Exynos/Cortex)\n +- На {b модерни} процесори: + {` x86-64} (Intel/AMD), {` ARM} (Apple M series/Snapdragon/Exynos/Cortex)\n байт е 8 бита, дума е 64 бита -- процесора извършва повечето инструкции върху [*думи*] +- процесора извършва повечето инструкции върху {i думи} -- в повечето архитектури, размера на един адрес ([=указател=]) е една [*дума*] +- в повечето архитектури, размера на един адрес ({b указател}) е една {i дума} -- [`bool`] заема един [*байт*], въпреки че стойността му може да се побере в един [*бит*] +- {` bool} заема един {i байт}, въпреки че стойността му може да се побере в един {i бит} Общо взето, за модерен процесор/ОС/... може да използвате размерите в долната таблица. .warn -[=Обаче=], стандарта на C++ определя единствено [*минимален*] размер за типовете. +{b Обаче}, стандарта на C++ определя единствено {i минимален} размер за типовете. Долните стойности не са закон! :slide35 -[$br2] +{br2} -:table_2 +:table +:2 |= Тип |= Размер -|: [`bool`], [`char`] +|: {` bool}, {` char} |: "1" бит (1 байт) -|: [`short`] +|: {` short} |: 16 бита (2 байта) -|: [`int`], [`float`] +|: {` int}, {` float} |: 32 бита (4 байта) -|: [`long`] -|: 32 бита [url https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types#LONG Windows], 64 бита MacOS/Linux +|: {` long} +|: 32 бита {url Windows;https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types#LONG}, 64 бита MacOS/Linux -|: [`long long`], [`double`] +|: {` long long}, {` double} |: 64 бита (8 байта) + :slide35 ## Побитови оператори -[$br4] +{br4} .p Аритметичните оператори извършват аритметика върху целите стойности на числата .p -Побитовите оператори извършват [*логически*] операции върху всеки два [*съответни*] бита +Побитовите оператори извършват {i логически} операции върху всеки два {i съответни} бита :slide35 -### Побитово "И" [`&`], "ИЛИ" [`|`], "НЕ" [`~`] +### Побитово "И" {` &}, "ИЛИ" {` |}, "НЕ" {` ~} .p -Работят като логическите [`&&`], [`||`], [`!`] но върху битовете. +Работят като логическите {` &&}, {` ||}, {` !} но върху битовете. Разглеждайки две еднобайтови числа: ``` @@ -110,7 +112,7 @@ 10010011 | 10011100 = 10011111 ~ 10010011 = 01101100 -### Побитово "изключващо или" [`^`] +### Побитово "изключващо или" {` ^} .p Истина, когато двата бита са различни и лъжа, когато са еднакви @@ -121,10 +123,10 @@ :middle_slide35 -### Отместване наляво [`<<`] +### Отместване наляво {` <<} .p -Отместваме битовете с [`n`] на брой позиции на ляво +Отместваме битовете с {` n} на брой позиции на ляво ``` 10010011 << 1 = 00100110 @@ -134,11 +136,11 @@ :middle_slide35 -### Отместване надясно [`>>`] +### Отместване надясно {` >>} .p -Отместваме битовете с [`n`] на брой позиции на дясно.\n -Ако типа е [`unsigned`]: +Отместваме битовете с {` n} на брой позиции на дясно.\n +Ако типа е {` unsigned}: ``` 10010011 >> 1 = 01001001 @@ -157,7 +159,7 @@ ## Представяне на цели числа -[$br4] +{br4} :unordered @@ -172,7 +174,7 @@ :middle_slide35 .p -Идея: [=старшия бит=] (най-левия) да определя дали е положително или отрицателно +Идея: {b старшия бит} (най-левия) да определя дали е положително или отрицателно ``` 000 0 @@ -188,7 +190,7 @@ :middle_slide35 .p -Проблем: нормалното събиране [=не=] работи +Проблем: нормалното събиране {b не} работи ``` 1 + 1 = 001 + 001 = 010 = 2 @@ -196,17 +198,17 @@ -1 + -1 = 101 + 101 = 1010 = 2 (отрязваме) .p -Не би ли било готино да представим числата, така че събиране/изваждане да работи по [*същия*] начин? +Не би ли било готино да представим числата, така че събиране/изваждане да работи по {i същия} начин? :slide ### 1s complement -[$br1] +{br1} .p -Отрицателното число е като положителното, но с [=обратните=] битове +Отрицателното число е като положителното, но с {b обратните} битове ``` 000 0 @@ -219,7 +221,7 @@ 111 -0 .p -Нарича се така, защото [`x & -x`] винаги е равно на [`111...111`] +Нарича се така, защото {` x & -x} винаги е равно на {` 111...111} :middle_slide35 @@ -237,15 +239,15 @@ -1 + -1 = 110 + 110 = 1100 = 1 + 100 = 101 = -2 .p -[=Плюсове:=] водещия бит е единица при отрицателни.\n -[=Минуси:=] има +0 и -0, нуждаем се от "end-arround carry". +{b Плюсове:} водещия бит е единица при отрицателни.\n +{b Минуси:} има +0 и -0, нуждаем се от "end-arround carry". :slide ### 2s complement -[$br1] +{br1} .p Като 1s complement, но при отрицателните числа изваждаме единица. @@ -261,7 +263,7 @@ 111 -1 .p -Нарича се така, защото [`x + -x`] е равно на 2 на степен броя битове +Нарича се така, защото {` x + -x} е равно на 2 на степен броя битове :middle_slide35 @@ -279,7 +281,7 @@ ## Представяне на числа с плаваща запетая -[$br1] +{br1} .p Идея: цяло число, в което закодираме позиция на точката. @@ -295,7 +297,7 @@ :slide35 -[$br3] +{br3} :unordered @@ -305,7 +307,7 @@ - Имаме много нули -- 4те бита за позиция са wasted, защото най-лявата позиция е 12, [`1100`] +- 4те бита за позиция са wasted, защото най-лявата позиция е 12, {` 1100} @@ -313,14 +315,14 @@ ### IEEE754 -[$br1] +{br1} .unordered -- Формат, публикуван през [url https://en.wikipedia.org/wiki/IEEE_754-1985 1985] година +- Формат, публикуван през {url 1985;https://en.wikipedia.org/wiki/IEEE_754-1985} година - За 16 бита, обхвата му е от -65504 до 65504, най-прецизното възможно число е 0.000000059604645 - Поддържа "числата" безкрайност и "not a number" - Представя числата като дроби (научна нотация) -- [=Не всички числа в обхвата могат да бъдат представени=] +- {b Не всички числа в обхвата могат да бъдат представени} - Числата около нулата могат да имат много цифри след запетаята, тези по-далеч могат по-малко @@ -330,7 +332,7 @@ Сложен е, любознателните могат да го разучат: .unordered -- [url https://mathcenter.oxford.emory.edu/site/cs170/ieee754/] -- [url https://www.h-schmidt.net/FloatConverter/IEEE754.html] -- [url https://en.wikipedia.org/wiki/Half-precision_floating-point_format#Half_precision_examples] -- [url https://codingnest.com/the-little-things-comparing-floating-point-numbers/] +- {url https://mathcenter.oxford.emory.edu/site/cs170/ieee754/} +- {url https://www.h-schmidt.net/FloatConverter/IEEE754.html} +- {url https://en.wikipedia.org/wiki/Half-precision_floating-point_format#Half_precision_examples} +- {url https://codingnest.com/the-little-things-comparing-floating-point-numbers/} diff --git a/src/teaching/upp-2025/week14/index.du b/src/teaching/upp-2025/week14/index.du index c9c67c0..db5a4a2 100644 --- a/src/teaching/upp-2025/week14/index.du +++ b/src/teaching/upp-2025/week14/index.du @@ -1,22 +1,23 @@ -# Задачи - УПП, Седмица 14, 15.01.2026 +'def title Задачи - УПП, Седмица 14, 15.01.2026 +'def desc Условията на задачите за упражнение. -'define expected-reading 1 min -'define created 14 January 2025 -'define edited 18 January 2025 -[$pagenav] +# {title} -GitHub Classroom: [url https://classroom.github.com/a/JjE8rZOx] +{pagenav 1 min;14 January 2025;18 January 2025} + +GitHub Classroom: {url https://classroom.github.com/a/JjE8rZOx} ## За решаване ### Задача 1 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week14/Exercise01.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week14/Exercise01.cpp} От входа получавате цяло неотрицателно число. -Използвайки [=единствено=] побитови операции, умножете числото по 8 и върнете резултата. +Използвайки {b единствено} побитови операции, умножете числото по 8 и върнете резултата. -:table_2 +:table +:2 |= Вход |= Изход @@ -27,14 +28,16 @@ GitHub Classroom: [url https://classroom.github.com/a/JjE8rZOx] |: 40 + ### Задача 2 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week14/Exercise02.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week14/Exercise02.cpp} От входа получавате цяло неотрицателно число. -Отместете битовете му с 3 позиция на ляво [=без=] да използвате побитови оператори и изкарайте резултата. +Отместете битовете му с 3 позиция на ляво {b без} да използвате побитови оператори и изкарайте резултата. -:table_2 +:table +:2 |= Вход |= Изход @@ -45,14 +48,16 @@ GitHub Classroom: [url https://classroom.github.com/a/JjE8rZOx] |: 304 + ### Задача 3 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week14/Exercise03.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week14/Exercise03.cpp} От входа получавате неотрицателно 32-битово число. -Използвайки [=единствено=] побитови операции, изкарайте 1 ако в числото има нечетен брой единици битове и 0 иначе. +Използвайки {b единствено} побитови операции, изкарайте 1 ако в числото има нечетен брой единици битове и 0 иначе. -:table_2 +:table +:2 |= Вход |= Изход @@ -63,14 +68,16 @@ GitHub Classroom: [url https://classroom.github.com/a/JjE8rZOx] |: 0 + ### Задача 4 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week14/Exercise04.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week14/Exercise04.cpp} От входа получавате неотрицателно 32-битово число. Разделете числото на 4 последователни 8-битови числа и изкарайте всяко от тях. -:table_2 +:table +:2 |= Вход |= Изход @@ -78,20 +85,22 @@ GitHub Classroom: [url https://classroom.github.com/a/JjE8rZOx] |: 76 204 133 210 + ### Задача 5 -.solution-link [url https://github.com/Syndamia/upp-2025-solutions/tree/main/Week14/Exercise05.cpp Решение] +.solution-link {url Решение;https://github.com/Syndamia/upp-2025-solutions/tree/main/Week14/Exercise05.cpp} От входа получавате две неотрицателни целия 32-битови числа. Разбийте всяко на три подчисла, две по 11 бита и едно по 10 бита. -След това от входа получавате буква: [`+`], [`-`], [`*`], [`/`]. +След това от входа получавате буква: {` +}, {` -}, {` *}, {` /}. Извършете операцията върху всеки две съответни подчисла от двете числа (т.е. върху първото подчисло на първото число и първото подчисло на второто число, второто подчисло на първото число и второто подчисло на второто число и ...). .note -[*(18.01.2026)*] Оправени примери +{i (18.01.2026)} Оправени примери -:table_2 +:table +:2 |= Вход |= Изход |