-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tex
144 lines (125 loc) · 10.1 KB
/
main.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{a4paper, margin=1in}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=black,
urlcolor=black,
}
\usepackage{fancyhdr}
\usepackage{csquotes}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\Large Final Assignment}
\fancyhead[R]{\Large Computer Workshop}
\renewcommand{\headrulewidth}{1pt}
\title{\Huge The Final Assignment \\[1cm]
\Large Author's Name: Taha Biklaryan \\[0.5cm]
\large Student ID: 401411318 \\[1cm]
\large Dr. Malekimajd \\[1cm]
\large Computer Workshop}
\date{} % Remove date
\begin{document}
\maketitle
\newpage
\tableofcontents %tabke of contents
\newpage
\section*{\Huge 1 Git and Github}
\addcontentsline{toc}{section}{1 Git and Github}%adding to the contents table
\subsection*{\Large 1.1 Repository Initialization and Commits}
\addcontentsline{toc}{subsection}{1.1 Repository Initialization and Commits}
For creating a repository for this project, first i opened my account and then in the repository section of the github i created a repository and named it \textquote{Workshop-Final-proj} and then
cloned the repository into a local directory of my pc and synced it with my vscode where i'm editing this assignment right now and going to commit the changes so far right now after putting the dot
at the end of this sentence.\\
\subsection*{\Large 1.2 Github Actions for LaTeX Compilation}
\addcontentsline{toc}{subsection}{1.2 Github Actions for LaTeX Compilation}
After setting up the repository in github i created a main.tex that i'm constantly commiting changes there
and i created folder .github which is workflow to i build and release my LaTeX files through github Actions.
And after each changes in the text editor i commit the changes to the main.tex file via vscode.\\
\section*{\Huge 2 Exploration Tasks}
\addcontentsline{toc}{section}{2 Exploration Tasks}
\subsection*{\Large 2.1 Vim Advanced Features}
\addcontentsline{toc}{subsection}{2.1 Vim Advanced Features}
1. Sessions:
Vim sessions allow you to save and restore your working environment, including open files, cursor positions, and window layouts. You can create a session with \textquote{:mksession} and then later restore it using \textquote{:source Session.vim}. This is particularly useful when you are working on a project and want to quickly resume your work with the same setup.\\
2. Marks And Jumps:
Vim allows you to place marks in your file, which act as bookmarks. You can then jump between these marks using various commands. For example, you can use \textquote{ma} to mark a position with the label \textquote{a}, and then use \textquote{'a} to jump back to that position. This is handy for navigating large files and remembering specific locations.\\
3. Text Objects:
Vim provides a variety of text objects that allow you to operate on different parts of text efficiently. For instance, \textquote{iw} represents \textquote{inner word,} and \textquote{i(} represents \textquote{inner parentheses.} These text objects can be combined with commands to perform powerful operations on specific chunks of text.\\
\subsection*{\Large 2.2 Memory Profiling}
\addcontentsline{toc}{subsection}{2.2 Memory Profiling}
\subsubsection*{\large 2.2.1 Memory Leak}
\addcontentsline{toc}{subsubsection}{2.2.1 Memory Leak}
Memory leaks occur when a computer program allocates memory but fails to release or deallocate it properly, leading to a gradual consumption of system resources. In simpler terms, memory leaks occur when a program reserves space in the computer's memory but forgets to free up that space when it's no longer needed. This can result in a gradual decrease in available memory, which can eventually lead to performance issues or even program crashes.
In these cases this might happen:\\
1. Unintentional Memory Allocation:\\
If you dynamically allocate memory using functions like malloc() in C or new in C++, you must remember to free that memory using free() or delete respectively. Forgetting to do so can lead to memory leaks.\\
2. Not Releasing Resources:\\
Memory leaks are not limited to just memory allocation. Other resources like file handles, network connections, or database connections also need to be released when no longer needed. Failure to release these resources can lead to memory leak.\\
3. Circular References\\
4. Global Variables and Static Data\\
and there are other reasons that this might happen\\
\subsubsection*{\large 2.2.2 Memory Profilers}
\addcontentsline{toc}{subsubsection}{2.2.2 Memory Profilers}
\begin{itemize}
\item Introduction:\\
The Valgrind tool suite provides a number of debugging and profiling tools that help you make your programs faster and more correct. The most popular of these tools is called Memcheck. It can detect many memory-related errors that are common in C and C++ programs and that can lead to crashes and unpredictable behaviour.It is mainly an open-source programming tools designedd for memory debugging, memory leak detection, and profiling. Valgrind provides a framework for instrumenting and analysing the memory usage of a program, helping developers identify and fix memory related issues.
\item Memory Leaks Detection:\\
Valgrind can detect memory leaks by keeping track of memory allocations and deallocations during the execution of a program. If memory is allocated but not deallocated (resulting in a memory leak), Valgrind can identify the source of the leak and provide information to help developers fix the issue.\\
steps:\\
1. Valgrind instruments the binary code of a program by inserting its own instructions. This allows Valgrind to monitor memory operations during the program's execution.\\
2. The instrumented program is executed under Valgrind's supervision. Valgrind keeps track of memory-related activities, such as allocations and deallocations, while the program runs.\\
3. Valgrind maintains a detailed record of each memory block that is allocated, including its size, address, and other relevant information. This information is crucial for detecting leaks.\\
4. Valgrind monitors whether each allocated block is properly deallocated. It keeps track of freed and allocated memory blocks and their associated addresses.\\
5. If Valgrind identifies any memory blocks that were allocated but not freed before the program exits, it flags these as memory leaks.\\
6. Valgrind generates a detailed report at the end of the program execution, summarizing the memory leaks detected. The report includes information about the source file, line number, and size of each leaked memory block.\\
\end{itemize}
\subsection*{\Large 2.3 GNU/Linux Bash Scripting}
\addcontentsline{toc}{subsection}{2.3 GNU/Linux Bash Scripting}
\subsubsection*{\large 2.3.1 fzf}
\addcontentsline{toc}{subsubsection}{2.3.1 fzf}
\begin{itemize}
\item What is fuzzy searching?\\
A fuzzy search is a technique that uses search algorithms to find strings that match patterns approximately. It's particularly useful for helping users find webpages without having to know exactly what they're looking for or how a word is spelled. Fuzzy searches are also used for Structured Query Language lookups to help database users find records without having to be sure of the exact spelling of the value they're looking for.A fuzzy search is performed using a fuzzy matching algorithm, which returns a list of results based on likely relevance even though search argument words and spellings may not be an exact match. For web lookups, exact and highly relevant matches appear near the top of the list. Subjective relevance ratings may be given, usually as percentages.
\item ls|fzf:\\
ls simply displays the contents of the current directory, after that the output passes throught the
fzf for interactive selection. It is a convenient way to navigate and select files from the commend line
using a fuzzy search interface which is provided by \textquote{fzf}. After running the command we will be able to filter
and select items from the list generated from the \textquote{ls} command.
\end{itemize}
\subsubsection*{\large 2.3.2 Using the fzf to find your favourite PDF}
\addcontentsline{toc}{subsubsection}{2.3.2 Using the fzf to find your favourite PDF}
\begin{enumerate}
\item Command to list the directory of all the files with the extension .PDF:\\
Here i used the command \textquote{fd -e pdf} in WSL and this bash script list all the directories
that have files with the .PDF . this command uses the \textquote{-e} flag tofilter files by pdf extension.
\item Command to use fzf to select a PDF from the data we gathered above:\\
Now we wanna be able to go through the files listed above and select them for this purpose we use
\textquote{fd -e pdf | fzf --prompt="Select a PDF file: " --preview="pdftotext {} - | head -n 20"
} command the fd -e pdf list the pdf files and the fzf create a dynamic to be able to search through the files
with an arrow shaped thing and select among them the pdf that we want.
\end{enumerate}
\subsubsection*{\large 2.3.3 Opening the file using Zathura}
\addcontentsline{toc}{subsubsection}{2.3.3 Opening the file using Zathura}
Zathura is a pdf viewer which after listing the pdfs and selecting them zathura give this access to us to open them and review them
for the sake of doing this we use the command \textquote{zathura \textquote{(fd -e pdf | fzf --prompt="Select a PDF file: " --preview="pdftotext {} - | head -n 20")
}} zathura wraps the entire command inside the $(..)$ and the command inside it is the same that's been discussed in the subsection above.
\section*{\Huge 3 Git and Foss}
\addcontentsline{toc}{section}{3 Git and Foss}
\subsection*{\Large 3.0 README.md}
\addcontentsline{toc}{subsection}{3.0 README.md}
This part have been done in the repository which link's where attached earlier in the doc and should visit there to check this part.
\subsection*{\Large 3.1 Issues}
\addcontentsline{toc}{subsection}{3.1 Issues}
\begin{figure}[h]
\centering
\includegraphics[width=1\textwidth]{"C:/Users/Taha/Desktop/test issue.jpg"}
\caption{Issue's screenshot}
\label{fig:enter-label}
\end{figure}
\end{document}