diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..59e5d7f Binary files /dev/null and b/.DS_Store differ diff --git a/Worksheets/.DS_Store b/Worksheets/.DS_Store new file mode 100644 index 0000000..63d95b8 Binary files /dev/null and b/Worksheets/.DS_Store differ diff --git a/Worksheets/Worksheets_guide.org b/Worksheets/Worksheets_guide.org new file mode 100644 index 0000000..4d61b4d --- /dev/null +++ b/Worksheets/Worksheets_guide.org @@ -0,0 +1,59 @@ +#+TITLE: Worksheets Guide +#+AUTHOR: Dr Carey Pridgeon Dr Nazaraf Shah +#+EMAIL: ab0475@coventry.ac.uk +#+OPTIONS: toc:nil +#+LaTeX_CLASS_OPTIONS: [minimal, t] +#+STARTUP: showeverything +* Worksheets +- This Module is assessed by means of a Portfolio of Works. +- The worksheets are graded to a total of 100, *if* you also complete the graded + feedback session. +- Whatever you get out of 100 is then that amount of 20% of the total module + grade. +- So, if you got 67, the amount the worksheets would contribute towards your + final module grade would be .67*20 = *13.4%* +- You must complete four of the worksheets provided. +** Which worksheets to do +- For all students the Terminal worksheet is compulsory. +- If you do the bug fixing portfolio, the Mozilla worksheet is strongly + recommended, as it contains everything you need to start the bug fixing + process. +- If you are less technically capable, the worksheets on Games and Licences are + more research and thought based than technical knowledge based. You cannot + avoid all the technical worksheets however. +- If you are particularly interesting in optimisation, then the gdb and valgrind + worksheet is recommended. +- The Git Worksheet goes into more detail on Git than you have covered in + previous modules. +- The Emacs worksheet shows you how to use emacs to create documents of the type + you will have already seen used on this module. +** Structure of the Worksheets. +- Where relevant the worksheets contain guides to all the commands they require + you to use. +- If they don't contain them they have instructions on where to go to find those + instructions. +** Worksheets Marks Breakdown +| worksheet | grade | +| *Linux Terminal* | 20 | +| Mozilla | 20 | +| gdb and Valgrind | 25 | +| Licences | 20 | +| Games | 20 | +| git | 25 | +| Gnuplot | 20 | + - Four of the Worksheets must be completed to finish this portfolio component. + - Some of the Worksheets cover aspects of the module content that will be + useful for your work in completing other portfolio components. +- To gain maximum possible marks you must complete the technical worksheets + *completely*. +- Partial completion will not qualify as done. +* Graded Feedback +- 10% of the mark for this component is available through a graded feedback + session with a member of the teaching team. +- To qualify for this you must have completed at least one worksheet and have + started on the next. Ungraded feedback is available at any point. +** Submission +- On completion, the worksheets and the evidence specified for each should be + placed in a single archive file and uploaded to Moodle. + + diff --git a/Worksheets/Worksheets_guide.pdf b/Worksheets/Worksheets_guide.pdf new file mode 100644 index 0000000..fa852a8 Binary files /dev/null and b/Worksheets/Worksheets_guide.pdf differ diff --git a/Worksheets/Worksheets_guide.tex b/Worksheets/Worksheets_guide.tex new file mode 100644 index 0000000..63f44fb --- /dev/null +++ b/Worksheets/Worksheets_guide.tex @@ -0,0 +1,103 @@ +% Created 2019-08-20 Tue 13:23 +\documentclass[minimal, t]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{fixltx2e} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{wrapfig} +\usepackage{rotating} +\usepackage[normalem]{ulem} +\usepackage{amsmath} +\usepackage{textcomp} +\usepackage{marvosym} +\usepackage{wasysym} +\usepackage{amssymb} +\usepackage{hyperref} +\tolerance=1000 +\author{Dr Carey Pridgeon Dr Nazaraf Shah} +\date{\today} +\title{Worksheets Guide} +\hypersetup{ + pdfkeywords={}, + pdfsubject={}, + pdfcreator={Emacs 25.3.50.1 (Org mode 8.2.10)}} +\begin{document} + +\maketitle +\section{Worksheets} +\label{sec-1} +\begin{itemize} +\item This Module is assessed by means of a Portfolio of Works. +\item The worksheets are graded to a total of 100, \textbf{if} you also complete the graded +feedback session. +\item Whatever you get out of 100 is then that amount of 20\% of the total module +grade. +\item So, if you got 67, the amount the worksheets would contribute towards your +final module grade would be .67*20 = \textbf{13.4\%} +\item You must complete four of the worksheets provided. +\end{itemize} +\subsection{Which worksheets to do} +\label{sec-1-1} +\begin{itemize} +\item For all students the Terminal worksheet is compulsory. +\item If you do the bug fixing portfolio, the Mozilla worksheet is strongly +recommended, as it contains everything you need to start the bug fixing +process. +\item If you are less technically capable, the worksheets on Games and Licences are +more research and thought based than technical knowledge based. You cannot +avoid all the technical worksheets however. +\item If you are particularly interesting in optimisation, then the gdb and valgrind +worksheet is recommended. +\item The Git Worksheet goes into more detail on Git than you have covered in +previous modules. +\item The Emacs worksheet shows you how to use emacs to create documents of the type +you will have already seen used on this module. +\end{itemize} +\subsection{Structure of the Worksheets.} +\label{sec-1-2} +\begin{itemize} +\item Where relevant the worksheets contain guides to all the commands they require +you to use. +\item If they don't contain them they have instructions on where to go to find those +instructions. +\end{itemize} +\subsection{Worksheets Marks Breakdown} +\label{sec-1-3} +\begin{center} +\begin{tabular}{lr} +worksheet & grade\\ +\textbf{Linux Terminal} & 20\\ +Mozilla & 20\\ +gdb and Valgrind & 25\\ +Licences & 20\\ +Games & 20\\ +git & 25\\ +Gnuplot & 20\\ +\end{tabular} +\end{center} +\begin{itemize} +\item Four of the Worksheets must be completed to finish this portfolio component. +\item Some of the Worksheets cover aspects of the module content that will be +useful for your work in completing other portfolio components. +\item To gain maximum possible marks you must complete the technical worksheets +\textbf{completely}. +\item Partial completion will not qualify as done. +\end{itemize} +\section{Graded Feedback} +\label{sec-2} +\begin{itemize} +\item 10\% of the mark for this component is available through a graded feedback +session with a member of the teaching team. +\item To qualify for this you must have completed at least one worksheet and have +started on the next. Ungraded feedback is available at any point. +\end{itemize} +\subsection{Submission} +\label{sec-2-1} +\begin{itemize} +\item On completion, the worksheets and the evidence specified for each should be +placed in a single archive file and uploaded to Moodle. +\end{itemize} +% Emacs 25.3.50.1 (Org mode 8.2.10) +\end{document} \ No newline at end of file diff --git a/Worksheets/worksheets/.DS_Store b/Worksheets/worksheets/.DS_Store new file mode 100644 index 0000000..6985f92 Binary files /dev/null and b/Worksheets/worksheets/.DS_Store differ diff --git a/Worksheets/worksheets/Mozilla/.DS_Store b/Worksheets/worksheets/Mozilla/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/Worksheets/worksheets/Mozilla/.DS_Store differ diff --git a/Worksheets/worksheets/Mozilla/Mozilla_Worksheet.org b/Worksheets/worksheets/Mozilla/Mozilla_Worksheet.org new file mode 100644 index 0000000..04fed18 --- /dev/null +++ b/Worksheets/worksheets/Mozilla/Mozilla_Worksheet.org @@ -0,0 +1,116 @@ +#+TITLE: Mozilla Worksheet +#+AUTHOR: Carey Pridgeon +#+EMAIL: ab0475@coventry.ac.uk +#+OPTIONS: toc:nil +#+LaTeX_CLASS_OPTIONS: [minimal, t] +#+STARTUP: showeverything +* intro +- In this worksheet you will either finish setting up your mozilla build + environment in our virtual machine image, or start installing one on your own + machine. +** A quick note or two about installing your own +- There are advantages, it will compile faster, the codebase will be easier to + access, once you've downloaded it (this stage alone may take a while). +- However, we cannot offer much help for you. You may get help from the + community, that is, after all, what they do. +- Here are some quick build guides +- For Building on [[https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build/Linux_and_MacOS_build_preparation][Linux]] +- For Building on [[https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Windows_Prerequisites][Windows]] +- For Building on [[https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Mac_OS_X_Prerequisites][MacOS]] +- If you use a Mac and choose to do this, *DO NOT* upgrade to the new version of + MacOS when it comes out halfway through the module. Wait till it's finished. +** Virtual Machine stuff +- Mozilla have their own virtual machine, but have proved to be so slow at + updating it, to the point where it's essentially useless. As a result we have + produced our own instead. +- The download link for this, and associated information will be available on + the Moodle page. It already has the base code for Mozilla, so you will only + need to retrieve the latest revisions. +- This may take a while, but it will vastly easier than downloading the entire + codebase, which can take many hours, and is prone to failure. +- All the instructions for this are on the Mozilla portion of the Moodle page, + so head over there to get those. +* Mercurial Commands we will use + - *hg update* + - refresh your local codebase so it is the same as the current version on the + remote repositories head branch. (used when first using the codebase on our + virtual machine image) +- *hg strip tip --force* + - Remove local edits +- *hg pull -u* + - Pull down the latest source +- *hg tags* + - List all tags in a mercurial repository. +- *hg diff* + - Run from the repository folder. Compares the current state of the + files with that on the last commit and shows any differences. +- *hg qnew [patchname]* + - Creates a patch (written to firefox/.hg/patches) that will allow + any local changes to be applied to another clone of this codebase + (or different branches of the same one). +- *./mach mercurial-setup* + - Set up Mercurial to work with mach. +- *hg log -l 10* + - list the last 10 commits. To go back further, just specify a different number +* Tasks + +** Set up Mercurial for Mozilla Patch Creation +- Out of the box mercurial isn't set up to work with the mozilla build + system (/mach/). +-- Some of this has already been done, but you will need to open the *.hgrc* + file (this is a hidden file, you won't see it until you open it with an + editor, but it's in your home folder. +- In .hgrc, first edit the username entry so it matches the phabricator username + you create. You'll have to go online and do this first. +- You won't get a key to do passwordless commits, only long time contributors + get those, so each time you do one, you'll have to log in. +- Then add +#+BEGIN_SRC bash + mq = +#+END_SRC + to the [extensions] section +- This should be your *.hgrc* file set up. +** List all the tags +- *hg tags* +- Evidence this by piping the output to a text file, then include that + in your submission for this worksheet. + +** compile the source code +- This will take quite a while, so use the *&* again in case you have + to log out before the build finishes. +- *NOTE* If you are using the VM, as mentioned above and in lectures, you will need to update + th source code before compiling by using the command *hg update* +#+BEGIN_SRC bash + ./mach build & +#+END_SRC +- Once it has built, you can launch it with this command: +#+BEGIN_SRC bash + ./mach run +#+END_SRC +- Screenshot the running program and include it in your submission. +** edit a cpp file +- Select any cpp file and make a change to it. This change can be + trivial, it only needs to show up in a diff. +** Create a patch +- Diff the codebase, if there are changes shown, create a patch. This + patch then goes in your submission for this worksheet. +- You will need to get your evidence out of the virtual machine. Use git to achieve this. + +** restore the codebase +- Use the command listed above in the commands section that will remove any local edits so you + can begin your proper bug fixing work. +** inspecting the commit history +- List the last ten commits +* Worksheet evidence. +- Put the tags listing, the list of the last ten commits and your + Patch, in a *single* document. + + + + + + + + + + diff --git a/Worksheets/worksheets/Mozilla/Mozilla_Worksheet.pdf b/Worksheets/worksheets/Mozilla/Mozilla_Worksheet.pdf new file mode 100644 index 0000000..f15d6a4 Binary files /dev/null and b/Worksheets/worksheets/Mozilla/Mozilla_Worksheet.pdf differ diff --git a/Worksheets/worksheets/Mozilla/Mozilla_Worksheet.tex b/Worksheets/worksheets/Mozilla/Mozilla_Worksheet.tex new file mode 100644 index 0000000..ae7dbc1 --- /dev/null +++ b/Worksheets/worksheets/Mozilla/Mozilla_Worksheet.tex @@ -0,0 +1,191 @@ +% Created 2019-10-09 Wed 09:56 +\documentclass[minimal, t]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{fixltx2e} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{wrapfig} +\usepackage{rotating} +\usepackage[normalem]{ulem} +\usepackage{amsmath} +\usepackage{textcomp} +\usepackage{marvosym} +\usepackage{wasysym} +\usepackage{amssymb} +\usepackage{hyperref} +\tolerance=1000 +\author{Carey Pridgeon} +\date{\today} +\title{Mozilla Worksheet} +\hypersetup{ + pdfkeywords={}, + pdfsubject={}, + pdfcreator={Emacs 25.3.50.1 (Org mode 8.2.10)}} +\begin{document} + +\maketitle +\section{intro} +\label{sec-1} +\begin{itemize} +\item In this worksheet you will either finish setting up your mozilla build +environment in our virtual machine image, or start installing one on your own +machine. +\end{itemize} +\subsection{A quick note or two about installing your own} +\label{sec-1-1} +\begin{itemize} +\item There are advantages, it will compile faster, the codebase will be easier to +access, once you've downloaded it (this stage alone may take a while). +\item However, we cannot offer much help for you. You may get help from the +community, that is, after all, what they do. +\item Here are some quick build guides +\item For Building on \href{https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build/Linux_and_MacOS_build_preparation}{Linux} +\item For Building on \href{https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Windows_Prerequisites}{Windows} +\item For Building on \href{https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Mac_OS_X_Prerequisites}{MacOS} +\item If you use a Mac and choose to do this, \textbf{DO NOT} upgrade to the new version of +MacOS when it comes out halfway through the module. Wait till it's finished. +\end{itemize} +\subsection{Virtual Machine stuff} +\label{sec-1-2} +\begin{itemize} +\item Mozilla have their own virtual machine, but have proved to be so slow at +updating it, to the point where it's essentially useless. As a result we have +produced our own instead. +\item The download link for this, and associated information will be available on +the Moodle page. It already has the base code for Mozilla, so you will only +need to retrieve the latest revisions. +\item This may take a while, but it will vastly easier than downloading the entire +codebase, which can take many hours, and is prone to failure. +\item All the instructions for this are on the Mozilla portion of the Moodle page, +so head over there to get those. +\end{itemize} +\section{Mercurial Commands we will use} +\label{sec-2} +\begin{itemize} +\item \textbf{hg update} +\begin{itemize} +\item refresh your local codebase so it is the same as the current version on the +remote repositories head branch. (used when first using the codebase on our +virtual machine image) +\end{itemize} +\item \textbf{hg strip tip --force} +\begin{itemize} +\item Remove local edits +\end{itemize} +\item \textbf{hg pull -u} +\begin{itemize} +\item Pull down the latest source +\end{itemize} +\item \textbf{hg tags} +\begin{itemize} +\item List all tags in a mercurial repository. +\end{itemize} +\item \textbf{hg diff} +\begin{itemize} +\item Run from the repository folder. Compares the current state of the +files with that on the last commit and shows any differences. +\end{itemize} +\item \textbf{hg qnew [patchname]} +\begin{itemize} +\item Creates a patch (written to firefox/.hg/patches) that will allow +any local changes to be applied to another clone of this codebase +(or different branches of the same one). +\end{itemize} +\item \textbf{./mach mercurial-setup} +\begin{itemize} +\item Set up Mercurial to work with mach. +\end{itemize} +\item \textbf{hg log -l 10} +\begin{itemize} +\item list the last 10 commits. To go back further, just specify a different number +\end{itemize} +\end{itemize} +\section{Tasks} +\label{sec-3} + +\subsection{Set up Mercurial for Mozilla Patch Creation} +\label{sec-3-1} +\begin{itemize} +\item Out of the box mercurial isn't set up to work with the mozilla build +system (\emph{mach}). +\end{itemize} +-- Some of this has already been done, but you will need to open the \textbf{.hgrc} + file (this is a hidden file, you won't see it until you open it with an + editor, but it's in your home folder. +\begin{itemize} +\item In .hgrc, first edit the username entry so it matches the phabricator username +you create. You'll have to go online and do this first. +\item You won't get a key to do passwordless commits, only long time contributors +get those, so each time you do one, you'll have to log in. +\item Then add +\end{itemize} +\begin{verbatim} +mq = +\end{verbatim} +to the [extensions] section +\begin{itemize} +\item This should be your \textbf{.hgrc} file set up. +\end{itemize} +\subsection{List all the tags} +\label{sec-3-2} +\begin{itemize} +\item \textbf{hg tags} +\item Evidence this by piping the output to a text file, then include that +in your submission for this worksheet. +\end{itemize} + +\subsection{compile the source code} +\label{sec-3-3} +\begin{itemize} +\item This will take quite a while, so use the \textbf{\&} again in case you have +to log out before the build finishes. +\item \textbf{NOTE} If you are using the VM, as mentioned above and in lectures, you will need to update +th source code before compiling by using the command \textbf{hg update} +\end{itemize} +\begin{verbatim} +./mach build & +\end{verbatim} +\begin{itemize} +\item Once it has built, you can launch it with this command: +\end{itemize} +\begin{verbatim} +./mach run +\end{verbatim} +\begin{itemize} +\item Screenshot the running program and include it in your submission. +\end{itemize} +\subsection{edit a cpp file} +\label{sec-3-4} +\begin{itemize} +\item Select any cpp file and make a change to it. This change can be +trivial, it only needs to show up in a diff. +\end{itemize} +\subsection{Create a patch} +\label{sec-3-5} +\begin{itemize} +\item Diff the codebase, if there are changes shown, create a patch. This +patch then goes in your submission for this worksheet. +\item You will need to get your evidence out of the virtual machine. Use git to achieve this. +\end{itemize} + +\subsection{restore the codebase} +\label{sec-3-6} +\begin{itemize} +\item Use the command listed above in the commands section that will remove any local edits so you +can begin your proper bug fixing work. +\end{itemize} +\subsection{inspecting the commit history} +\label{sec-3-7} +\begin{itemize} +\item List the last ten commits +\end{itemize} +\section{Worksheet evidence.} +\label{sec-4} +\begin{itemize} +\item Put the tags listing, the list of the last ten commits and your +Patch, in a \textbf{single} document. +\end{itemize} +% Emacs 25.3.50.1 (Org mode 8.2.10) +\end{document} \ No newline at end of file diff --git a/Worksheets/worksheets/games/.DS_Store b/Worksheets/worksheets/games/.DS_Store new file mode 100644 index 0000000..388b43c Binary files /dev/null and b/Worksheets/worksheets/games/.DS_Store differ diff --git a/Worksheets/worksheets/games/Games_Worksheet.org b/Worksheets/worksheets/games/Games_Worksheet.org new file mode 100644 index 0000000..1d84a9d --- /dev/null +++ b/Worksheets/worksheets/games/Games_Worksheet.org @@ -0,0 +1,33 @@ +#+TITLE: Games Worksheet +#+AUTHOR: Carey Pridgeon +#+EMAIL: ab0475@ccoventry.ac.uk +#+OPTIONS: toc:nil +#+STARTUP: showeverything +#+LaTeX_CLASS_OPTIONS: [minimal, t] +* Preamble +- *Read this worksheet completely before you begin.* +- Single sentence answers will not be graded. You must use at least + paragraphs. Shorter answers attract lower marks, over wordy answers do the same, + be concise and accurate. Try to convey the right amount of + information in your answers. +- Your answers should to be complete enough to make your point, so not too brief + and referenced where you have used an external source. We cannot allocate + grades for text you are quoting, only original work. +- Citations must use the CUHarvard style. +** Questions +- Do you think the sale of open source games is viable now or in the near + future? If you do, say why, but if you don't, explain why not. +- How do you think a current online game retailer, like Steam or GoG (for + example, or a new one we are unaware of) might approach the selling of Open + Source games? + - Who do you think might be the best choice of those that exist now, or do you + think none of them would be? Justify your answer. +- If you were to set up a community for Open Source games developers to + collaborate, what would your priorities be, and why? + - Provide a list of your priorities with a brief elaboration for each point. +- How should an Open Source games developer fund their work? Of the various + funding methods available to creators which do you think might be the most + appropriate? + - Can you justify your answer or give any examples where the method you have + selected is already being used? This can be in another field. + diff --git a/Worksheets/worksheets/games/Games_Worksheet.pdf b/Worksheets/worksheets/games/Games_Worksheet.pdf new file mode 100644 index 0000000..833f92f Binary files /dev/null and b/Worksheets/worksheets/games/Games_Worksheet.pdf differ diff --git a/Worksheets/worksheets/games/Games_Worksheet.tex b/Worksheets/worksheets/games/Games_Worksheet.tex new file mode 100644 index 0000000..dbe476a --- /dev/null +++ b/Worksheets/worksheets/games/Games_Worksheet.tex @@ -0,0 +1,68 @@ +% Created 2019-08-20 Tue 09:41 +\documentclass[minimal, t]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{fixltx2e} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{wrapfig} +\usepackage{rotating} +\usepackage[normalem]{ulem} +\usepackage{amsmath} +\usepackage{textcomp} +\usepackage{marvosym} +\usepackage{wasysym} +\usepackage{amssymb} +\usepackage{hyperref} +\tolerance=1000 +\author{Carey Pridgeon} +\date{\today} +\title{Games Worksheet} +\hypersetup{ + pdfkeywords={}, + pdfsubject={}, + pdfcreator={Emacs 25.3.50.1 (Org mode 8.2.10)}} +\begin{document} + +\maketitle +\section{Preamble} +\label{sec-1} +\begin{itemize} +\item \textbf{Read this worksheet completely before you begin.} +\item Single sentence answers will not be graded. You must use at least +paragraphs. Shorter answers attract lower marks, over wordy answers do the same, +be concise and accurate. Try to convey the right amount of +information in your answers. +\item Your answers should to be complete enough to make your point, so not too brief +and referenced where you have used an external source. We cannot allocate +grades for text you are quoting, only original work. +\item Citations must use the CUHarvard style. +\end{itemize} +\subsection{Questions} +\label{sec-1-1} +\begin{itemize} +\item Do you think the sale of open source games is viable now or in the near +future? If you do, say why, but if you don't, explain why not. +\item How do you think a current online game retailer, like Steam or GoG (for +example, or a new one we are unaware of) might approach the selling of Open +Source games? +\begin{itemize} +\item Who do you think might be the best choice of those that exist now, or do you +think none of them would be? Justify your answer. +\end{itemize} +\item If you were to set up a community for Open Source games developers to +collaborate, what would your priorities be, and why? +\begin{itemize} +\item Provide a list of your priorities with a brief elaboration for each point. +\end{itemize} +\item How should an Open Source games developer fund their work? Of the various +funding methods available to creators which do you think might be the most +appropriate? +\begin{itemize} +\item Can you justify your answer or give any examples where the method you have +selected is already being used? This can be in another field. +\end{itemize} +\end{itemize} +% Emacs 25.3.50.1 (Org mode 8.2.10) +\end{document} \ No newline at end of file diff --git a/Worksheets/worksheets/gdb/.DS_Store b/Worksheets/worksheets/gdb/.DS_Store new file mode 100644 index 0000000..9142a62 Binary files /dev/null and b/Worksheets/worksheets/gdb/.DS_Store differ diff --git a/Worksheets/worksheets/gdb/README.md b/Worksheets/worksheets/gdb/README.md new file mode 100644 index 0000000..29dac82 --- /dev/null +++ b/Worksheets/worksheets/gdb/README.md @@ -0,0 +1 @@ +This repository holds the source code and worksheet materials for 389COM - GDB and Valgrind \ No newline at end of file diff --git a/Worksheets/worksheets/gdb/Valgrind_GDB_Worksheet.org b/Worksheets/worksheets/gdb/Valgrind_GDB_Worksheet.org new file mode 100644 index 0000000..c53504b --- /dev/null +++ b/Worksheets/worksheets/gdb/Valgrind_GDB_Worksheet.org @@ -0,0 +1,146 @@ +#+TITLE: Valgrind and GDB Worksheet +#+AUTHOR: Carey Pridgeon +#+EMAIL: ab0475@ccoventry.ac.uk +#+OPTIONS: ^:nil toc:nil +#+STARTUP: showeverything +#+LaTeX_CLASS_OPTIONS: [minimal, t] +* Valgrind +- Gprof is the GNU foundation profiling tool for C and C++ programs. +- However this isn't the easiest of programs to use directly. +- Instead we'll use *valgrind*. +- *valgrind* is part of the *KDE* development environment. It uses + *gprof* as a base and extends it to enable the output to be + graphically displayed easily. +- To do this we need to log in to *nostromo*. +- Profiling is the process of examining the function and method calls + of a program to determine which how much time is spent in each, how + many times they are called, and the call tree (what calls what and + for how long). +- We profile so we know where to best optimise our programs. For + example, if the program spends just *2%* of its time in one function, + there is little point optimising it. +* Valgrind Task +- To fetch it from its gitlab repository type the following +- *git clone https://gitlab.com/carey.pridgeon/gdb_worksheet_material.git* +- Now cd into the directory and open the programs Makefile. +** Edit the Makefile +- We need to add a compiler directive to add profiling symbols to the + compiled code. +- To do this find the following lines: +#+begin_src bash +$(EXE): $(OBJS) + $(CC) $(OBJS) $(LIB_DIRS) $(LLIBS)$(LDFLAGS) -o $(EXE) +#+end_src +- And update it to include *-pg* +#+begin_src bash +$(EXE): $(OBJS) + $(CC) $(OBJS) $(LIB_DIRS) $(LLIBS)$(LDFLAGS) -pg -o $(EXE) +#+end_src +- and do the same to the following line +#+begin_src bash +CFLAGS = -Wall -O3 +#+end_src +becomes +#+begin_src bash +CFLAGS = -Wall -O3 -pg +#+end_src +- Now we compile the code by typing *make clean && make* +** Running Valgrind +- *valgrind --tool=callgrind ./nmod* (that's two minus signs before tool) +- Run the command +- Once nmod completes, it will have generated a file called +- *callgrind.out.[number]* in the nmod folder. +- This file represents a call graph for nmod, and we need to pass the program + and this file to valgrind to generate the kcachegrind readable profiler + output. +- Once this command finishes, type *kcachegrind* +- This will launch a graphical program that will parse the output file. +** Reading the output +- You will see a great deal of information on the performance of the + program, including call graphs and percentage of runtime/call count + occupied by given functions. +- Find the program function called most often (in which the program spends most + of its processing time. +- What function calls it? +- *HINT* The answer will be a function in the codebase provided, and those almost all + begin with an underscore e.g *_parse_line*. So look in the src folder to see + if the function you've identified is there. If it isn't you've selected the + wrong one. +- Does it call any other functions from the program? +- Which function is called the smallest number of times (but more than + once)? +- Find a function that you think lies roughly half way, in terms of + times called and runtime, between these two extremes. +- Sometimes you may feel there is more than one correct answer, if so put both. +** Submission for this task +- Write the name of these functions, and their call counts/total + runtime in your report. +- Include an exported image of the call graph for each function in + your submission. Right Clicking on the call graph picture brings up + this option. + +* GDB +- GDB is the GNU foundations debugging tool. +- Setting up the program to work with GDB is the same as for Gprof, + except instead of *-pg*, we just use *-g*. +- Once the Makefile has been altered, re-compile the program *make + clean && make* +- And run it with GDB by typing: *gdb ./nmod* +- This launches the gdb console ready for us to start debugging the program. +** GDB Commands +*** tui + to launch gdb with tui (text User Interface) type *gdb -tui* +*** run +This launches the program. If we run it without setting any +breakpoints it will run to completion. If there is a program killing +bug it will crash in gdb and produce a useful trace we can use to +begin the analysis. +*** break +- In order to stop the program at a specific point so we can examine + it more closely we need to set breakpoints. +- A breakpoint is a point in the running program where execution will + halt, allowing us to examine program state and advance through the + program step by step to isolate an error. +- To set a breakpoint we must specify either a function/method name, + ora sourcefile name and line number. +- So if we want to put a breakpoint for a function *_funcname* we do + as follows: *break _funcname* +- So now when we type *run* the program will halt at the break point, + allowing us to control the program from there on. +- Alternatively you can specify a location in the source file, but we + won't use that: +*** step +- Using this command we can /step/ through the program one line at a + time to see if a program works or if and where it crashes. To step + in more than once, set a value: e,g step *5* +*** print +- By typing *print [variablename]* we can inspect the contents of a + variable. +- We can also print the contents of a static array, eg: *print + array\big[0\big]* +*** until +- This will, if you are in a loop, continue running the program until + the loop exits. +*** list +- This will list a specified number of lines of code forward from the + current position in the code: + - *list n* + - Where n is the number of lines to display. +*** quit +- Typing the *quit* command will exit the program. +** task +- Set a breakpoint at _find_gravitational_interaction_between_pair_of_particles +- Step in once, then examine *(local_particles + 4) (this is the Earths Moon)*. +- To examine a single component of the particle using print, derefence that + particle (A private member were it an object, but it's a struct, so it's public, + we can look at it). Look in the file nmod_structures.h for the particle type + to find some more elements -, xpos, xpos, mass, radius etc. +- Display five of them individually, then all of them at once by + dereferencing the entire particle. +- Instruct gdb to continue till the for loop is done, then do so + again. list the source code, pressing enter until you are out of + lines, then type until again to finish the loop operation and move + to the calling function, then list again. +** Submission for this task +screenshot your progress as you examine the variable values, and put +this in your report. diff --git a/Worksheets/worksheets/gdb/Valgrind_GDB_Worksheet.pdf b/Worksheets/worksheets/gdb/Valgrind_GDB_Worksheet.pdf new file mode 100644 index 0000000..abbb2a1 Binary files /dev/null and b/Worksheets/worksheets/gdb/Valgrind_GDB_Worksheet.pdf differ diff --git a/Worksheets/worksheets/gdb/Valgrind_GDB_Worksheet.tex b/Worksheets/worksheets/gdb/Valgrind_GDB_Worksheet.tex new file mode 100644 index 0000000..b5a55a0 --- /dev/null +++ b/Worksheets/worksheets/gdb/Valgrind_GDB_Worksheet.tex @@ -0,0 +1,219 @@ +% Created 2019-08-20 Tue 09:45 +\documentclass[minimal, t]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{fixltx2e} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{wrapfig} +\usepackage{rotating} +\usepackage[normalem]{ulem} +\usepackage{amsmath} +\usepackage{textcomp} +\usepackage{marvosym} +\usepackage{wasysym} +\usepackage{amssymb} +\usepackage{hyperref} +\tolerance=1000 +\author{Carey Pridgeon} +\date{\today} +\title{Valgrind and GDB Worksheet} +\hypersetup{ + pdfkeywords={}, + pdfsubject={}, + pdfcreator={Emacs 25.3.50.1 (Org mode 8.2.10)}} +\begin{document} + +\maketitle +\section{Valgrind} +\label{sec-1} +\begin{itemize} +\item Gprof is the GNU foundation profiling tool for C and C++ programs. +\item However this isn't the easiest of programs to use directly. +\item Instead we'll use \textbf{valgrind}. +\item \textbf{valgrind} is part of the \textbf{KDE} development environment. It uses +\textbf{gprof} as a base and extends it to enable the output to be +graphically displayed easily. +\item To do this we need to log in to \textbf{nostromo}. +\item Profiling is the process of examining the function and method calls +of a program to determine which how much time is spent in each, how +many times they are called, and the call tree (what calls what and +for how long). +\item We profile so we know where to best optimise our programs. For +example, if the program spends just \textbf{2\%} of its time in one function, +there is little point optimising it. +\end{itemize} +\section{Valgrind Task} +\label{sec-2} +\begin{itemize} +\item To fetch it from its gitlab repository type the following +\item \textbf{git clone \url{https://gitlab.com/carey.pridgeon/gdb_worksheet_material.git}} +\item Now cd into the directory and open the programs Makefile. +\end{itemize} +\subsection{Edit the Makefile} +\label{sec-2-1} +\begin{itemize} +\item We need to add a compiler directive to add profiling symbols to the +compiled code. +\item To do this find the following lines: +\end{itemize} +\begin{verbatim} +$(EXE): $(OBJS) + $(CC) $(OBJS) $(LIB_DIRS) $(LLIBS)$(LDFLAGS) -o $(EXE) +\end{verbatim} +\begin{itemize} +\item And update it to include \textbf{-pg} +\end{itemize} +\begin{verbatim} +$(EXE): $(OBJS) + $(CC) $(OBJS) $(LIB_DIRS) $(LLIBS)$(LDFLAGS) -pg -o $(EXE) +\end{verbatim} +\begin{itemize} +\item and do the same to the following line +\end{itemize} +\begin{verbatim} +CFLAGS = -Wall -O3 +\end{verbatim} +becomes +\begin{verbatim} +CFLAGS = -Wall -O3 -pg +\end{verbatim} +\begin{itemize} +\item Now we compile the code by typing \textbf{make clean \&\& make} +\end{itemize} +\subsection{Running Valgrind} +\label{sec-2-2} +\begin{itemize} +\item \textbf{valgrind --tool=callgrind ./nmod} (that's two minus signs before tool) +\item Run the command +\item Once nmod completes, it will have generated a file called +\item \textbf{callgrind.out.[number]} in the nmod folder. +\item This file represents a call graph for nmod, and we need to pass the program +and this file to valgrind to generate the kcachegrind readable profiler +output. +\item Once this command finishes, type \textbf{kcachegrind} +\item This will launch a graphical program that will parse the output file. +\end{itemize} +\subsection{Reading the output} +\label{sec-2-3} +\begin{itemize} +\item You will see a great deal of information on the performance of the +program, including call graphs and percentage of runtime/call count +occupied by given functions. +\item Find the program function called most often (in which the program spends most +of its processing time. +\item What function calls it? +\item Does it call any other functions from the program? +\item Which function is called the smallest number of times (but more than +once)? +\item Find a function that you think lies roughly half way, in terms of +times called and runtime, between these two extremes. +\end{itemize} +\subsection{Submission for this task} +\label{sec-2-4} +\begin{itemize} +\item Write the name of these functions, and their call counts/total +runtime in your report. +\item Include an exported image of the call graph for each function in +your submission. Right Clicking on the call graph picture brings up +this option. +\end{itemize} + +\section{GDB} +\label{sec-3} +\begin{itemize} +\item GDB is the GNU foundations debugging tool. +\item Setting up the program to work with GDB is the same as for Gprof, +except instead of \textbf{-pg}, we just use \textbf{-g}. +\item Once the Makefile has been altered, re-compile the program \textbf{make +clean \&\& make} +\item And run it with GDB by typing: \textbf{gdb ./nmod} +\item This launches the gdb console ready for us to start debugging the program. +\end{itemize} +\subsection{GDB Commands} +\label{sec-3-1} +\subsubsection{tui} +\label{sec-3-1-1} +to launch gdb with tui (text User Interface) type \textbf{gdb -tui} +\subsubsection{run} +\label{sec-3-1-2} +This launches the program. If we run it without setting any +breakpoints it will run to completion. If there is a program killing +bug it will crash in gdb and produce a useful trace we can use to +begin the analysis. +\subsubsection{break} +\label{sec-3-1-3} +\begin{itemize} +\item In order to stop the program at a specific point so we can examine +it more closely we need to set breakpoints. +\item A breakpoint is a point in the running program where execution will +halt, allowing us to examine program state and advance through the +program step by step to isolate an error. +\item To set a breakpoint we must specify either a function/method name, +ora sourcefile name and line number. +\item So if we want to put a breakpoint for a function \textbf{\_funcname} we do +as follows: \textbf{break \_funcname} +\item So now when we type \textbf{run} the program will halt at the break point, +allowing us to control the program from there on. +\item Alternatively you can specify a location in the source file, but we +won't use that: +\end{itemize} +\subsubsection{step} +\label{sec-3-1-4} +\begin{itemize} +\item Using this command we can \emph{step} through the program one line at a +time to see if a program works or if and where it crashes. To step +in more than once, set a value: e,g step \textbf{5} +\end{itemize} +\subsubsection{print} +\label{sec-3-1-5} +\begin{itemize} +\item By typing \textbf{print [variablename]} we can inspect the contents of a +variable. +\item We can also print the contents of a static array, eg: \textbf{print +array\big[0\big]} +\end{itemize} +\subsubsection{until} +\label{sec-3-1-6} +\begin{itemize} +\item This will, if you are in a loop, continue running the program until +the loop exits. +\end{itemize} +\subsubsection{list} +\label{sec-3-1-7} +\begin{itemize} +\item This will list a specified number of lines of code forward from the +current position in the code: +\begin{itemize} +\item \textbf{list n} +\item Where n is the number of lines to display. +\end{itemize} +\end{itemize} +\subsubsection{quit} +\label{sec-3-1-8} +\begin{itemize} +\item Typing the \textbf{quit} command will exit the program. +\end{itemize} +\subsection{task} +\label{sec-3-2} +\begin{itemize} +\item Set a breakpoint at \_find\_gravitational\_interaction\_between\_pair\_of\_particles +\item Step in once, then examine \textbf{(local\_particles + 4) (this is the Earths Moon)}. +\item To examine a single component of the particle using print, derefence that +particle (A private member were it an object, but it's a struct, so it's public, +we can look at it). Look in the file nmod\_structures.h for the particle type +to find some more elements -, xpos, xpos, mass, radius etc. +\item Display five of them individually, then all of them at once by +dereferencing the entire particle. +\item Instruct gdb to continue till the for loop is done, then do so +again. list the source code, pressing enter until you are out of +lines, then type until again to finish the loop operation and move +to the calling function, then list again. +\end{itemize} +\subsection{Submission for this task} +\label{sec-3-3} +screenshot your progress as you examine the variable values, and put +this in your report. +% Emacs 25.3.50.1 (Org mode 8.2.10) +\end{document} \ No newline at end of file diff --git a/Worksheets/worksheets/gdb/Valgrind_GDB_model_answer.tex b/Worksheets/worksheets/gdb/Valgrind_GDB_model_answer.tex new file mode 100644 index 0000000..3d39a00 --- /dev/null +++ b/Worksheets/worksheets/gdb/Valgrind_GDB_model_answer.tex @@ -0,0 +1,46 @@ +% Created 2019-08-20 Tue 09:45 +\documentclass[minimal, t]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{fixltx2e} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{wrapfig} +\usepackage{rotating} +\usepackage[normalem]{ulem} +\usepackage{amsmath} +\usepackage{textcomp} +\usepackage{marvosym} +\usepackage{wasysym} +\usepackage{amssymb} +\usepackage{hyperref} +\tolerance=1000 +\author{Carey Pridgeon} +\date{\today} +\title{GDB and Valgrind Tutorial} +\hypersetup{ + pdfkeywords={}, + pdfsubject={}, + pdfcreator={Emacs 25.3.50.1 (Org mode 8.2.10)}} +\begin{document} + +\maketitle + +\section{Marking Guide} +\label{sec-1} +\begin{itemize} +\item All is academic judgement until the following: +\end{itemize} +\section{Valgrind evidence} +\label{sec-2} +\begin{itemize} +\item \includegraphics[width=.9\linewidth]{most.png} +\item Most called: \_find\_gravitational\_interaction\_between\_pair\_of\_particles 47,606,400 +\item \includegraphics[width=.9\linewidth]{mid.png} +\item Mid called:\_convert\_gravitational\_effects\_into\_velocity 28,000 +\item \includegraphics[width=.9\linewidth]{least.png} +\item Least called: \_move\_particles\_MP - 14,400 +\end{itemize} +% Emacs 25.3.50.1 (Org mode 8.2.10) +\end{document} \ No newline at end of file diff --git a/Worksheets/worksheets/gdb/least.png b/Worksheets/worksheets/gdb/least.png new file mode 100644 index 0000000..18382b6 Binary files /dev/null and b/Worksheets/worksheets/gdb/least.png differ diff --git a/Worksheets/worksheets/gdb/mid.png b/Worksheets/worksheets/gdb/mid.png new file mode 100644 index 0000000..17daad5 Binary files /dev/null and b/Worksheets/worksheets/gdb/mid.png differ diff --git a/Worksheets/worksheets/gdb/most.png b/Worksheets/worksheets/gdb/most.png new file mode 100644 index 0000000..13f5932 Binary files /dev/null and b/Worksheets/worksheets/gdb/most.png differ diff --git a/Worksheets/worksheets/gdb/src.zip b/Worksheets/worksheets/gdb/src.zip new file mode 100644 index 0000000..fca0269 Binary files /dev/null and b/Worksheets/worksheets/gdb/src.zip differ diff --git a/Worksheets/worksheets/gdb/src/Makefile b/Worksheets/worksheets/gdb/src/Makefile new file mode 100644 index 0000000..3321f86 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/Makefile @@ -0,0 +1,26 @@ +# -*-Mode: Makefile;-*- +# vi: sw=8 ts=8 noet +# vim: sw=8 ts=8 noet + +CC = gcc +CFLAGS = -Wall -O3 +LDFLAGS = -lm + +#---------- + +EXE = nmod + +OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) + +#---------- + +$(EXE): $(OBJS) + $(CC) $(OBJS) $(LIB_DIRS) $(LLIBS)$(LDFLAGS) -o $(EXE) + +$(OBJS): %.o : %.c + $(CC) $(CFLAGS) -c $< + +#---------- + +clean: + rm -f *.o *.*~ *~ $(EXE).exe diff --git a/Worksheets/worksheets/gdb/src/_account_for_inertia.c b/Worksheets/worksheets/gdb/src/_account_for_inertia.c new file mode 100644 index 0000000..89d6c4b --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_account_for_inertia.c @@ -0,0 +1,43 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This function takes the local_particles array and an index into that array as input. +// It applies the inertia of the body in question, and stores the remaining force for +// later application to the particle in question. + +#include "nmod.h" +int _account_for_inertia (particle * local_particles, int index) { + double temp1, temp2, temp3, resultx, resulty, resultz; + /* + get the summed forces acting on this body +*/ + temp1 = (local_particles + index)->xforce; + temp2 = (local_particles + index)->yforce; + temp3 = (local_particles + index)->zforce; + /* + account for inertia to be overcome +*/ + resultx = (temp1) / (local_particles + index)->mass; + resulty = (temp2) / (local_particles + index)->mass; + resultz = (temp3) / (local_particles + index)->mass; + /* + store the resultant force for each axis +*/ + (local_particles + index)->grav_x = resultx; + (local_particles + index)->grav_y = resulty; + (local_particles + index)->grav_z = resultz; + return 0; +} diff --git a/Worksheets/worksheets/gdb/src/_alloc_mem.c b/Worksheets/worksheets/gdb/src/_alloc_mem.c new file mode 100644 index 0000000..0824d69 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_alloc_mem.c @@ -0,0 +1,32 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: Function used to allocate memory to single variables. + +#include +#include +#include + +void *_alloc_mem (size_t size) { + void *amount; + amount = malloc (size); + if (!amount) { + printf ("\nno memory free - exiting\n"); + exit (errno); + } + return amount; +} diff --git a/Worksheets/worksheets/gdb/src/_alloc_mem_contiguous.c b/Worksheets/worksheets/gdb/src/_alloc_mem_contiguous.c new file mode 100644 index 0000000..6d5292e --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_alloc_mem_contiguous.c @@ -0,0 +1,29 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: Function used to allocate memory to dynamic arrays. + +#include "nmod.h" +void *_alloc_mem_contiguous (int length, size_t size) { + void *amount; + amount = calloc (length, size); + if (amount == NULL) { + printf ("\nno memory free for calloc - exiting\n"); + exit (errno); + } + return amount; +} diff --git a/Worksheets/worksheets/gdb/src/_calculate_forces_acting_between_all_particles.c b/Worksheets/worksheets/gdb/src/_calculate_forces_acting_between_all_particles.c new file mode 100644 index 0000000..1cfac53 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_calculate_forces_acting_between_all_particles.c @@ -0,0 +1,33 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This function calls the _find_gravitational_interaction_between_pair_of_particles function once for each pair in the pairs linked list. + +#include "nmod.h" +int _calculate_forces_acting_between_all_particles (particle_pair * begin, particle * local_particles, double G) { + int i, j; + //go through the linked list of particle pairs + while (begin->m1 != -1) { + while (begin->next != NULL) { + i = begin->m1; + j = begin->m2; + _find_gravitational_interaction_between_pair_of_particles (local_particles, i, j, G); + begin = begin->next; + } + } + return 0; +} diff --git a/Worksheets/worksheets/gdb/src/_clear_total_gravitational_force_accumulators.c b/Worksheets/worksheets/gdb/src/_clear_total_gravitational_force_accumulators.c new file mode 100644 index 0000000..a11ac12 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_clear_total_gravitational_force_accumulators.c @@ -0,0 +1,32 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This function resets the accumulator fields of the local_particles array that store the sum of +// gravitational forces for the particles + +#include "nmod.h" + +int _clear_total_gravitational_force_accumulators (particle * local_particles, int num_local_particles) { + int i; + for (i = 0; i < num_local_particles; i++) { + (local_particles + i)->xforce = 0.0; + (local_particles + i)->yforce = 0.0; + (local_particles + i)->zforce = 0.0; + } + return 0; +} diff --git a/Worksheets/worksheets/gdb/src/_convert_gravitational_effects_into_velocity.c b/Worksheets/worksheets/gdb/src/_convert_gravitational_effects_into_velocity.c new file mode 100644 index 0000000..800392d --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_convert_gravitational_effects_into_velocity.c @@ -0,0 +1,39 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This function takes as input the local_particles array, the number of local_particles, +// and a pointer to the top of the linked list of pairs as input. +// It calls the _calculate_forces_acting_between_all_particles and get_kps functions, and returns the +// derivatives for this step + +#include "nmod.h" +int _convert_gravitational_effects_into_velocity (particle * local_particles, int num_local_particles, particle_pair *begin, double G) { + /* + reset forces accumulator +*/ + _clear_total_gravitational_force_accumulators (local_particles, num_local_particles); + /* + get gravitational forces +*/ + _calculate_forces_acting_between_all_particles (begin, local_particles, G); + /* + translate these into movements on x, y and z per second +*/ + _find_meters_per_second_velocity (local_particles, num_local_particles); + return 0; +} + diff --git a/Worksheets/worksheets/gdb/src/_create_particle_pairs_node.c b/Worksheets/worksheets/gdb/src/_create_particle_pairs_node.c new file mode 100644 index 0000000..79a7505 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_create_particle_pairs_node.c @@ -0,0 +1,38 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This function creates a node for the particle pairs linked list, or exits on error +#include "nmod.h" +particle_pair *_create_particle_pairs_node (int location1, int location2) { + particle_pair *temp = (particle_pair *) malloc (sizeof (particle_pair)); /* allocate memory for this + particle_pair */ + if (temp == NULL) { + /* + Errooor! + */ + fprintf (stderr, + "memory allocation failure on pairs list creation - exiting"); + exit (errno); + } + /* + memory is available +*/ + temp->m1 = location1; + temp->m2 = location2; + temp->next = NULL; + return temp; +} /*end */ diff --git a/Worksheets/worksheets/gdb/src/_delete_list_of_pairs.c b/Worksheets/worksheets/gdb/src/_delete_list_of_pairs.c new file mode 100644 index 0000000..dc3edb4 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_delete_list_of_pairs.c @@ -0,0 +1,32 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This function deletes the particle pairs linked list + +#include "nmod.h" +int _delete_list_of_pairs (particle_pair *begin) { + particle_pair *temp; + /* + go through the linked list of pairs +*/ + do { + temp = begin; + begin = begin->next; + free (temp); + } + while (begin); + return 0; +} diff --git a/Worksheets/worksheets/gdb/src/_find_gravitational_interaction_between_pair_of_particles.c b/Worksheets/worksheets/gdb/src/_find_gravitational_interaction_between_pair_of_particles.c new file mode 100644 index 0000000..04f8efe --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_find_gravitational_interaction_between_pair_of_particles.c @@ -0,0 +1,178 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This function takes as the array of particles, and two +// indexes into that array, and outputs the +// gravitational forces between thos particles. +// The indexes have to be valid, as there are no checks. + + +#include "nmod.h" +int _find_gravitational_interaction_between_pair_of_particles (particle * local_particles, int m1, int m2, double G) { + double a, b, c, d, e, grav_force; + double t1, t2, t3, res1, res2, bit; + /* + get the distance +*/ + a = (local_particles + m1)->xloc - (local_particles + m2)->xloc; + b = (local_particles + m1)->yloc - (local_particles + m2)->yloc; + e = (local_particles + m1)->zloc - (local_particles + m2)->zloc; + c = (sqr (a) + sqr (b) + sqr (e)); + d = sqrt (c); + /* + now calculate gravitational force +*/ + grav_force = + G * ((local_particles + m1)->mass * (local_particles + m2)->mass) / c; + /* + ######################################################## + * # Sum gravitational forces in the accumulator array. # + * # This applies each gravitational force to the body # + * # in question,taking account of relative positions of # + * # local_particles in the WCS. # + * ######################################################## +*/ + /* + test to find in which direction force must be applied +*/ + /* + X for m1 first +*/ + t1 = (local_particles + m1)->xloc; + t2 = (local_particles + m2)->xloc; + res1 = sqr (t1 - t2); + /* + take 1/4 of the distance. This will be used as the bit to add +*/ + bit = res1 / 4; + t3 = (local_particles + m1)->xloc + bit; + res2 = sqr (t3 - t2); + if (res2 < res1) { + /* + direction to apply force to m1 found + */ + (local_particles + m1)->xforce += (grav_force * a / d); + } + else { + (local_particles + m1)->xforce -= (grav_force * a / d); + } + /* + X for m2 now +*/ + t1 = (local_particles + m1)->xloc; + t2 = (local_particles + m2)->xloc; + res1 = sqr (t1 - t2); + /* + take 1/4 of the distance. This will be used as the bit to add +*/ + bit = res1 / 4; + t3 = (local_particles + m2)->xloc + bit; + res2 = sqr (t3 - t1); + if (res2 < res1) { + /* + direction to apply force to m2 found + */ + (local_particles + m2)->xforce += (grav_force * a / d); + } + else { + (local_particles + m2)->xforce -= (grav_force * a / d); + } + /* + Y for m1 first +*/ + t1 = (local_particles + m1)->yloc; + t2 = (local_particles + m2)->yloc; + res1 = sqr (t1 - t2); + /* + take 1/4 of the distance. This will be used as the bit to add +*/ + bit = res1 / 4; + t3 = (local_particles + m1)->yloc + bit; + res2 = sqr (t3 - t2); + if (res2 < res1) { + /* + direction to apply force to m1 found + */ + (local_particles + m1)->yforce += (grav_force * b / d); + } + else { + (local_particles + m1)->yforce -= (grav_force * b / d); + } + /* + Y for m2 now +*/ + t1 = (local_particles + m1)->yloc; + t2 = (local_particles + m2)->yloc; + res1 = sqr (t1 - t2); + /* + take 1/4 of the distance. This will be used as the bit to add +*/ + bit = res1 / 4; + t3 = (local_particles + m2)->yloc + bit; + res2 = sqr (t3 - t1); + if (res2 < res1) { + /* + direction to apply force to m2 found + */ + (local_particles + m2)->yforce += (grav_force * b / d); + } + else { + (local_particles + m2)->yforce -= (grav_force * b / d); + } + /* + Z for m1 first +*/ + t1 = (local_particles + m1)->zloc; + t2 = (local_particles + m2)->zloc; + res1 = sqr (t1 - t2); + /* + take 1/4 of the distance. This will be used as the bit to add +*/ + bit = res1 / 4; + t3 = (local_particles + m1)->zloc + bit; + res2 = sqr (t3 - t2); + if (res2 < res1) { + /* + direction to apply force to m1 found + */ + (local_particles + m1)->zforce += (grav_force * e / d); + } + else { + (local_particles + m1)->zforce -= (grav_force * e / d); + } + /* + Z for m2 now +*/ + t1 = (local_particles + m1)->zloc; + t2 = (local_particles + m2)->zloc; + res1 = sqr (t1 - t2); + /* + take 1/4 of the distance. This will be used as the bit to add +*/ + bit = res1 / 4; + t3 = (local_particles + m2)->zloc + bit; + res2 = sqr (t3 - t1); + if (res2 < res1) { + /* + direction to apply force to m2 found + */ + (local_particles + m2)->zforce += (grav_force * e / d); + } + else { + (local_particles + m2)->zforce -= (grav_force * e / d); + } + return 0; +} diff --git a/Worksheets/worksheets/gdb/src/_find_meters_per_second_velocity.c b/Worksheets/worksheets/gdb/src/_find_meters_per_second_velocity.c new file mode 100644 index 0000000..45b4f39 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_find_meters_per_second_velocity.c @@ -0,0 +1,31 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This function takes as input a bodies array and +// the total number of bodies in that array. It calls +// the account_for_inertia function for each element of the bodies array + +#include "nmod.h" +int _find_meters_per_second_velocity (particle *local_bodies, int num_local_bodies) { + int i; + for (i = 0; i < num_local_bodies; i++) { + _account_for_inertia (local_bodies, i); + } + return 0; +} + + diff --git a/Worksheets/worksheets/gdb/src/_make_set_of_particle_pairs.c b/Worksheets/worksheets/gdb/src/_make_set_of_particle_pairs.c new file mode 100644 index 0000000..bc93323 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_make_set_of_particle_pairs.c @@ -0,0 +1,60 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This function takes as input the amount of bodies in the simulation, and +// returns a pointer to the top of a linked list of pairs without duplicates. + +#include "nmod.h" +particle_pair *_make_set_of_particle_pairs (int amount) { + /* + get list to make SET without duplicates from simple FOR loops +*/ + int i, j, k; + particle_pair *first; + particle_pair *old; + particle_pair *latest; + /* + make the first link in the list, and a pointer to it +*/ + first = _create_particle_pairs_node (-1, -1); + old = _create_particle_pairs_node (-1, -1); + old->next = first; + latest = _create_particle_pairs_node (-1, -1); + k = amount; + /* + now make the list +*/ + for (i = amount - 1; i > -1; i--) { + for (j = k - 1; j > -1; j--) { + if (i == j) { + continue; + } + latest = _create_particle_pairs_node (i, j); + latest->next = old->next; + old->next = latest; + } + k--; + } + /* + free up unused particle_pairs before finishing +*/ + old = NULL; + first = NULL; + free (old); + free (first); + return latest; +}; diff --git a/Worksheets/worksheets/gdb/src/_move_particles_MP.c b/Worksheets/worksheets/gdb/src/_move_particles_MP.c new file mode 100644 index 0000000..f036471 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_move_particles_MP.c @@ -0,0 +1,110 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: Mid Point Integration method + +#include "nmod.h" +int _move_particles_MP (particle * local_particles, rk4_store * local_store, int +time, int num_local_particles, particle_pair * begin, +int collapsor, double G) { + int j, a, k, c, r, l; + /******************************************** +* preperation for Mid Point Integration * +******************************************** +*/ + /* + obtain the first derivative +*/ + _convert_gravitational_effects_into_velocity (local_particles, num_local_particles, begin, G); + /* + store out the initial x,y location, speed and _convert_gravitational_effects_into_velocity of all particles +*/ + for (k = 0; k < num_local_particles; k++) { + if (k != collapsor) { + /* + if not the sun + */ + (local_particles + k)->xloctemp = (local_particles + k)->xloc; + (local_particles + k)->yloctemp = (local_particles + k)->yloc; + (local_particles + k)->zloctemp = (local_particles + k)->zloc; + (local_particles + k)->xsptemp = (local_particles + k)->xsp; + (local_particles + k)->ysptemp = (local_particles + k)->ysp; + (local_particles + k)->zsptemp = (local_particles + k)->zsp; + } + } + /* + move the particles to the mid point of the step +*/ + for (a = 0; a < time / 2; a++) { + for (j = 0; j < num_local_particles; j++) { + if (j != collapsor) { + /* + if not the sun + */ + (local_particles + j)->xsp += (local_particles + j)->grav_x; + (local_particles + j)->ysp += (local_particles + j)->grav_y; + (local_particles + j)->zsp += (local_particles + j)->grav_z; + (local_particles + j)->xloc += (local_particles + j)->xsp; + (local_particles + j)->yloc += (local_particles + j)->ysp; + (local_particles + j)->zloc += (local_particles + j)->zsp; + } + } + } + /*********** +* Step two * +************ +*/ + /* + obtain the midpoint derivative +*/ + _convert_gravitational_effects_into_velocity (local_particles, num_local_particles, begin, G); + /* + swap the start condition for the particles back in +*/ + for (c = 0; c < num_local_particles; c++) { + if (c != collapsor) { + /* + if not the sun + */ + (local_particles + c)->xloc = (local_particles + c)->xloctemp; + (local_particles + c)->yloc = (local_particles + c)->yloctemp; + (local_particles + c)->zloc = (local_particles + c)->zloctemp; + (local_particles + c)->xsp = (local_particles + c)->xsptemp; + (local_particles + c)->ysp = (local_particles + c)->ysptemp; + (local_particles + c)->zsp = (local_particles + c)->zsptemp; + } + } + /* + move particles across the entire step +*/ + for (r = 0; r < time; r++) { + for (l = 0; l < num_local_particles; l++) { + if (l != collapsor) { + /* + if not the sun + */ + (local_particles + l)->xsp += (local_particles + l)->grav_x; + (local_particles + l)->ysp += (local_particles + l)->grav_y; + (local_particles + l)->zsp += (local_particles + l)->grav_z; + (local_particles + l)->xloc += (local_particles + l)->xsp; + (local_particles + l)->yloc += (local_particles + l)->ysp; + (local_particles + l)->zloc += (local_particles + l)->zsp; + } + } + } + return 1; +} /* end of Mid Point integration function */ diff --git a/Worksheets/worksheets/gdb/src/_move_particles_RK4.c b/Worksheets/worksheets/gdb/src/_move_particles_RK4.c new file mode 100644 index 0000000..7bc03a2 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_move_particles_RK4.c @@ -0,0 +1,243 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: Fourth Order Runge Kutta Integration method. +// Scary math description: +// k1 = hf(xn,yn) +// k2 = hf(xn+h/2,yn+ k1/2) +// k3 = hf(xn+h/2. yn+k2/2) +// k4 = hf(xn+h,yn+k3) +// yn+1 =yn + k1/6 + k2/3 + k3/3 + k4/6 +O(h^5) + +#include "nmod.h" +int _move_particles_RK4 (particle * local_particles, rk4_store * local_store, +int time, int num_local_particles, particle_pair * begin, +int collapsor, double G) { + + int i, j, a, k, c, n, r, l, x, o, p, t, f, w, v; + + /* + obtain the first derivative +*/ + _convert_gravitational_effects_into_velocity (local_particles, num_local_particles, begin, G); + + /* + store out the initial x,y location, speed and _convert_gravitational_effects_into_velocity of all particles +*/ + for (k = 0; k < num_local_particles; k++) { + if (k != collapsor) { /*if not the sun */ + (local_particles + k)->xloctemp = (local_particles + k)->xloc; + (local_particles + k)->yloctemp = (local_particles + k)->yloc; + (local_particles + k)->zloctemp = (local_particles + k)->zloc; + (local_particles + k)->xsptemp = (local_particles + k)->xsp; + (local_particles + k)->ysptemp = (local_particles + k)->ysp; + (local_particles + k)->zsptemp = (local_particles + k)->zsp; + /* + temp _convert_gravitational_effects_into_velocity local_store array + */ + (local_store + k)->xforce1 = (local_particles + k)->grav_x; + (local_store + k)->yforce1 = (local_particles + k)->grav_y; + (local_store + k)->zforce1 = (local_particles + k)->grav_z; + } + } + + /* + move the particles to the first trial mid point +*/ + for (a = 0; a < time / 2; a++) { + for (j = 0; j < num_local_particles; j++) { + if (j != collapsor) { /*if not the sun */ + (local_particles + j)->xsp += (local_particles + j)->grav_x; + (local_particles + j)->ysp += (local_particles + j)->grav_y; + (local_particles + j)->zsp += (local_particles + j)->grav_z; + (local_particles + j)->xloc += (local_particles + j)->xsp; + (local_particles + j)->yloc += (local_particles + j)->ysp; + (local_particles + j)->zloc += (local_particles + j)->zsp; + } + } + } + + /*********** + * Step two * + ************ + */ + + /* + obtain the second midpoint derivative +*/ + _convert_gravitational_effects_into_velocity (local_particles, num_local_particles, begin, G); + + /* + store that out into the derivatives local_store array +*/ + for (i = 0; i < num_local_particles; i++) { + if (i != collapsor) { /*if not the sun */ + (local_store + i)->xforce2 = (local_particles + i)->grav_x; + (local_store + i)->yforce2 = (local_particles + i)->grav_y; + (local_store + i)->zforce2 = (local_particles + i)->grav_z; + } + } + + /* + swap the start condition for the particles back in +*/ + for (c = 0; c < num_local_particles; c++) { + if (c != collapsor) { /*if not the sun */ + (local_particles + c)->xloc = (local_particles + c)->xloctemp; + (local_particles + c)->yloc = (local_particles + c)->yloctemp; + (local_particles + c)->zloc = (local_particles + c)->zloctemp; + (local_particles + c)->xsp = (local_particles + c)->xsptemp; + (local_particles + c)->ysp = (local_particles + c)->ysptemp; + (local_particles + c)->zsp = (local_particles + c)->zsptemp; + } + } + + /* + move particles to the second trial mid point +*/ + for (r = 0; r < time / 2; r++) { + for (l = 0; l < num_local_particles; l++) { + if (l != collapsor) { /*if not the sun */ + (local_particles + l)->xsp += (local_particles + l)->grav_x; + (local_particles + l)->ysp += (local_particles + l)->grav_y; + (local_particles + l)->zsp += (local_particles + l)->grav_z; + (local_particles + l)->xloc += (local_particles + l)->xsp; + (local_particles + l)->yloc += (local_particles + l)->ysp; + (local_particles + l)->zloc += (local_particles + l)->zsp; + } + } + } + /*************** + * step three * + *************** + */ + /* + obtain the third midpoint derivative +*/ + _convert_gravitational_effects_into_velocity (local_particles, num_local_particles, begin, G); + + /* + store these out into the derivatives local_store array +*/ + for (x = 0; x < num_local_particles; x++) { + if (x != collapsor) { /*if not the sun */ + (local_store + x)->xforce3 = (local_particles + x)->grav_x; + (local_store + x)->yforce3 = (local_particles + x)->grav_y; + (local_store + x)->zforce3 = (local_particles + x)->grav_z; + } + } + + /* + swap the start condition for the particles back in +*/ + for (n = 0; n < num_local_particles; n++) { + if (n != collapsor) { /*if not the sun */ + (local_particles + n)->xloc = (local_particles + n)->xloctemp; + (local_particles + n)->yloc = (local_particles + n)->yloctemp; + (local_particles + n)->zloc = (local_particles + n)->zloctemp; + (local_particles + n)->xsp = (local_particles + n)->xsptemp; + (local_particles + n)->ysp = (local_particles + n)->ysptemp; + (local_particles + n)->zsp = (local_particles + n)->zsptemp; + } + } + + /* + move particles across the whole interval using the third derivatives +*/ + for (o = 0; o < time; o++) { + for (p = 0; p < num_local_particles; p++) { + if (p != collapsor) { /*if not the sun */ + (local_particles + p)->xsp += (local_particles + p)->grav_x; + (local_particles + p)->ysp += (local_particles + p)->grav_y; + (local_particles + p)->zsp += (local_particles + p)->grav_z; + (local_particles + p)->xloc += (local_particles + p)->xsp; + (local_particles + p)->yloc += (local_particles + p)->ysp; + (local_particles + p)->zloc += (local_particles + p)->zsp; + } + } + } + + /*************** + * step four * + *************** + */ + /* + obtain the fourth derivative +*/ + _convert_gravitational_effects_into_velocity (local_particles, num_local_particles, begin, G); + + /* + store out into the derivatives local_store array +*/ + for (t = 0; t < num_local_particles; t++) { + if (t != collapsor) { /*if not the sun */ + (local_store + t)->xforce4 = (local_particles + t)->grav_x; + (local_store + t)->yforce4 = (local_particles + t)->grav_y; + (local_store + t)->zforce4 = (local_particles + t)->grav_z; + } + } + + /*************** + * Final stage * + *************** + */ + + /* + swap the start condition for the particles back in +*/ + for (f = 0; f < num_local_particles; f++) { + if (f != collapsor) { /*if not the sun */ + (local_particles + f)->xloc = (local_particles + f)->xloctemp; + (local_particles + f)->yloc = (local_particles + f)->yloctemp; + (local_particles + f)->zloc = (local_particles + f)->zloctemp; + (local_particles + f)->xsp = (local_particles + f)->xsptemp; + (local_particles + f)->ysp = (local_particles + f)->ysptemp; + (local_particles + f)->zsp = (local_particles + f)->zsptemp; + } + } + + /* + Move the particles across the whole interval, + * adding the derivatives from each step with + * the correct weights +*/ + + for (v = 0; v < time; v++) { + for (w = 0; w < num_local_particles; w++) { + if (w != collapsor) { /*if not the sun */ + (local_particles + w)->xsp += + ((local_store + w)->xforce1 + (local_store + w)->xforce4 + + (2 * (local_store + w)->xforce2) + + (2 * (local_store + w)->xforce3)) / 6; + (local_particles + w)->ysp += + ((local_store + w)->yforce1 + (local_store + w)->yforce4 + + (2 * (local_store + w)->yforce2) + + (2 * (local_store + w)->yforce3)) / 6; + (local_particles + w)->zsp += + ((local_store + w)->zforce1 + (local_store + w)->zforce4 + + (2 * (local_store + w)->zforce2) + + (2 * (local_store + w)->zforce3)) / 6; + (local_particles + w)->xloc += (local_particles + w)->xsp; + (local_particles + w)->yloc += (local_particles + w)->ysp; + (local_particles + w)->zloc += (local_particles + w)->zsp; + } + } + } + + return 1; +} /* end of runge Kutta Fourth order integration function */ diff --git a/Worksheets/worksheets/gdb/src/_parse_line.c b/Worksheets/worksheets/gdb/src/_parse_line.c new file mode 100644 index 0000000..a2cc014 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/_parse_line.c @@ -0,0 +1,60 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: Simple function to parse a line of text and tokenise it into three words. +// pretty basic really, can only do three words. + +#include "nmod.h" +void _parse_line (char *input, char *word1, char *word2, char *word3) { + int a, pos; + a = pos = 0; + + while (1) { + while ((input[pos] != '\0') && (input[pos] != ' ') + && (input[pos] != '\n') && (input[pos] != '\r')) { + word1[a] = input[pos]; + a++; + pos++; + } + if (input[pos] == '\0') { + break; + } + a = 0; + pos++; + while ((input[pos] != '\0') && (input[pos] != ' ') + && (input[pos] != '\n') && (input[pos] != '\r')) { + word2[a] = input[pos]; + a++; + pos++; + } + if (input[pos] == '\0') { + break; + } + a = 0; + pos++; + while ((input[pos] != '\0') && (input[pos] != ' ') + && (input[pos] != '\n') && (input[pos] != '\r')) { + word3[a] = input[pos]; + a++; + pos++; + } + if (input[pos] == '\0') { + break; + } + } +} diff --git a/Worksheets/worksheets/gdb/src/export_project_from_current_state.c b/Worksheets/worksheets/gdb/src/export_project_from_current_state.c new file mode 100644 index 0000000..98b5d50 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/export_project_from_current_state.c @@ -0,0 +1,78 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: writes out the current state of all particles in the model. +// Preceedes this with the nmp file entry fro the number of particles. +// All other nmp file information must be added manually. + +#include "nmod.h" +int export_project_from_current_state (char *filename, project * subject) { + int i; + FILE *out; + out = fopen (filename, "w"); + if (out == NULL) { + fprintf (stderr, + "> +++ FTB error +++ replace fluffy teddy bear to continue +++\n"); + fprintf (stderr, + "> (Unable to create file to store the final state in nmp format)\n"); + } + fprintf (out, "# the number of particles in this project\n"); + fprintf (out, "particle population %d\n", subject->num_particles); + fprintf (out, "#\n"); + fprintf (out, ""); // newline handled below + /* + writing particle data +*/ + for (i = 0; i < subject->num_particles; i++) { + fprintf (out, "\nparticle ident %s", + (subject->particles + i)->particle_id); + if ((subject->particles + i)->type == MASSIVE_PARTICLE_3) { + fprintf (out, "\nparticle type massive_3"); + } + if ((subject->particles + i)->type == MASSIVE_PARTICLE_2) { + fprintf (out, "\nparticle type massive_2"); + } + if ((subject->particles + i)->type == MASSIVE_PARTICLE_1) { + fprintf (out, "\nparticle type massive_1"); + } + if ((subject->particles + i)->type == MAJOR_PARTICLE_2) { + fprintf (out, "\nparticle type major_2"); + } + if ((subject->particles + i)->type == MAJOR_PARTICLE_1) { + fprintf (out, "\nparticle type major_1"); + } + if ((subject->particles + i)->type == MINOR_PARTICLE_2) { + fprintf (out, "\nparticle type minor_2"); + } + if ((subject->particles + i)->type == MINOR_PARTICLE_1) { + fprintf (out, "\nparticle type minor_1"); + } + fprintf (out, "\nparticle red %d", (subject->particles + i)->rgb_vals.r); + fprintf (out, "\nparticle green %d", + (subject->particles + i)->rgb_vals.g); + fprintf (out, "\nparticle blue %d", (subject->particles + i)->rgb_vals.b); + fprintf (out, "\nfree text %s", (subject->particles + i)->freetext); + fprintf (out, "\nX position %.10e", (subject->particles + i)->xloc); + fprintf (out, "\nY position %.10e", (subject->particles + i)->yloc); + fprintf (out, "\nZ position %.10e", (subject->particles + i)->zloc); + fprintf (out, "\nX velocity %.10e", (subject->particles + i)->xsp); + fprintf (out, "\nY velocity %.10e", (subject->particles + i)->ysp); + fprintf (out, "\nZ velocity %.10e", (subject->particles + i)->zsp); + } + fclose (out); + return 0; +} diff --git a/Worksheets/worksheets/gdb/src/free_and_delete_project.c b/Worksheets/worksheets/gdb/src/free_and_delete_project.c new file mode 100644 index 0000000..6aff0bb --- /dev/null +++ b/Worksheets/worksheets/gdb/src/free_and_delete_project.c @@ -0,0 +1,29 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: Free the memory assigned to a project. + +#include "nmod.h" +int free_and_delete_project (project * project) { + free (project->particles); + free (project->store); + _delete_list_of_pairs (project->begin); + + free(project); + return 0; +} + diff --git a/Worksheets/worksheets/gdb/src/gpl.txt b/Worksheets/worksheets/gdb/src/gpl.txt new file mode 100644 index 0000000..4432540 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/gpl.txt @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/Worksheets/worksheets/gdb/src/initialise_nbo_file.c b/Worksheets/worksheets/gdb/src/initialise_nbo_file.c new file mode 100644 index 0000000..8ec2ee6 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/initialise_nbo_file.c @@ -0,0 +1,48 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This function creates the ouput nbo file, and writes the preamble to it. + +#include "nmod.h" +int _initialise_nbo_file (project * local_project) { + + //first off, edit the nbo filename using the globally available + // char array 'nbo_append_text', which is itself set using the function 'set_nbo_append' + sprintf(local_project->outputfilename,"%s%s.nbo",local_project->outputfilename,local_project->nbo_append_text); + + // opening as writeable binary + local_project->outfile = fopen (local_project->outputfilename, "w"); + + /* + * reset the file pointer to start of file + */ + if ((fseek (local_project->outfile, 0, SEEK_SET)) == -1) { + printf ("> Error on file pointer reset for %s",local_project->outputfilename); + } + if (local_project->outfile == NULL) { + fprintf (stderr, "nbo file '%s' not opened correctly \n",local_project->outputfilename); + exit (0); + } + // write the nbo file preamble + fprintf (local_project->outfile, "#%d", local_project->states_required); + fprintf (local_project->outfile, ":%d", local_project->num_particles); + fprintf (local_project->outfile, ":%d", local_project->number_of_steps_per_state); + fprintf (local_project->outfile, ":%d#", local_project->particle_info_size); + fclose(local_project->outfile); + return 0; +} + diff --git a/Worksheets/worksheets/gdb/src/load_project_file_into_nmod.c b/Worksheets/worksheets/gdb/src/load_project_file_into_nmod.c new file mode 100644 index 0000000..898a478 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/load_project_file_into_nmod.c @@ -0,0 +1,175 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + + + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This function parses the project file (nmp file) and fills the project data structure that nmod will use. +// +// Since this is the reference build, a lot of EA specific code is commented out at the bottom of this file, and there are a lot +// of options here for entries that are not in the reference build, since they are for experimentation only + +#include "nmod.h" +project * load_project_into_nmod (char *filename, int rval) { + int x, t; + char *inputline; + project *local_project; + char *first_word, *second_word, *value; + first_word = (char *) calloc (100, sizeof (char)); + second_word = (char *) calloc (100, sizeof (char)); + value = (char *) calloc (100, sizeof (char)); + inputline = (char *) calloc (1024, (sizeof (char))); + local_project = _alloc_mem (sizeof (project)); + // is the requested project file in the specified location? + inputfile = fopen (filename, "r"); + if (inputfile == NULL) {// not found at current location + free (inputline); + free(local_project); + free (first_word); + free (second_word); + free (value); + free (local_project); + rval = 1; + return NULL; + } + rval = 0; + // now, read the project file. + fseek (inputfile, 0, SEEK_SET); + while (1) { + for (t = 0; t < 100; t++) { + first_word[t] = '\0'; + second_word[t] = '\0'; + value[t] = '\0'; + } + for (t = 0; t < 1024; t++) { + inputline[t] = '\0'; + } + if (fgets (inputline, 1024, inputfile) == NULL) { + printf (" tag not found before end of file"); + local_project->num_particles = -1; + break; + } + if (inputline[0] == '#') { + continue; /* comment in project file */ + } + _parse_line (inputline, first_word, second_word, value); + if ((strcmp ("", first_word)) == 0) { + break; + } + if ((strcmp ("particle", first_word) == 0) && (strcmp ("population", second_word)) == 0) { + local_project->num_particles = atoi (value); + continue; + } + if ((strcmp ("states", first_word) == 0) && (strcmp ("required", second_word) == 0)) { + local_project->states_required = atoi (value); + continue; + } + if ((strcmp (first_word, "step") == 0)&& (strcmp (second_word, "count") == 0)) { + local_project->number_of_steps_per_state = atoi (value); + continue; + } + if ((strcmp ("step", first_word) == 0) && (strcmp ("size", second_word) == 0)) { + local_project->step_size = atoi (value); + continue; + } + if ((strcmp ("collapsor", first_word) == 0) && (strcmp ("defined",second_word) == 0)) { + local_project->collapsor = atoi (value); + continue; + } + if ((strcmp ("gravitational", first_word) == 0) && (strcmp ("constant",second_word) == 0)) { + local_project->G = atof (value); + continue; + } + if ((strcmp ("nbo", first_word) == 0) && (strcmp ("recording", second_word) == 0)) { + if (strcmp ("TRUE", value) == 0) { + local_project->nbo_write_direct = NBO_FILE_ON; + } + else { + local_project->nbo_write_direct = NBO_FILE_OFF; + } + } + if ((strcmp ("output", first_word) == 0) && (strcmp ("filename", second_word) == 0)) { + strcpy (local_project->outputfilename, value); + continue; + } + if ((strcmp ("use", first_word) == 0) && (strcmp ("stdout", second_word) == 0)) { + if (strcmp ("TRUE", value) == 0) { + local_project->use_stdout = 1; + } + else { + local_project->use_stdout = 0; + } + } + if ((strcmp ("write", first_word) == 0) && (strcmp ("project", second_word) == 0)) { + if (strcmp ("TRUE", value) == 0) { + local_project->write_project = TRUE; + } + else { + local_project->write_project = FALSE; + } + } + if ((strcmp ("nbo", first_word) == 0) && (strcmp ("recording", second_word) == 0)) { + if (strcmp ("TRUE", value) == 0) { + local_project->nbo_required = NBO_ON; + } + else { + local_project->nbo_required = NBO_OFF; + } + } + if ((strcmp ("particle", first_word) == 0) && (strcmp ("info_size",second_word) == 0)) { + local_project->particle_info_size = atoi (value); + } + if ((strcmp ("project", first_word) == 0) && (strcmp ("name", second_word) == 0)) { + strcpy (local_project->project_name, value); + continue; + } + if ((strcmp ("final_conditions", first_word) == 0) && (strcmp ("filename", second_word) == 0)) { + strcpy (local_project->final_conditions_filename, value); + continue; + } + if ((strcmp ("integration", first_word) == 0) && (strcmp ("method",second_word)== 0)) { + if (strcmp ("RK4", value) == 0) { + local_project->method = USE_RK4; + } + else if (strcmp ("MidPoint", value) == 0) { + local_project->method = USE_MIDPOINT; + } + continue; + } + + } + /* + reading particle data. First create the array to store them +*/ + local_project->particles = _alloc_mem_contiguous (local_project->num_particles,sizeof (particle)); + /* + create the array to store integration values +*/ + local_project->store = _alloc_mem_contiguous (local_project->num_particles, sizeof (rk4_store)); + for (x = 0; x < local_project->num_particles; x++) { + read_single_particle (inputfile, &(local_project->particles[x]),local_project->particle_info_size); + } + local_project->begin = _make_set_of_particle_pairs (local_project->num_particles); + + + fclose (inputfile); + free (inputline); + free (first_word); + free (second_word); + free (value); + return local_project; +} + diff --git a/Worksheets/worksheets/gdb/src/main.c b/Worksheets/worksheets/gdb/src/main.c new file mode 100644 index 0000000..ea20bcf --- /dev/null +++ b/Worksheets/worksheets/gdb/src/main.c @@ -0,0 +1,46 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + + + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: reference build main + +#include "nmod.h" +int main (int argc, char *argv[]) { + int ret_nb = 0; + int ret = 0; + + // try to open the project file + // this loads the nmp file specified at the command line, and allocates + // memory to all the variables and arrays that nmod needs + //The ea_project structure is global, and declared in nmod.h. + default_project = load_project_into_nmod ("reference_project.nmp",ret); + if (ret == 1){ + printf("> Project file '%s' not found at specified location, exiting\n",argv[1]); + exit(0); + } + + ret_nb = NO_COLLISION; + ret_nb = run_nbody_environment (default_project); + free_and_delete_project (default_project); // this must be called for every project that is instantiated in memory once the program is finished + if (default_project->use_stdout) { + printf("> Finished\n"); + } + return 0; +} + + diff --git a/Worksheets/worksheets/gdb/src/nmod.h b/Worksheets/worksheets/gdb/src/nmod.h new file mode 100644 index 0000000..76ac177 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/nmod.h @@ -0,0 +1,150 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This header file contains definition of all the +// functions used by nMod. +// Additionally, all the system header files used by +// nMod are included in this header. Global File +// pointers are also defined here, rather in globals.h +// because they require stdio.h. +// +// There are lots of function here that are unused in the reference build. + +#ifndef nmodH +#define nmodH + +/*Standard headers*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +//#include +//#include +//#include +//#include +//#include + +/*nMod specific header files*/ +#include "nmod_structures.h" +#include "nmod_defines.h" + +project *default_project; + +/* filename for the project data file as it's read in */ +FILE *inputfile; + +// vars for particle data and config files + +FILE *datafile; + +FILE *configfile; + +// ############################################################## +// # CORE nBody model functions, those that you can ignore when coding an EA +// ############################################################## + +//function to reset gravitational force storage members of local_particles data structure +int _clear_total_gravitational_force_accumulators (particle * local_particles, int num_local_particles); + +//Runge Kutta Fourth Order Integration +int _move_particles_RK4 (particle * local_particles, rk4_store * local_store,int time, int num_local_particles, particle_pair * begin,int collapsor, double G); + +//Mid Point Integration +int _move_particles_MP (particle * local_particles, rk4_store * local_store,int time, int num_local_particles, particle_pair * begin,int collapsor, double G); + +//Top level function to obtain derivatives (gravitational force) +int _convert_gravitational_effects_into_velocity (particle * local_particles, int num_local_particles,particle_pair * begin, double G); + +//function that divides gravitational force of a body with the intertia of that body +int _account_for_inertia (particle * local_particles, int index); + +//function that calls the 'Pull' function for all local_particles +int _find_meters_per_second_velocity (particle * local_particles, int num_local_particles); + +//function that calculates and stores the relative gravitational force for two given local_particles +int _find_gravitational_interaction_between_pair_of_particles (particle * local_particles, int m1, int m2, double G); + +//function that calls the force function for all pairs in the linked list of unique pairs +int _calculate_forces_acting_between_all_particles (particle_pair * begin, particle * local_particles, double G); + +// function to provide a linked list of unique pairing between all local_particles +particle_pair *_make_set_of_particle_pairs (int amount); + +// node creation function for linked list of unique pairs +particle_pair *_create_particle_pairs_node (int location1, int location2); + +/* string tokeniser used by read_config_line function */ +void _parse_line (char *input, char *word1, char *word2, char *word3); + + +// ############################################################## +// # MEMORY HANDLING functions that you might want to edit, but can mostly ignore +// ############################################################## + +//function to allocate memory to data structures - linked lists - single pointers +void *_alloc_mem (size_t size); + +//function to allocate memory to dynamic arrays +void *_alloc_mem_contiguous (int length, size_t size); + +//function that erases the linked list of particle pairs when the program exits + +int _delete_list_of_pairs (particle_pair * begin); + +// ############################################################## +// # NMP MANAGEMENT functions that you might edit, if you make changes to the nmp file +// # and project data structure +// ############################################################## + +// function to read in an nmp file and create a project in memory +project * load_project_into_nmod (char *filename, int rval); + +// function to load in the data for a single particle +void read_single_particle (FILE * current_file, particle * single_particle, int datasize); + +// function to write the current project data to an nmp file. +int export_project_from_current_state (char *filename, project * subject); + +/* function to free the memory assigned to a project */ +int free_and_delete_project (project * project); + +// ############################################################## +// # NBO MANAGEMENT functions that you might edit, if you make changes to the nbo file format +// # or the way they are handled in nmod +// ############################################################## + +// function used when creating the normal output nbo file initially (writes the preamble). +int _initialise_nbo_file (project * local_project); + +// whatever methods in use, this function writes the time series data to it +int write_current_state (project * local_project); + +// ############################################################## +// # nBody model driver +// ############################################################## +// function to operate (drive) the nbody model +int run_nbody_environment (project * local_project); + +#endif diff --git a/Worksheets/worksheets/gdb/src/nmod_defines.h b/Worksheets/worksheets/gdb/src/nmod_defines.h new file mode 100644 index 0000000..ca074af --- /dev/null +++ b/Worksheets/worksheets/gdb/src/nmod_defines.h @@ -0,0 +1,87 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This header file contains all the defines, either macro's or constants, used by nMod. Add all new +// defines in here. +// Do not reference this header file directly in your *.c files. Instead reference nmod.h, which includes +// this header file. + +#ifndef nmod_definesH +#define nmod_definesH + +/*definition of square function*/ +#define sqr(x) ((x)*(x)) + +#define MASSIVE_PARTICLE_3 7 +#define MASSIVE_PARTICLE_2 6 +#define MASSIVE_PARTICLE_1 5 +#define MAJOR_PARTICLE_2 4 +#define MAJOR_PARTICLE_1 3 +#define MINOR_PARTICLE_2 2 +#define MINOR_PARTICLE_1 1 + +#define ACCELARATION_DUE_TO_GRAVITY 9.81 + +#define TRUE 1 +#define FALSE 0 + +#define NBO_ON 1 +#define NBO_OFF 0 +#define NBO_TEMPFILE_ON 1 +#define NBO_TEMPFILE_OFF 0 +#define NBO_MEMORY_ON 1 +#define NBO_MEMORY_OFF 0 +#define NBO_FILE_ON 1 +#define NBO_FILE_OFF 0 +#define RECORD_TO_FILE 0 +#define RECORD_TO_TEMP_FILE 2 +#define PROGRESS_CHECKING_ON 1 +#define PROGRESS_CHECKING_OFF 1 +#define COLLISION_CHECKING_ON 1 +#define COLLISION_CHECKING_OFF 0 +#define DISTANCES_COLLECTION_ON 1 +#define DISTANCES_COLLECTION_OFF 0 +#define pre_evolution_GROUP_ON 1 +#define pre_evolution_GROUP_OFF 0 +#define LARGE 1 +#define SMALL 0 +#define SPECIFIC_IMPULSE 0 +#define EXHAUST_VELOCITY 1 +#define USE_RK4 0 +#define USE_MIDPOINT 1 +#define COLLISION_OCCURED 1 +#define NO_COLLISION 0 +#define ONE_PARTICLE_PAIR 1 +#define TWO_PARTICLE_PAIRS 2 +#define TEN 10 +#define HUNDRED 100 +#define THOUSAND 1000 +#define FIFTY_THOUSAND 50000 +#define HUNDRED_THOUSAND 100000 +#define HALF_MILLION 500000 +#define MILLION 1000000 +#define FIVE_MILLION 5000000 +#define TEN_MILLION 10000000 +#define BILLION 1000000000 + +#define LOW_EARTH_ORBIT 2000000 +// define that means write to the temp particle +#define TEMP_PARTICLE -1 +#define PI 3.141592653589793 +#define PI_AS_INT 314 +#endif diff --git a/Worksheets/worksheets/gdb/src/nmod_structures.h b/Worksheets/worksheets/gdb/src/nmod_structures.h new file mode 100644 index 0000000..89ced9b --- /dev/null +++ b/Worksheets/worksheets/gdb/src/nmod_structures.h @@ -0,0 +1,163 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + + + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: All the structures used by nMod + +#ifndef nmodstructH +#define nmodstructH + + +typedef struct +{ + int r; // red colour + int g; // green colour + int b; // guess! +} particlecolour; + +/* structure that is used when representing a body in the nBody model */ +typedef struct { + char particle_id[100]; + int type; + particlecolour rgb_vals; + char freetext[100]; + double radius; + int iscollapsor; + double mass; + double xloc; /*position in the WCS */ + double yloc; + double zloc; + double xsp; /*speed in the WCS */ + double ysp; + double zsp; + double grav_x; /*gravitational force per second for each axis */ + double grav_y; + double grav_z; + double xforce; /* accumulators used when collecting total gravitational forces */ + double yforce; + double zforce; + double xloctemp; /* location and speed members used when integrating */ + double yloctemp; + double zloctemp; + double xsptemp; + double ysptemp; + double zsptemp; + // these options are for when nmod is in use for experiments only. + // therefore they are commented out here (the burn plan would otherwise take up a lot of memory + //int is_EA_spaceship; // boolean + //int burn_plan_exists; // boolean (well, ish...) + //double rocket_fuel_payload; + //burn_sequence burn_plan; // only used if this particle is to be a spaceship in an EA. +} particle; + +/* +* structure used to created a linked list +* of pairs of planets +*/ +typedef struct particle_pair_t +{ + int m1; + int m2; + struct particle_pair_t *next; +} particle_pair; + +/* +* structure used for the fourth order runge kutta integrator +*/ +typedef struct { + double xforce1; + double yforce1; + double zforce1; + double xforce2; + double yforce2; + double zforce2; + double xforce3; + double yforce3; + double zforce3; + double xforce4; + double yforce4; + double zforce4; +} rk4_store; + +//----- +// the following sequence of structs come from nbview. We use them here as a means to store +// the nbo files we record to memory, prior to writing them to file + +//structure that is used when representing a particle in the viewer + +typedef struct +{ + char particle_id[100]; + int type; + float mass; + float radius; + char freetext[100]; + particlecolour rgb_vals; + float xloc; /*position in the WCS */ + float yloc; + float zloc; + float xsp; /*speed in the WCS */ + float ysp; + float zsp; +} particle_data; + +//----- +/* +* The data structure for a single project. This includes all the +* data, files, arrays and other variables required by a single project within nMod. +* +* If you need to add any new variables for use by a project, add them here. +* avoid adding project specific variables anywhere else, since if they are not +* encapsulated here, they won't be threadsafe, so you can't run concurrent projects in memory. +*/ + +typedef struct +{ + char project_name[100]; // the name for this project (will be used as part of the final report file name) + char final_conditions_filename[100]; //if the final state of all particles is to be recorded in nmp format, use this name of the file + int num_particles; // how many particles there are in the system when the nbody model is running + particle *particles; // the particles which get iterated by the nbody model + rk4_store *store; + char tempfname[100]; + char nbo_append_text[100]; + int nbo_write_direct; + int particle_info_size; + int states_required; + int step_size; + int number_of_steps_per_state; + int steps_done_counter; + int state_count; + int method; + int use_stdout; + float G; + char outputfilename[100]; + char new_projectname[100]; + int write_project; + int record_destination; // file or memory + int nbo_required; + particle_pair *begin; + int collapsor; + int integration_method; + int take_sample_counter; + FILE *outfile; + FILE *reportfile; // used for the EA summary +} project; + + + +#endif diff --git a/Worksheets/worksheets/gdb/src/read_single_particle.c b/Worksheets/worksheets/gdb/src/read_single_particle.c new file mode 100644 index 0000000..fc02a08 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/read_single_particle.c @@ -0,0 +1,129 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: Function to read in the data of a single particle + + +#include "nmod.h" +void read_single_particle (FILE * current_file, particle * single_particle, int datasize) { + int i, t; + char *inputline; + char *first_word, *second_word, *value; + first_word = (char *) calloc (100, sizeof (char)); + second_word = (char *) calloc (100, sizeof (char)); + value = (char *) calloc (100, sizeof (char)); + inputline = (char *) calloc (1024, (sizeof (char))); + if (inputline == NULL) { + fprintf (stderr, "malloc faliure in _read_single_particle\n"); + exit (0); + } + for (i = 0; i < datasize; i++) { + for (t = 0; t < 100; t++) { + first_word[t] = '\0'; + second_word[t] = '\0'; + value[t] = '\0'; + } + for (t = 0; t < 1024; t++) { + inputline[t] = '\0'; + } + if ((fgets (inputline, 1024, current_file)) == NULL) { + fprintf (stderr, + "The particle datafile seems to be incorrectly formed\n"); + } + _parse_line (inputline, first_word, second_word, value); + if ((strcmp ("particle", first_word) == 0) + && (strcmp ("ident", second_word) == 0)) { + strcpy (single_particle->particle_id, value); + } + if ((strcmp ("particle", first_word) == 0) + && (strcmp ("type", second_word) == 0)) { + if ((strcmp ("massive_3", value) == 0)) { + single_particle->type = MASSIVE_PARTICLE_3; + } + if ((strcmp ("massive_2", value) == 0)) { + single_particle->type = MASSIVE_PARTICLE_2; + } + if ((strcmp ("massive_1", value) == 0)) { + single_particle->type = MASSIVE_PARTICLE_1; + } + if ((strcmp ("major_2", value) == 0)) { + single_particle->type = MAJOR_PARTICLE_2; + } + if ((strcmp ("major_1", value) == 0)) { + single_particle->type = MAJOR_PARTICLE_1; + } + if ((strcmp ("minor_2", value) == 0)) { + single_particle->type = MINOR_PARTICLE_2; + } + if ((strcmp ("minor_1", value) == 0)) { + single_particle->type = MINOR_PARTICLE_1; + } + } + if ((strcmp ("free", first_word) == 0) + && (strcmp ("text", second_word) == 0)) { + strcpy (single_particle->freetext, value); + } + if ((strcmp ("particle", first_word) == 0) + && (strcmp ("mass", second_word) == 0)) { + single_particle->mass = atof (value); + } + if ((strcmp ("particle", first_word) == 0) + && (strcmp ("radius", second_word) == 0)) { + single_particle->radius = atof (value); + } + if ((strcmp ("particle", first_word) == 0) + && (strcmp ("red", second_word) == 0)) { + single_particle->rgb_vals.r = atof (value); + } + if ((strcmp ("particle", first_word) == 0) + && (strcmp ("green", second_word) == 0)) { + single_particle->rgb_vals.g = atof (value); + } + if ((strcmp ("particle", first_word) == 0) + && (strcmp ("blue", second_word) == 0)) { + single_particle->rgb_vals.b = atof (value); + } + if ((strcmp ("X", first_word) == 0) + && (strcmp ("position", second_word) == 0)) { + single_particle->xloc = atof (value); + } + if ((strcmp ("Y", first_word) == 0) + && (strcmp ("position", second_word) == 0)) { + single_particle->yloc = atof (value); + } + if ((strcmp ("Z", first_word) == 0) + && (strcmp ("position", second_word) == 0)) { + single_particle->zloc = atof (value); + } + if ((strcmp ("X", first_word) == 0) + && (strcmp ("velocity", second_word) == 0)) { + single_particle->xsp = atof (value); + } + if ((strcmp ("Y", first_word) == 0) + && (strcmp ("velocity", second_word) == 0)) { + single_particle->ysp = atof (value); + } + if ((strcmp ("Z", first_word) == 0) + && (strcmp ("velocity", second_word) == 0)) { + single_particle->zsp = atof (value); + } + } + // free things, and leave + free (first_word); + free (second_word); + free (value); +} diff --git a/Worksheets/worksheets/gdb/src/reference_nmp.readme.txt b/Worksheets/worksheets/gdb/src/reference_nmp.readme.txt new file mode 100644 index 0000000..1436b10 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/reference_nmp.readme.txt @@ -0,0 +1,84 @@ +This archive contains the current state of my ongoing effort to +produce as a complete as possible a scale model of the Solar System. + +Archive contains: + +1: The nmp file that is passed to the nMod nBody model. +2: An nbo file containing 5000 days of Solar System motion resulting from running the nmp +file + +The starting state of model is as accurate as I can get it at present to the positions of all included bodies +on the date 24/08/2008. + +Major Bodies: + Sol + Mercury + Venus + Earth + Mars + Jupiter + Saturn + Uranus + Neptune + +Moons: + Luna (Earths Moon) + Ganymede + Callisto + +Mear-Earth asteroids: + Apophis + Eros + Itokawa + +Main Belt Asteroids: + Ida + Ceres + Pallas + Juno + Vesta + Astraea + Hebe + Iris + Flora + Metis + Hygiea + Parthenope + Victoria + Irene + Eunomia + Psyche + Thetis + Melpomene + Fortuna + Massalia + Lutetia + Kalliope + Thalia + Themis + Phocaea + Proserpina + Euterpe + Bellona + Amphitrite + Urania + Euphrosyne + Pomona + Circe + Leukothea + Atalante + Fides + Ganymed + Cybele + +Comets: + Comet 1P/Halley + +SpaceCraft: + Voyager 1 + Voyager 2 + Pioneer 10 + Pioneer 11 + +More information is contained inside the nmp file itself. It is a plain +text file, so will open in any decent text editor. diff --git a/Worksheets/worksheets/gdb/src/reference_project.nmp b/Worksheets/worksheets/gdb/src/reference_project.nmp new file mode 100644 index 0000000..9e424e8 --- /dev/null +++ b/Worksheets/worksheets/gdb/src/reference_project.nmp @@ -0,0 +1,984 @@ +# ----------------------------------------- +# | nMod Reference Solar System Model. | +# | Version 2.7 | +# ----------------------------------------- +# The Position of the planets, moons, comets, spacecraft and asteroids in this +# project file correspond to: +# Date: 24/08/2008 +# Time: 00:00:00 +# +# Co-ordinates are in Meters +# Velocities are in Meters per Second +# Origin is Solar System Barycenter. All bodies in this model are positioned +# relative to this origin. +# +# Radius is 1 for most asteroids, if you want to use the real radius +# in your experiments you will need to change them yourself. The reference +# version of nmod doesn't use the radius value. +# +# +# At the moment quite a few Asteroid masses are estimates. I'm working on resolving this issue. +# +###################################################### +###################################################### +### nBODY SPECIFIC SETTINGS ### +###################################################### +###################################################### +# +# the filename for the *.nbo file that +# will store the time series result data +# leave off the nbo file extension in this version +# +output filename reference_project +# +# the number of particles in this project +# +particle population 58 +# +# how many states do you want to record? +# +states required 10 +# +# and how many steps will occur between states? +# +step count 1440 +# +# the number of seconds in a single step +# +step size 60 +# +# +# specify the integration method to use +# choices are: +# RK4 +# Runge Kutta Fourth Order Integration. This is the most +# accurate integration method in nMod +# +# MidPoint +# Mid Point integration method. This is a less accurate +# integration method, but very fast, and useful for +# simulations where accuracy is slightly less important. +# +# +integration method MidPoint +# +# the gravitational constant used by nMod. +# Research is always improving this measure +# so it isn't hard coded, and you should +# avoid changing nMod to hard code it +# +gravitational constant 6.674040E-11 +# +# Set the particle, if any, that is to be held still and +# used as collapsor. In this model we set Sol as the Collapsor (0). +# At the moment Sols true orbital position and Velocity are not included. +# Note that to keep a central reference point, you can always +# give the collapsor insignificant mass +# +collapsor defined 0 +# +# +# State how many items of information exist for each particle. +# This value should not be changed unless you add more data to +# single particles, and change the particle data structure and +# singl particle reading function +# +particle info_size 14 +# +# +# if we are going to write a time series to an nbo file, set this to TRUE, else FALSE +# +nbo recording FALSE +# +# option to say whether nMod outputs text to stdout, +# or not. +# Default = TRUE, change to FALSE to disable stdout output +# (enables things like using nohup, does not effect stderr) +# +use stdout FALSE +# +# Should nMod write out the final state of all particles in the model to an nmp file +# at the end of the specified time series? (TRUE or FALSE) +# +write project FALSE +# +# if so, use this file ident +# +final_conditions filename final_state_conditions +# +# end model initialisation information, begin particle data +# particle data has the following format: +# +# Name of particle +# Type of particle - used by nBview to give the particle an appropriate +# looking size. This is not going to be to scale. +# massive_3 - Stellar mass objects, Sol +# massive_2 - Gas Giant - Jupiter size +# massive_1 - Gas Giant - Smaller than Jupoter +# major_2 - large planet (earth,venus,mars) +# major_1 - small planet (mercury) +# minor_2 - Moon +# minor_1 - Asteroid,Comet,spaceship +# (RGB vals for the particle) +# particle red colour +# particle green colour +# particle blue colour +# free text empty +# Mass of Particle (equatorial) +# Radius of Particle (equatorial) +# Location on the X plane in meters +# Location on the Y plane in meters +# Location on the Z plane in meters +# velocity on the X plane in meters per second +# velocity on the Y plane in meters per second +# velocity on the Z plane in meters per second +# +# + +particle ident Sol +particle type massive_3 +particle red 238 +particle green 238 +particle blue 0 +free text empty +particle mass 1.989100E+30 +particle radius 6.950000E+05 +X position 0.0 +Y position 0.0 +Z position 0.0 +X velocity 0.0 +Y velocity 0.0 +Z velocity 0.0 +particle ident Mercury +particle type minor_2 +particle red 255 +particle green 222 +particle blue 156 +free text empty +particle mass 3.302E+23 +particle radius 2.440E+06 +X position -5.821615456150769E+10 +Y position -2.830106330222192E+09 +Z position 5.489367558083519E+09 +X velocity -7.852701387085467E+03 +Y velocity -4.602894196331046E+04 +Z velocity -2.875598134571757E+03 +particle ident Venus +particle type major_1 +particle red 220 +particle green 176 +particle blue 111 +free text empty +particle mass 48.685E+23 +particle radius 6.0518E+06 +X position -9.631862163939662E+10 +Y position 4.550108457884260E+10 +Z position 6.063524106957864E+09 +X velocity -1.510653320654692E+04 +Y velocity -3.185165845516286E+04 +Z velocity 6.314804795557265E+02 +particle ident Earth +particle type major_2 +particle red 1 +particle green 57 +particle blue 217 +free text empty +particle mass 5.973600E+24 +particle radius 6.371E+06 +X position -8.763622878061567E+09 +Y position 1.464211383654092E+11 +Z position 6.627634039492160E+08 +X velocity -3.025084670211016E+04 +Y velocity -1.972406240070901E+03 +Z velocity -1.103585425003040E+01 +particle ident Moon +particle type minor_1 +particle red 10 +particle green 103 +particle blue 106 +free text empty +particle mass 7.349000E+22 +particle radius 1.737530E+06 +X position -8.523903250756547E+09 +Y position 1.460981944863684E+11 +Z position 6.555958730282411E+08 +X velocity -2.948383365889115E+04 +Y velocity -1.370503914880251E+03 +Z velocity 7.926684108954696E+01 +particle ident Asteroid_99942_Apophis +particle type minor_1 +particle red 255 +particle green 25 +particle blue 25 +free text empty +particle mass 2.1e+10 +particle radius 125 +X position -9.698903774857521E+10 +Y position 1.292056644126621E+11 +Z position -9.146500635637254E+09 +X velocity -2.231270403157814E+04 +Y velocity -1.372356939741989E+04 +Z velocity 1.900237480812530E+02 +particle ident Asteroid_433_Eros +particle type minor_1 +particle red 255 +particle green 25 +particle blue 25 +free text empty +particle mass 7.2E+18 +particle radius 9000 +X position -1.670183289448947E+11 +Y position 5.553414000846045E+10 +Z position -2.042672393587016E+10 +X velocity -1.205188450461847E+04 +Y velocity -2.692800248684130E+04 +Z velocity -4.809680793155813E+03 +particle ident Asteroid_25143_Itokawa +particle type minor_1 +particle red 255 +particle green 25 +particle blue 25 +free text empty +particle mass 3.58E+10 +particle radius 1 +X position -1.184479283346372E+11 +Y position 1.578653854825412E+11 +Z position 4.709215068476923E+09 +X velocity -1.560927358431765E+04 +Y velocity -2.088157745945970E+04 +Z velocity 2.017944754155900E+02 +particle ident Mars +particle type major_1 +particle red 148 +particle green 49 +particle blue 24 +free text empty +particle mass 6.4219E+23 +particle radius 3.3899E+06 +X position -2.242099110661761E+11 +Y position -8.987151833815391E+10 +Z position 3.596841266712055E+09 +X velocity 9.978663632868374E+03 +Y velocity -2.039513724641982E+04 +Z velocity -6.723843516114920E+02 +particle ident Jupiter +particle type massive_2 +particle red 249 +particle green 146 +particle blue 41 +free text empty +particle mass 1898.6E+24 +particle radius 6.0268E+07 +X position 2.788378704633741E+11 +Y position -7.191670776542783E+11 +Z position -3.262353095331281E+09 +X velocity 1.201961920275000E+04 +Y velocity 5.342734228720388E+03 +Z velocity -2.912716717644908E+02 +particle ident Ganymede +particle type minor_1 +particle red 10 +particle green 103 +particle blue 106 +free text empty +particle mass 1482E+20 +particle radius 2634000 +X position 2.798293640496654E+11 +Y position -7.195664918962947E+11 +Z position -3.265004663682520E+09 +X velocity 1.610653680048356E+04 +Y velocity 1.543478999800238E+04 +Z velocity 1.386981525112594E+02 +particle ident Callisto +particle type minor_1 +particle red 10 +particle green 103 +particle blue 106 +free text empty +particle mass 1076E+20 +particle radius 2403000 +X position 2.771921435729551E+11 +Y position -7.182283173117032E+11 +Z position -3.254305972025812E+09 +X velocity 7.958627259314701E+03 +Y velocity -1.717952107610292E+03 +Z velocity -5.731819803212679E+02 +particle ident Saturn +particle type massive_1 +particle red 157 +particle green 131 +particle blue 96 +free text empty +particle mass 5.68462313752E+26 +particle radius 6.0268E+07 +X position -1.322502282596553E+12 +Y position 4.453379905084059E+11 +Z position 4.487927026189578E+10 +X velocity -3.596578950091885E+03 +Y velocity -9.175554347978476E+03 +Z velocity 3.022305429891885E+02 +particle ident Uranus +particle type massive_1 +particle red 62 +particle green 217 +particle blue 219 +free text empty +particle mass 86.832E+24 +particle radius 2.5559E+07 +X position 2.963455989424174E+12 +Y position -5.042445762635994E+11 +Z position -4.026730083237916E+10 +X velocity 1.092627360021276E+03 +Y velocity 6.396142600530890E+03 +Z velocity 9.951055923222984E+00 +particle ident Neptune +particle type massive_1 +particle red 122 +particle green 156 +particle blue 227 +free text empty +particle mass 102.47E+24 +particle radius 2.4766E+07 +X position 3.577827906239968E+12 +Y position -2.717446896817872E+12 +Z position -2.649279680554676E+10 +X velocity 3.251193084200894E+03 +Y velocity 4.360719388680694E+03 +Z velocity -1.640256489807461E+02 +particle ident Asteroid_1_Ceres +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 9.445E+20 +particle radius 1 +X position -1.360378145033865E+11 +Y position 3.628484913153315E+11 +Z position 3.630452696590438E+10 +X velocity -1.715609554847549E+04 +Y velocity -7.758986181404604E+03 +Z velocity 2.918166641448519E+03 +particle ident Asteroid_2_Pallas +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 2.2E+20 +particle radius 1 +X position 2.546206841450784E+11 +Y position 2.157897096804019E+11 +Z position -1.698241485990067E+11 +X velocity -1.689908244482754E+04 +Y velocity 8.994091016825426E+03 +Z velocity -4.811793673040944E+03 +particle ident Asteroid_3_Juno +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 3E+19 +particle radius 1 +X position 2.497015034898462E+10 +Y position -4.599520222366135E+11 +Z position 1.034303772163078E+11 +X velocity 1.469783132930291E+04 +Y velocity 3.335093602631296E+03 +Z velocity -1.344325390893585E+03 +particle ident Asteroid_4_Vesta +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 3E+20 +particle radius 1 +X position 3.437023518002605E+11 +Y position 1.298050118221837E+11 +Z position -4.567921744361527E+10 +X velocity -5.162377069675682E+03 +Y velocity 1.773904280241017E+04 +Z velocity 9.208214282119886E+01 +particle ident Asteroid_5_Astraea +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 2.4E+18 +particle radius 1 +X position -2.161190214015943E+11 +Y position -3.075734566326830E+11 +Z position 3.530747887538506E+10 +X velocity 1.311311475867189E+04 +Y velocity -1.360657316724847E+04 +Z velocity 2.383746195150094E+02 +particle ident Asteroid_6_Hebe +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.4E+19 +particle radius 1 +X position -4.228175778627875E+11 +Y position 2.770654895866165E+10 +Z position 6.805107165398690E+10 +X velocity -1.884840821694723E+03 +Y velocity -1.543282039304465E+04 +Z velocity 3.380179368603502E+03 +particle ident Asteroid_7_Iris +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.0E+19 +particle radius 1 +X position -3.171391709112738E+11 +Y position -3.024487905942256E+11 +Z position -2.494884207117811E+10 +X velocity 1.035896908697062E+04 +Y velocity -1.110661383852121E+04 +Z velocity 1.179380787338768E+03 +particle ident Asteroid_8_Flora +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 3.6E+18 +particle radius 1 +X position -3.026132628205096E+11 +Y position 1.638444706610029E+11 +Z position 2.310333721834727E+10 +X velocity -1.142117831437000E+04 +Y velocity -1.532570877077301E+04 +Z velocity 1.664672973690458E+03 +particle ident Asteroid_9_Metis +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 9E+18 +particle radius 1 +X position 3.100492483113670E+11 +Y position 1.084785922939479E+11 +Z position -2.449474726178166E+10 +X velocity -8.566776199231850E+03 +Y velocity 1.893975031003747E+04 +Z velocity 1.443452818498487E+03 +particle ident Asteroid_10_Hygiea +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 8.6E+19 +particle radius 1 +X position 2.838059253908655E+11 +Y position 4.410900806715071E+11 +Z position 2.542336551290658E+10 +X velocity -1.254472599670359E+04 +Y velocity 8.100850923571493E+03 +Z velocity -6.919141512962987E+02 +particle ident Asteroid_11_Parthenope +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 5.13E+18 +particle radius 1 +X position 2.522420211330838E+11 +Y position -2.121923005230595E+11 +Z position -6.582994944484204E+09 +X velocity 1.346229478342481E+04 +Y velocity 1.604971981982148E+04 +Z velocity -1.642483431499855E+03 +particle ident Asteroid_12_Victoria +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.5E+18 +particle radius 1 +X position -3.754038042776204E+10 +Y position 4.081930947011110E+11 +Z position -3.842952815899378E+10 +X velocity -1.618329549148954E+04 +Y velocity 5.228773323842103E+02 +Z velocity -2.003668153155669E+03 +particle ident Asteroid_14_Irene +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 6.3E+18 +particle radius 1 +X position -2.236643262291997E+11 +Y position 2.541908653616605E+11 +Z position 3.825698761630449E+10 +X velocity -1.371144385494617E+04 +Y velocity -1.567325902677871E+04 +Z velocity 2.036993922231434E+03 +particle ident Asteroid_15_Eunomia +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 3.26E+19 +particle radius 1 +X position -3.988391932245492E+11 +Y position 1.543449279506464E+11 +Z position -6.349391374139557E+10 +X velocity -8.083417948284154E+03 +Y velocity -1.436991872291761E+04 +Z velocity -2.720094580098222E+03 +particle ident Asteroid_16_Psyche +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.7E+19 +particle radius 1 +X position -1.919458475223173E+11 +Y position -4.302129692568110E+11 +Z position 2.537849738533995E+10 +X velocity 1.531200959980268E+04 +Y velocity -4.831097128585681E+03 +Z velocity -1.830688623158725E+02 +particle ident Asteroid_17_Thetis +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 7.6E+17 +particle radius 1 +X position 1.938888766369945E+11 +Y position -2.673347319202711E+11 +Z position -1.807859640069157E+08 +X velocity 1.795086154349991E+04 +Y velocity 1.077479193382444E+04 +Z velocity -2.042786835166140E+03 +particle ident Asteroid_18_Melpomene +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 2.9E+18 +particle radius 1 +X position -1.812942244420550E+11, +Y position -3.364737031180626E+11 +Z position 6.833813858008316E+10 +X velocity 1.631794363984456E+04 +Y velocity -5.405745512291816E+03 +Z velocity -5.945387295258169E+02 +particle ident Asteroid_19_Fortuna +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.2E+19 +particle radius 1 +X position 1.033403160094586E+11 +Y position -3.582301732805645E+11 +Z position 9.887184536303535E+09 +X velocity 1.686084242272842E+04 +Y velocity 7.903615309605862E+03 +Z velocity 5.549896847670643E+01 +particle ident Asteroid_20_Massalia +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 5.2E+18 +particle radius 1 +X position 3.878846984963605E+10 +Y position -4.087638714593052E+11 +Z position 4.728253514982671E+09 +X velocity 1.659152588042424E+04 +Y velocity 1.251158218938778E+03 +Z velocity 7.758251811404793E+01 +particle ident Asteroid_21_Lutetia +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.3E+18 +particle radius 1 +X position 2.530979753841635E+11 +Y position 2.211485040129305E+11 +Z position -1.153202764777549E+10 +X velocity -1.114792562794652E+04 +Y velocity 1.735018357405058E+04 +Z velocity 7.356529295309180E+02 +particle ident Asteroid_22_Kalliope +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 6.3E+18 +particle radius 1 +X position -3.960343593392247E+11 +Y position -2.486015023494189E+11 +Z position 6.385416520369553E+10 +X velocity 7.224730637758747E+03 +Y velocity -1.399410829497720E+04 +Z velocity -2.991268063288233E+03 +particle ident Asteroid_23_Thalia +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.3E+18 +particle radius 1 +X position 1.587180171991798E+11 +Y position -4.473545050591986E+11 +Z position -5.721229175490415E+10 +X velocity 1.405677251848313E+04 +Y velocity 3.873090290149407E+03 +Z velocity -2.047414346343297E+03 +particle ident Asteroid_24_Themis +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 5.75E+19 +particle radius 1.00E+03 +X position -4.093383269595770E+11 +Y position 5.337646938850013E+10 +Z position 3.745697028707754E+09 +X velocity -3.498878459272277E+03 +Y velocity -1.865193917563072E+04 +Z velocity -1.726588017609005E+02 +particle ident Asteroid_25_Phocaea +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 4.4E+17 +particle radius 1 +X position -3.598748470708990E+11 +Y position 2.018834528801596E+11 +Z position -1.458503909754975E+11 +X velocity -6.345174470746068E+03 +Y velocity -1.371332700765076E+04 +Z velocity 3.072964281076633E+03 +particle ident Asteroid_26_Proserpina +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 9.0E+17 +particle radius 1 +X position -3.749965818642322E+11 +Y position 8.043299830210385E+10 +Z position 2.019241040311088E+10 +X velocity -2.489636403107782E+03 +Y velocity -1.874011488868356E+04 +Z velocity -7.010563948034170E+02 +particle ident Asteroid_27_Euterpe +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 9.3E+17 +particle radius 1 +X position 9.057615665317285E+10 +Y position 2.791835255220412E+11 +Z position -3.152753642721161E+09 +X velocity -2.218006186567436E+04 +Y velocity 6.022035755949626E+03 +Z velocity 5.970473617212702E+02 +particle ident Asteroid_28_Bellona +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.9E+18 +particle radius 1 +X position 2.070147970837433E+11 +Y position -4.261930470324482E+11 +Z position 3.751015003087445E+10 +X velocity 1.406044167371761E+04 +Y velocity 5.998749786965958E+03 +Z velocity -2.168182756063139E+03 +particle ident Asteroid_29_Amphitrite +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.0E+19 +particle radius 1 +X position -2.438455935373681E+11 +Y position 2.796891114004073E+11 +Z position 2.813535894687556E+10 +X velocity -1.529017984723465E+04 +Y velocity -1.149674024551610E+04 +Z velocity -1.324951727688948E+03 +particle ident Asteroid_30_Urania +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.1E+18 +particle radius 1 +X position -6.281113492815186E+10 +Y position 3.259419992060643E+11 +Z position 5.474563230460957E+09 +X velocity -2.058311463182966E+04 +Y velocity -1.648444402404141E+03 +Z velocity -6.328550653547121E+02 +particle ident Asteroid_31_Euphrosyne +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.69E+19 +particle radius 1 +X position -3.360207610639488E+11 +Y position -4.128506446321072E+11 +Z position -8.878643477246544E+10 +X velocity 9.108958679833126E+03 +Y velocity -9.331942471223106E+03 +Z velocity -6.283768941201149E+03 +particle ident Asteroid_32_Pomona +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 5.5E+17 +particle radius 1 +X position 3.706330714709812E+11 +Y position 1.949025347431360E+11 +Z position 9.055819281765699E+09 +X velocity -8.043905471100759E+03 +Y velocity 1.495755433661258E+04 +Z velocity -1.605842008429618E+03 +particle ident Asteroid_34_Circe +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.5E+18 +particle radius 1 +X position -2.029866476102456E+11 +Y position 3.005504529388968E+11 +Z position -3.034049445548254E+10 +X velocity -1.603088769424521E+04 +Y velocity -1.195167274574073E+04 +Z velocity 1.026010146380205E+03 +particle ident Asteroid_35_Leukothea +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.1E+18 +particle radius 1 +X position 4.441553238335406E+11 +Y position 3.170225594973400E+11 +Z position 5.050241965784355E+10 +X velocity -8.468640976622970E+03 +Y velocity 1.069853062911963E+04 +Z velocity 1.356157453738260E+03 +particle ident Asteroid_36_Atalante +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.2E+18 +particle radius 1 +X position -3.840375533305188E+11 +Y position -3.523162554234356E+11 +Z position -1.210577216675158E+11 +X velocity 9.048815490204918E+03 +Y velocity -9.058512548104883E+03 +Z velocity -2.936566847144231E+03 +particle ident Fides +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.3E+18 +particle radius 1 +X position -2.233553908553047E+11 +Y position -4.050897587492498E+11 +Z position -2.006949475266489E+10 +X velocity 1.322528657439636E+04 +Y velocity -7.827856835439171E+03 +Z velocity -5.079329171101410E+02 +particle ident Asteroid_1036_Ganymed +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 3.3E+16 +particle radius 1 +X position -3.882936936935257E+11 +Y position 2.982038895749050E+11 +Z position -2.349995123585999E+11 +X velocity -1.113183151586430E+04 +Y velocity -5.641642571145153E+03 +Z velocity -9.488128038914576E+02 +particle ident Asteroid_65_Cybele +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 1.4E+19 +particle radius 1 +X position 6.146125948516919E+10 +Y position -4.559428664998816E+11 +Z position 2.424275575711712E+10 +X velocity 1.769491028485040E+04 +Y velocity 1.866147646656503E+03 +Z velocity -5.567580503067211E+02 +particle ident Asteroid_243_Ida +particle type minor_1 +particle red 180 +particle green 50 +particle blue 255 +free text empty +particle mass 4.2E+16 +particle radius 1E+7 +X position -1.914389662641539E+11 +Y position -4.035150944102373E+11 +Z position -8.738454847886741E+09 +X velocity 1.515970191028009E+04 +Y velocity -7.296120757358747E+03 +Z velocity 5.909029603633886E+01 +particle ident Comet_1P/Halley +particle type minor_1 +particle red 255 +particle green 178 +particle blue 127 +free text empty +particle mass 1.7E+15 +particle radius 1 +X position -2.976965489832702E+12 +Y position 3.373043781028069E+12 +Z position -1.374490568804385E+12 +X velocity -7.758425688500039E+02 +Y velocity 2.408313839321417E+03 +Z velocity -6.116981068409097E+02 +particle ident Voyager_1 +particle type minor_1 +particle red 255 +particle green 0 +particle blue 0 +free text empty +particle mass 733 +particle radius 1 +X position -3.625946912401841E+12 +Y position -1.266083455593168E+13 +Z position 9.167712043057894E+12 +X velocity -2.098940259978061E+03 +Y velocity -1.375341242279744E+04 +Z velocity 9.935637277706970E+03 +particle ident Voyager_2 +particle type minor_1 +particle red 255 +particle green 0 +particle blue 0 +free text empty +particle mass 733 +particle radius 1 +X position 3.541866028572634E+12 +Y position -1.039577836160171E+13 +Z position -6.916209854212349E+12 +X velocity 4.289795164713816E+03 +Y velocity -9.544741921496401E+03 +Z velocity -1.147323424980270E+04 +particle ident Pioneer_10 +particle type minor_1 +particle red 255 +particle green 0 +particle blue 0 +free text empty +particle mass 258 +particle radius 1 +X position 2.882841965452493E+12 +Y position 1.410724832964292E+13 +Z position 7.583111639722691E+11 +X velocity 1.283198908069103E+03 +Y velocity 1.201814775004192E+04 +Z velocity 6.157777742724759E+02 +particle ident Pioneer_11 +particle type minor_1 +particle red 255 +particle green 0 +particle blue 0 +free text empty +particle mass 259 +particle radius 1 +X position 2.017729689008085E+12 +Y position -1.071894364507710E+13 +Z position 2.811690013517277E+12 +X velocity 4.129128200233303E+03 +Y velocity -1.045217705848250E+04 +Z velocity 2.524403233528885E+03 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Worksheets/worksheets/gdb/src/run_nbody_environment.c b/Worksheets/worksheets/gdb/src/run_nbody_environment.c new file mode 100644 index 0000000..18f387c --- /dev/null +++ b/Worksheets/worksheets/gdb/src/run_nbody_environment.c @@ -0,0 +1,66 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: The Driver for the nBody model. +// This version simply iterates the nBody model until the required number of states is completed, and +// records a n nbo file if one is requested. +#include "nmod.h" +int run_nbody_environment (project * local_project) { + local_project->steps_done_counter = 0; + local_project->state_count = 0; + char newstring_for_exported_nmp_name[100]; + if(local_project->nbo_write_direct == NBO_FILE_ON) {// we are recording to file, so the nbo file needs to be initialised + _initialise_nbo_file (local_project); // initialise the nbo file + if (local_project->outfile != NULL) {// write the first state + write_current_state (local_project); + } + } + for (;;) { + if (local_project->method == USE_RK4) { + _move_particles_RK4 (local_project->particles, local_project->store,local_project->step_size,local_project->num_particles,local_project->begin, local_project->collapsor,local_project->G); + } + else if (local_project->method == USE_MIDPOINT ) { + _move_particles_MP (local_project->particles, local_project->store,local_project->step_size,local_project->num_particles,local_project->begin, local_project->collapsor,local_project->G); + } + // increment the nunber of steps that have occured + local_project->steps_done_counter++; + if (local_project->steps_done_counter >= local_project->number_of_steps_per_state) { + // increment the state count first. + local_project->state_count++; + if(local_project->use_stdout) { + printf ("> State %d of %d completed\n",local_project->state_count,local_project->states_required); + } + // time to record the state to file (if required) . + if(local_project->nbo_write_direct == NBO_FILE_ON) {// we are recording to file, lucky us. + if (local_project->outfile != NULL) {// write the current state to the nbo file + write_current_state (local_project); + } + } + //reset the counter for steps completed, ready for counting up the next state + local_project->steps_done_counter = 0; + } + if (local_project->state_count >= local_project->states_required) { + // the run has completed + if (local_project->write_project) { + sprintf(newstring_for_exported_nmp_name,"%s.nmp",local_project->final_conditions_filename); + export_project_from_current_state (newstring_for_exported_nmp_name,local_project); + } + break; // leave the infinite loop + } + } + return 0; +} diff --git a/Worksheets/worksheets/gdb/src/write_current_state.c b/Worksheets/worksheets/gdb/src/write_current_state.c new file mode 100644 index 0000000..f40bdeb --- /dev/null +++ b/Worksheets/worksheets/gdb/src/write_current_state.c @@ -0,0 +1,80 @@ +/******************************************************************** +* Licence: GPL 3 .0 or later. +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +********************************************************************/ + + +//Author : Carey Pridgeon +// Email : carey.pridgeon@gmail.com +// Description: This function writes the current environment state to one of two forms of nbo file + +#include "nmod.h" +int write_current_state (project * local_project) { + int i; + // opening as append + local_project->outfile = fopen (local_project->outputfilename, "a"); + /* + * reset the file pointer to start of file + */ + if ((fseek (local_project->outfile, 0, SEEK_SET)) == -1) { + printf ("> Error on file pointer reset for %s", local_project->outputfilename); + } + if (local_project->outfile == NULL) { + fprintf (stderr, "nbo file '%s' not opened correctly \n",local_project->outputfilename); + exit (0); + } + // state preamble + fprintf (local_project->outfile, "[s%d", local_project->state_count); + fprintf (local_project->outfile, "!%d!", local_project->num_particles); + // start of particle data itself + for (i = 0; i < local_project->num_particles; i++) { + fprintf (local_project->outfile, "(%s", local_project->particles[i].particle_id); + if (local_project->particles[i].type == MASSIVE_PARTICLE_3) { + fprintf (local_project->outfile, "|ma3"); + } + if (local_project->particles[i].type == MASSIVE_PARTICLE_2) { + fprintf (local_project->outfile, "|ma2"); + } + if (local_project->particles[i].type == MASSIVE_PARTICLE_1) { + fprintf (local_project->outfile, "|ma1"); + } + if (local_project->particles[i].type == MAJOR_PARTICLE_2) { + fprintf (local_project->outfile, "|mj2"); + } + if (local_project->particles[i].type == MAJOR_PARTICLE_1) { + fprintf (local_project->outfile, "|mj1"); + } + if (local_project->particles[i].type == MINOR_PARTICLE_2) { + fprintf (local_project->outfile, "|mn2"); + } + if (local_project->particles[i].type == MINOR_PARTICLE_1) { + fprintf (local_project->outfile, "|mn1"); + } + fprintf (local_project->outfile, "|%.10e", local_project->particles[i].mass); + fprintf (local_project->outfile, "|%.10e", local_project->particles[i].radius); + fprintf (local_project->outfile, "|%d,", local_project->particles[i].rgb_vals.r); + fprintf (local_project->outfile, "%d,", local_project->particles[i].rgb_vals.g); + fprintf (local_project->outfile, "%d", local_project->particles[i].rgb_vals.b); + fprintf (local_project->outfile, "|%s", local_project->particles[i].freetext); + fprintf (local_project->outfile, "|%.10e", local_project->particles[i].xloc); + fprintf (local_project->outfile, "|%.10e", local_project->particles[i].yloc); + fprintf (local_project->outfile, "|%.10e", local_project->particles[i].zloc); + fprintf (local_project->outfile, "|%.10e", local_project->particles[i].xsp); + fprintf (local_project->outfile, "|%.10e", local_project->particles[i].ysp); + fprintf (local_project->outfile, "|%.10e", local_project->particles[i].zsp); + fprintf (local_project->outfile, ")"); + } + fprintf (local_project->outfile, "]"); + fclose(local_project->outfile); + return 0; + } diff --git a/Worksheets/worksheets/git/.DS_Store b/Worksheets/worksheets/git/.DS_Store new file mode 100644 index 0000000..2392686 Binary files /dev/null and b/Worksheets/worksheets/git/.DS_Store differ diff --git a/Worksheets/worksheets/git/Git_Worksheet.org b/Worksheets/worksheets/git/Git_Worksheet.org new file mode 100644 index 0000000..7326a52 --- /dev/null +++ b/Worksheets/worksheets/git/Git_Worksheet.org @@ -0,0 +1,128 @@ +#+TITLE: Git Worksheet +#+AUTHOR: Carey Pridgeon +#+EMAIL: ab0475@ccoventry.ac.uk +#+OPTIONS: ^:nil toc:nil +#+STARTUP: showeverything +#+LaTeX_CLASS_OPTIONS: [minimal, t] +* intro +- In this worksheet you will cover the basics of using Git by using + gitlab. +* Shh key generation +- You will need ssh keys to complete this task, unless you don't mind + typing in passwords all the time. +- Doing that is really dull, I suggest you don't. +- To generate ssh keys type this command +#+BEGIN_SRC bash +ssh-keygen -t rsa +#+END_SRC +- And just press enter to ignore all the questions. +- The keys will be in ~/.ssh/ +* git Commands +- *git clone [url]* + - Clone a remote repository. +- *git add [filename]* + - Add a specific file (need especially for dot prefixed, and thus hidden, files). +- *git add --all* + - Add all files not specifically excluded by the .gitignore file. +- *git commit -m "message"* + - Commit any changes to the local repository. +- *git push* + - update the remote repository with local changes. +- *git config --global user.name "John Doe"* + - *git config --global user.email johndoe@example.com* +- set up git locally so it knows the ID to use on commits/pushes. +- *git config --global core.editor emacs* + - If you want to change the default editor, use this, you can set any editor + you like, I use emacs, you could use vim. +- *git config --list* + - display your git config. +- *git tag -a [tag_name] -m "tag text"* + - create a tag with detail text. +- *git checkout -b [branchname]* + - Create a new branch and switch to it. +- *git push -u origin [branchname]* + - Push your local new branch and its changes to gitlab. +- *git checkout [branchname]* + - Switch to an existing branch. + +* Continuous Integration (Gitlab Runner) setup +- Gitlab provides a shared Continuous Integration CI service that you can use + for compiling and testing your code. +- It only ever runs remotely on Gitlab's Servers, never locally. +- To access this shared runner service you need to create a runner script. +- This script is written in yaml. +- CI checks out your source code to a temporary Docker Image based Virtual + Machine then runs your script. +- Your script is in effect a sequence of BASH commands, such as you would write + in a normal script to perform a sequence of commands locally, only it is set + out differently. +- A script starts like this: +#+BEGIN_SRC yaml +Heading + sectionname: + - command + - sequence +#+END_SRC +- The command sequence is the same as a sequence of bash commands. So *cd* would + change directory, *make* runs a makefile. +* Example Script +- Look at the following .gitlab-ci.yml file that can compile a c++ project. I've + taken it from one of my own projects. +- This project has its source code in a sub folder, so the first line of the + script must be to cd into that folder. +#+BEGIN_SRC yaml +mopdev: + script: + - cd testing + - make clean + - make + - ./test -testset1 +#+END_SRC +- The compiled executable takes a file as a runtime parameter which in this case + contains a set of instructions about which test set to run. +- To simplify your task, these commands are part of the source code to be + compiled now. +* Important Note +- If you try to run any of the scripts written for this part of the worksheet + locally (as some students have in the past), it just won't work. I've included + it to demonstrated the general form your script needs to take. +- In essence, it's a series of bash commands in a *yaml* script file. +* Task One +- Create an account on gitlab using your real name. +- Import your public ssh key from nostromo to your gitlab + account. screenshot this is when complete. Add the screenshot and + your id_rsa.pub in your report. +- It, and your account will be deleted at the end of the module, so + this is not a security issue. +- In this account, fork this existing repository: +- https://gitlab.com/carey.pridgeon/git_task +- Set up your local git id +- Clone this repository whichever machine you're using. +- In this repository, add the file .gitignore. +- In this file add *.o*. This wil prevent git tracking object files in + any directory of your project. (.o files are compilation artefacts) +- Add this file to the repository +- Push your changes upstream to the remote repository +- Create a new file README and write something in it +- Add this file to the local repository with the commit message /added + a readme/, then push it upstream. +- Create a tag called 'before_branch', push it upstream +- Make a new branch call1ed "dev_branch", switch to it, make some changes + (anything, just edit the readme if you like) then push them upstream to the + new branch. +- Merge the branch with your master branch on gitlab (not the original + from my repository), deleting the new branch in the process, and + switch back to using master branch locally. +* Task Two +** Set up CI +- Create the file .gitlab-ci.yml, setting it up to compile, then execute the + binary for the git_task source code. +- Push it to the remote repository to trigger a build. +* Evidence +** Task One +- Provide a screenshot of the repository history page. +- Provide a Listing of the repository file contents. +** Task Two +- List the contents of your .gitlab-ci.yml file. +- Provide The full text output from the build process. + diff --git a/Worksheets/worksheets/git/Git_Worksheet.pdf b/Worksheets/worksheets/git/Git_Worksheet.pdf new file mode 100644 index 0000000..4494427 Binary files /dev/null and b/Worksheets/worksheets/git/Git_Worksheet.pdf differ diff --git a/Worksheets/worksheets/git/Git_Worksheet.tex b/Worksheets/worksheets/git/Git_Worksheet.tex new file mode 100644 index 0000000..0d1c299 --- /dev/null +++ b/Worksheets/worksheets/git/Git_Worksheet.tex @@ -0,0 +1,213 @@ +% Created 2019-11-04 Mon 14:07 +\documentclass[minimal, t]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{fixltx2e} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{wrapfig} +\usepackage{rotating} +\usepackage[normalem]{ulem} +\usepackage{amsmath} +\usepackage{textcomp} +\usepackage{marvosym} +\usepackage{wasysym} +\usepackage{amssymb} +\usepackage{hyperref} +\tolerance=1000 +\author{Carey Pridgeon} +\date{\today} +\title{Git Worksheet} +\hypersetup{ + pdfkeywords={}, + pdfsubject={}, + pdfcreator={Emacs 25.3.50.1 (Org mode 8.2.10)}} +\begin{document} + +\maketitle +\section{intro} +\label{sec-1} +\begin{itemize} +\item In this worksheet you will cover the basics of using Git by using +gitlab. +\end{itemize} +\section{Shh key generation} +\label{sec-2} +\begin{itemize} +\item You will need ssh keys to complete this task, unless you don't mind +typing in passwords all the time. +\item Doing that is really dull, I suggest you don't. +\item To generate ssh keys type this command +\end{itemize} +\begin{verbatim} +ssh-keygen -t rsa +\end{verbatim} +\begin{itemize} +\item And just press enter to ignore all the questions. +\item The keys will be in \textasciitilde{}/.ssh/ +\end{itemize} +\section{git Commands} +\label{sec-3} +\begin{itemize} +\item \textbf{git clone [url]} +\begin{itemize} +\item Clone a remote repository. +\end{itemize} +\item \textbf{git add [filename]} +\begin{itemize} +\item Add a specific file (need especially for dot prefixed, and thus hidden, files). +\end{itemize} +\item \textbf{git add --all} +\begin{itemize} +\item Add all files not specifically excluded by the .gitignore file. +\end{itemize} +\item *git commit -m "message"* +\begin{itemize} +\item Commit any changes to the local repository. +\end{itemize} +\item \textbf{git push} +\begin{itemize} +\item update the remote repository with local changes. +\end{itemize} +\item *git config --global user.name "John Doe"* +\begin{itemize} +\item \textbf{git config --global user.email johndoe@example.com} +\end{itemize} +\item set up git locally so it knows the ID to use on commits/pushes. +\item \textbf{git config --global core.editor emacs} +\begin{itemize} +\item If you want to change the default editor, use this, you can set any editor +you like, I use emacs, you could use vim. +\end{itemize} +\item \textbf{git config --list} +\begin{itemize} +\item display your git config. +\end{itemize} +\item *git tag -a [tag\_name] -m "tag text"* +\begin{itemize} +\item create a tag with detail text. +\end{itemize} +\item \textbf{git checkout -b [branchname]} +\begin{itemize} +\item Create a new branch and switch to it. +\end{itemize} +\item \textbf{git push -u origin [branchname]} +\begin{itemize} +\item Push your local new branch and its changes to gitlab. +\end{itemize} +\item \textbf{git checkout [branchname]} +\begin{itemize} +\item Switch to an existing branch. +\end{itemize} +\end{itemize} + +\section{Continuous Integration (Gitlab Runner) setup} +\label{sec-4} +\begin{itemize} +\item Gitlab provides a shared Continuous Integration CI service that you can use +for compiling and testing your code. +\item It only ever runs remotely on Gitlab's Servers, never locally. +\item To access this shared runner service you need to create a runner script. +\item This script is written in yaml. +\item CI checks out your source code to a temporary Docker Image based Virtual +Machine then runs your script. +\item Your script is in effect a sequence of BASH commands, such as you would write +in a normal script to perform a sequence of commands locally, only it is set +out differently. +\item A script starts like this: +\end{itemize} +\begin{verbatim} +Heading + sectionname: + - command + - sequence +\end{verbatim} +\begin{itemize} +\item The command sequence is the same as a sequence of bash commands. So \textbf{cd} would +change directory, \textbf{make} runs a makefile. +\end{itemize} +\section{Example Script} +\label{sec-5} +\begin{itemize} +\item Look at the following .gitlab-ci.yml file that can compile a c++ project. I've +taken it from one of my own projects. +\item This project has its source code in a sub folder, so the first line of the +script must be to cd into that folder. +\end{itemize} +\begin{verbatim} +mopdev: + script: + - cd testing + - make clean + - make + - ./test -testset1 +\end{verbatim} +\begin{itemize} +\item The compiled executable takes a file as a runtime parameter which in this case +contains a set of instructions about which test set to run. +\item To simplify your task, these commands are part of the source code to be +compiled now. +\end{itemize} +\section{Important Note} +\label{sec-6} +\begin{itemize} +\item If you try to run any of the scripts written for this part of the worksheet +locally (as some students have in the past), it just won't work. I've included +it to demonstrated the general form your script needs to take. +\item In essence, it's a series of bash commands in a \textbf{yaml} script file. +\end{itemize} +\section{Task One} +\label{sec-7} +\begin{itemize} +\item Create an account on gitlab using your real name. +\item Import your public ssh key from nostromo to your gitlab +account. screenshot this is when complete. Add the screenshot and +your id\_rsa.pub in your report. +\item It, and your account will be deleted at the end of the module, so +this is not a security issue. +\item In this account, fork this existing repository: +\item \url{https://gitlab.com/carey.pridgeon/git_task} +\item Set up your local git id +\item Clone this repository whichever machine you're using. +\item In this repository, add the file .gitignore. +\item In this file add \textbf{.o}. This wil prevent git tracking object files in +any directory of your project. (.o files are compilation artefacts) +\item Add this file to the repository +\item Push your changes upstream to the remote repository +\item Create a new file README and write something in it +\item Add this file to the local repository with the commit message \emph{added +a readme}, then push it upstream. +\item Create a tag called 'before\_branch', push it upstream +\item Make a new branch call1ed "dev\_branch", switch to it, make some changes +(anything, just edit the readme if you like) then push them upstream to the +new branch. +\item Merge the branch with your master branch on gitlab (not the original +from my repository), deleting the new branch in the process, and +switch back to using master branch locally. +\end{itemize} +\section{Task Two} +\label{sec-8} +\subsection{Set up CI} +\label{sec-8-1} +\begin{itemize} +\item Create the file .gitlab-ci.yml, setting it up to compile, then execute the +binary for the git\_task source code. +\item Push it to the remote repository to trigger a build. +\end{itemize} +\section{Evidence} +\label{sec-9} +\subsection{Task One} +\label{sec-9-1} +\begin{itemize} +\item Provide a screenshot of the repository history page. +\item Provide a Listing of the repository file contents. +\end{itemize} +\subsection{Task Two} +\label{sec-9-2} +\begin{itemize} +\item List the contents of your .gitlab-ci.yml file. +\item Provide The full text output from the build process. +\end{itemize} +% Emacs 25.3.50.1 (Org mode 8.2.10) +\end{document} \ No newline at end of file diff --git a/Worksheets/worksheets/git/git_history.png b/Worksheets/worksheets/git/git_history.png new file mode 100644 index 0000000..54703e7 Binary files /dev/null and b/Worksheets/worksheets/git/git_history.png differ diff --git a/Worksheets/worksheets/git/git_worksheet_answer.tex b/Worksheets/worksheets/git/git_worksheet_answer.tex new file mode 100644 index 0000000..5e98810 --- /dev/null +++ b/Worksheets/worksheets/git/git_worksheet_answer.tex @@ -0,0 +1,191 @@ +% Created 2019-08-20 Tue 10:04 +\documentclass[minimal, t]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{fixltx2e} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{wrapfig} +\usepackage{rotating} +\usepackage[normalem]{ulem} +\usepackage{amsmath} +\usepackage{textcomp} +\usepackage{marvosym} +\usepackage{wasysym} +\usepackage{amssymb} +\usepackage{hyperref} +\tolerance=1000 +\author{Carey Pridgeon} +\date{\today} +\title{Git worksheet model answer} +\hypersetup{ + pdfkeywords={}, + pdfsubject={}, + pdfcreator={Emacs 25.3.50.1 (Org mode 8.2.10)}} +\begin{document} + +\maketitle +\section{gitlab history} +\label{sec-1} +\includegraphics[width=.9\linewidth]{git_history.png} +\section{CI output} +\label{sec-2} + +\#+BEGIN\_EXAMPLE + +Using Docker executor with image ruby:2.1 \ldots{} + +Pulling docker image ruby:2.1 \ldots{} + +Running on runner-30dcea4b-project-1780460-concurrent-0 via +runner-30dcea4b-machine-1475583164-33c49dd9-digital-ocean-4gb\ldots{} + +Cloning repository\ldots{} + +Cloning into '/builds/carey.pridgeon/worksheet\_git'\ldots{} + +Checking out a3398b64 as master\ldots{} + +\$ cd src + +\$ make + +gcc -Wall -O3 -c \_create\_particle\_pairs\_node.c + +gcc -Wall -O3 -c \_move\_particles\_MP.c + +gcc -Wall -O3 -c export\_project\_from\_current\_state.c + +gcc -Wall -O3 -c \_alloc\_mem\_contiguous.c + +gcc -Wall -O3 -c \_alloc\_mem.c + +gcc -Wall -O3 -c free\_and\_delete\_project.c + +gcc -Wall -O3 -c initialise\_nbo\_file.c + +gcc -Wall -O3 -c \_move\_particles\_RK4.c + +gcc -Wall -O3 -c write\_current\_state.c + +gcc -Wall -O3 -c \_parse\_line.c + +gcc -Wall -O3 -c run\_nbody\_environment.c + +gcc -Wall -O3 -c \_delete\_list\_of\_pairs.c + +gcc -Wall -O3 -c \_account\_for\_inertia.c + +gcc -Wall -O3 -c \_calculate\_forces\_acting\_between\_all\_particles.c + +gcc -Wall -O3 -c \_find\_meters\_per\_second\_velocity.c + +gcc -Wall -O3 -c main.c + +main.c: In function 'main': + +main.c:24:9: warning: variable 'ret\_nb' set but not used [-Wunused-but-set-variable] + +int ret\_nb = 0; + + \^{} +gcc -Wall -O3 -c \_find\_gravitational\_interaction\_between\_pair\_of\_particles.c + +gcc -Wall -O3 -c \_convert\_gravitational\_effects\_into\_velocity.c + +gcc -Wall -O3 -c \_make\_set\_of\_particle\_pairs.c + +gcc -Wall -O3 -c read\_single\_particle.c + +gcc -Wall -O3 -c load\_project\_file\_into\_nmod.c + +gcc -Wall -O3 -c \_clear\_total\_gravitational\_force\_accumulators.c + +gcc \_create\_particle\_pairs\_node.o \_move\_particles\_MP.o +export\_project\_from\_current\_state.o \_alloc\_mem\_contiguous.o \_alloc\_mem.o +free\_and\_delete\_project.o initialise\_nbo\_file.o \_move\_particles\_RK4.o +write\_current\_state.o \_parse\_line.o run\_nbody\_environment.o +\_delete\_list\_of\_pairs.o \_account\_for\_inertia.o +\_calculate\_forces\_acting\_between\_all\_particles.o +\_find\_meters\_per\_second\_velocity.o main.o +\_find\_gravitational\_interaction\_between\_pair\_of\_particles.o +\_convert\_gravitational\_effects\_into\_velocity.o \_make\_set\_of\_particle\_pairs.o +read\_single\_particle.o load\_project\_file\_into\_nmod.o +\_clear\_total\_gravitational\_force\_accumulators.o -lm -o nmod + +\$ ./nmod + +> State 1 of 10 completed + +> State 2 of 10 completed + +> State 3 of 10 completed + +> State 4 of 10 completed + +> State 5 of 10 completed + +> State 6 of 10 completed + +> State 7 of 10 completed + +> State 8 of 10 completed + +> State 9 of 10 completed + +> State 10 of 10 completed + +> Finished + +Build succeeded + +\section{bash history} +\label{sec-3} + +git clone git@gitlab.com:carey.pridgeon/worksheet\_git.git + +cd worksheet\_git/ + +ls + +git rm README.md + +git add --all + +git commit -m "first commit" + +emacs README + +git add --all + +git commit -m "added a readme" + +git push + +git tag -a before\_branch -m "before branch" + +git checkout -b dev\_branch + +emacs README + +git add --all + +git commit -m "edited readme in branch" + +git push -u origin dev\_branch + +git checkout master +git pull + +emacs .gitlab-ci.yml + +git add --all + +git commit -m "adding runner" + +git push + +\#+END\_EXAMPLE +% Emacs 25.3.50.1 (Org mode 8.2.10) +\end{document} \ No newline at end of file diff --git a/Worksheets/worksheets/gnuplot/.DS_Store b/Worksheets/worksheets/gnuplot/.DS_Store new file mode 100644 index 0000000..0155888 Binary files /dev/null and b/Worksheets/worksheets/gnuplot/.DS_Store differ diff --git a/Worksheets/worksheets/gnuplot/gnuplot.org b/Worksheets/worksheets/gnuplot/gnuplot.org new file mode 100644 index 0000000..d53339c --- /dev/null +++ b/Worksheets/worksheets/gnuplot/gnuplot.org @@ -0,0 +1,68 @@ +# -*- org-confirm-babel-evaluate: nil -*- +#+TITLE: 389COM: gnuplot +#+AUTHOR: Dr Carey Pridgeon, DR Nazaraf Shah +#+AUTHOR: Carey Pridgeon +#+EMAIL: ab0475@ccoventry.ac.uk +#+OPTIONS: toc:nil +#+STARTUP: showeverything +#+LaTeX_CLASS_OPTIONS: [minimal, t] +* Gnuplot +** The basics +- Gnuplot is a plotting tool useful for generating graphs from numerical data + such as you might create in your final year research. +- This worksheet will run you through the basics of using it. +** Scripting +- Unlike other graph generation tools you may have used, like Excel or other + wysiwig editors, gnuplot works through its own scripting language. +- This worksheet will walk you through the basics of using this language, and + give you the opportunity to experiment with it. +** Printing to screen +- Run the gnuplot as follows +#+BEGIN_SRC bash + gnuplot plotfile.plot +#+END_SRC +** Saving your output to an image file +- Add this to your script (after the heading) +#+BEGIN_SRC bash + set terminal png + set output 'plot.png' +#+END_SRC +- change the filename as required, or output filetype if you want. +- The *.plot* extension is purely arbitrary, I'm not even sure if it's standard, + it's just what I've always used. On Linux, file extensions rarely have any + meaning. Sometimes they are omitted completely. +* Preparation +- Download the plot files you need from here: + http://politespider.com/lectures/389COM/tasks.zip using wget into the folder you + will use for this worksheet. There are four subfolders, containing five + scripts. +* Task One +** Sine and Cos +- This is a rather simple graph, demonstrating the inbuilt mathematical + functionality of gnuplot. Run it, save an image of it, then replace these + functions with others from the set included, saving an image of those. +* Task Two +** Decreasing Time Series +- The data shown in this graph is shown decreasing over time. The decrease is + stable, so it might be representing annealing, if seen from a low resolution. +- Annealing does decrease smoothly, but the search for a stable state tends not + to be smooth when examined closely. +- Again, save an image of this data, then adjust this data, or the way it is + displayed(the form of the graph itself), and save a second image. +* Task Three +- The data for this task is a small sample of heart rate and blood pressure. +- It isn't terribly well displayed, can you improve it in any way? +- Take images of the original and changed form as before. +* Task Four +- This task, and the next one use data which comes supplied as standard to demonstrate the + capabilities of Gnuplot. +- Here the data, when loaded, will display a hemisphere of dots. Your task is + to manipulate this display in some way, alter some elements of the + display. Try to make it look substantially different. +- Evidence as before with before and after images. +* Task Five +- Using the same data, this time the plotting script you've been given produces + a sort of height map. +- Your challenge this time is to change the appearance of this height map. +- How you do this is up to you. +- Evidence as before. diff --git a/Worksheets/worksheets/gnuplot/gnuplot.pdf b/Worksheets/worksheets/gnuplot/gnuplot.pdf new file mode 100644 index 0000000..78ae4c4 Binary files /dev/null and b/Worksheets/worksheets/gnuplot/gnuplot.pdf differ diff --git a/Worksheets/worksheets/gnuplot/gnuplot.tex b/Worksheets/worksheets/gnuplot/gnuplot.tex new file mode 100644 index 0000000..740e458 --- /dev/null +++ b/Worksheets/worksheets/gnuplot/gnuplot.tex @@ -0,0 +1,125 @@ +% Created 2019-08-20 Tue 12:25 +\documentclass[minimal, t]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{fixltx2e} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{wrapfig} +\usepackage{rotating} +\usepackage[normalem]{ulem} +\usepackage{amsmath} +\usepackage{textcomp} +\usepackage{marvosym} +\usepackage{wasysym} +\usepackage{amssymb} +\usepackage{hyperref} +\tolerance=1000 +\author{Carey Pridgeon} +\date{\today} +\title{389COM: gnuplot} +\hypersetup{ + pdfkeywords={}, + pdfsubject={}, + pdfcreator={Emacs 25.3.50.1 (Org mode 8.2.10)}} +\begin{document} + +\maketitle +\section{Gnuplot} +\label{sec-1} +\subsection{The basics} +\label{sec-1-1} +\begin{itemize} +\item Gnuplot is a plotting tool useful for generating graphs from numerical data +such as you might create in your final year research. +\item This worksheet will run you through the basics of using it. +\end{itemize} +\subsection{Scripting} +\label{sec-1-2} +\begin{itemize} +\item Unlike other graph generation tools you may have used, like Excel or other +wysiwig editors, gnuplot works through its own scripting language. +\item This worksheet will walk you through the basics of using this language, and +give you the opportunity to experiment with it. +\end{itemize} +\subsection{Printing to screen} +\label{sec-1-3} +\begin{itemize} +\item Run the gnuplot as follows +\end{itemize} +\begin{verbatim} +gnuplot plotfile.plot +\end{verbatim} +\subsection{Saving your output to an image file} +\label{sec-1-4} +\begin{itemize} +\item Add this to your script (after the heading) +\end{itemize} +\begin{verbatim} +set terminal png +set output 'plot.png' +\end{verbatim} +\begin{itemize} +\item change the filename as required, or output filetype if you want. +\item The \textbf{.plot} extension is purely arbitrary, I'm not even sure if it's standard, +it's just what I've always used. On Linux, file extensions rarely have any +meaning. Sometimes they are omitted completely. +\end{itemize} +\section{Preparation} +\label{sec-2} +\begin{itemize} +\item Download the plot files you need from here: +\url{http://politespider.com/lectures/389COM/tasks.zip} using wget into the folder you +will use for this worksheet. There are four subfolders, containing five +scripts. +\end{itemize} +\section{Task One} +\label{sec-3} +\subsection{Sine and Cos} +\label{sec-3-1} +\begin{itemize} +\item This is a rather simple graph, demonstrating the inbuilt mathematical +functionality of gnuplot. Run it, save an image of it, then replace these +functions with others from the set included, saving an image of those. +\end{itemize} +\section{Task Two} +\label{sec-4} +\subsection{Decreasing Time Series} +\label{sec-4-1} +\begin{itemize} +\item The data shown in this graph is shown decreasing over time. The decrease is +stable, so it might be representing annealing, if seen from a low resolution. +\item Annealing does decrease smoothly, but the search for a stable state tends not +to be smooth when examined closely. +\item Again, save an image of this data, then adjust this data, or the way it is +displayed(the form of the graph itself), and save a second image. +\end{itemize} +\section{Task Three} +\label{sec-5} +\begin{itemize} +\item The data for this task is a small sample of heart rate and blood pressure. +\item It isn't terribly well displayed, can you improve it in any way? +\item Take images of the original and changed form as before. +\end{itemize} +\section{Task Four} +\label{sec-6} +\begin{itemize} +\item This task, and the next one use data which comes supplied as standard to demonstrate the +capabilities of Gnuplot. +\item Here the data, when loaded, will display a hemisphere of dots. Your task is +to manipulate this display in some way, alter some elements of the +display. Try to make it look substantially different. +\item Evidence as before with before and after images. +\end{itemize} +\section{Task Five} +\label{sec-7} +\begin{itemize} +\item Using the same data, this time the plotting script you've been given produces +a sort of height map. +\item Your challenge this time is to change the appearance of this height map. +\item How you do this is up to you. +\item Evidence as before. +\end{itemize} +% Emacs 25.3.50.1 (Org mode 8.2.10) +\end{document} \ No newline at end of file diff --git a/Worksheets/worksheets/gnuplot/tasks/.DS_Store b/Worksheets/worksheets/gnuplot/tasks/.DS_Store new file mode 100644 index 0000000..50740b7 Binary files /dev/null and b/Worksheets/worksheets/gnuplot/tasks/.DS_Store differ diff --git a/Worksheets/worksheets/gnuplot/tasks/task_1/.DS_Store b/Worksheets/worksheets/gnuplot/tasks/task_1/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/Worksheets/worksheets/gnuplot/tasks/task_1/.DS_Store differ diff --git a/Worksheets/worksheets/gnuplot/tasks/task_1/plot.plot b/Worksheets/worksheets/gnuplot/tasks/task_1/plot.plot new file mode 100644 index 0000000..36443df --- /dev/null +++ b/Worksheets/worksheets/gnuplot/tasks/task_1/plot.plot @@ -0,0 +1,2 @@ +set title 'More plotting fun' +plot cos(x), sin (x) diff --git a/Worksheets/worksheets/gnuplot/tasks/task_2/.DS_Store b/Worksheets/worksheets/gnuplot/tasks/task_2/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/Worksheets/worksheets/gnuplot/tasks/task_2/.DS_Store differ diff --git a/Worksheets/worksheets/gnuplot/tasks/task_2/exp.dat b/Worksheets/worksheets/gnuplot/tasks/task_2/exp.dat new file mode 100644 index 0000000..8418bbd --- /dev/null +++ b/Worksheets/worksheets/gnuplot/tasks/task_2/exp.dat @@ -0,0 +1,11 @@ +0.0 1050 +0.5 0666 +1.0 0318 +1.5 0213 +2.0 0145 +2.5 0072 +3.0 0053 +3.5 0034 +4.0 0017 +4.5 0011 +5.0 0008 diff --git a/Worksheets/worksheets/gnuplot/tasks/task_2/plot2.plot b/Worksheets/worksheets/gnuplot/tasks/task_2/plot2.plot new file mode 100644 index 0000000..ad709f3 --- /dev/null +++ b/Worksheets/worksheets/gnuplot/tasks/task_2/plot2.plot @@ -0,0 +1,4 @@ +set title 'My plot' +set ylabel 'Y Axis' +set xlabel 'Time Axis' +plot 'exp.dat' using 1:2:(sqrt($2)) with yerrorbars \ No newline at end of file diff --git a/Worksheets/worksheets/gnuplot/tasks/task_3/heart.dat b/Worksheets/worksheets/gnuplot/tasks/task_3/heart.dat new file mode 100644 index 0000000..c1ef472 --- /dev/null +++ b/Worksheets/worksheets/gnuplot/tasks/task_3/heart.dat @@ -0,0 +1,13 @@ +# time, sys, dia, hr +8.5, 112, 60, 52 +9, 116, 73, 59 +10.5, 127, 71, 58 +11, 124, 69, 62 +11.5, 117, 68, 60 +12, 122, 73, 60 +13, 121, 67, 62 +15, 120, 78, 68 +15.5, 134, 70, 96 +16, 120, 72, 73 +16.5, 114, 68, 72 +22, 119, 69, 61 \ No newline at end of file diff --git a/Worksheets/worksheets/gnuplot/tasks/task_3/plot3.plot b/Worksheets/worksheets/gnuplot/tasks/task_3/plot3.plot new file mode 100644 index 0000000..239c6d5 --- /dev/null +++ b/Worksheets/worksheets/gnuplot/tasks/task_3/plot3.plot @@ -0,0 +1,8 @@ +set grid +set title 'BP and Heartrate' +set yrange [50:160] +set xlabel 'time (military)' +set label 'finished walk' at 15, 140 +unset label +set label 'finished walk' at 15, 105 +plot 'heart.dat' u 1:2 w lp t 'systolic', 'heart.dat' u 1:3 w lp t 'diastolic', 'heart.dat' u 1:4 w lp t 'heartrate' \ No newline at end of file diff --git a/Worksheets/worksheets/gnuplot/tasks/task_4/hemisphr.dat b/Worksheets/worksheets/gnuplot/tasks/task_4/hemisphr.dat new file mode 100644 index 0000000..1512e9e --- /dev/null +++ b/Worksheets/worksheets/gnuplot/tasks/task_4/hemisphr.dat @@ -0,0 +1,249 @@ +0.687151 -0.636061 0.351070 +0.641845 -0.232436 0.730759 +0.273514 -0.848211 0.453572 +-0.550699 0.813122 0.188582 +-0.347821 0.841382 0.413639 +-0.829282 -0.509933 0.228604 +0.399696 0.466770 0.788903 +0.736650 0.020192 0.675973 +-0.274921 -0.182391 0.944008 +0.222153 -0.841996 0.491621 +-0.461820 -0.755197 0.465189 +0.294122 0.670369 0.681247 +0.261892 0.211723 0.941587 +-0.554902 0.477345 0.681341 +-0.316651 -0.647984 0.692711 +0.940858 -0.324848 0.096228 +0.455903 -0.594463 0.662394 +0.144714 -0.941617 0.304000 +-0.417407 0.068704 0.906119 +0.227478 -0.641231 0.732855 +-0.636961 -0.237343 0.733450 +0.302450 -0.701212 0.645620 +0.355187 0.625974 0.694261 +0.126868 0.938774 0.320325 +-0.198825 -0.825277 0.528571 +-0.605855 0.466076 0.644758 +-0.979983 0.196939 0.029143 +0.730081 -0.677485 0.089423 +-0.733658 -0.065519 0.676353 +0.593833 -0.583880 0.553576 +0.630038 -0.757773 0.169798 +0.214063 0.953829 0.210682 +-0.210639 0.045720 0.976494 +0.502269 -0.672584 0.543467 +-0.713914 -0.019685 0.699956 +-0.102652 0.225742 0.968764 +-0.575935 0.679368 0.454707 +-0.552680 0.325656 0.767133 +-0.105718 0.489948 0.865318 +-0.642008 0.237217 0.729077 +0.912208 -0.302322 0.276546 +0.685076 0.723350 0.086233 +-0.730777 -0.226034 0.644107 +-0.733895 -0.430285 0.525597 +0.643521 -0.710952 0.283598 +0.206564 0.497907 0.842271 +-0.388945 -0.813833 0.431738 +0.514538 -0.817664 0.258216 +0.658314 0.496308 0.565952 +0.588167 0.708096 0.390716 +0.552130 0.427566 0.715779 +-0.705121 0.320760 0.632390 +-0.689813 0.688923 0.222582 +0.553844 0.711779 0.432004 +-0.046413 0.212599 0.976037 +0.399406 -0.766162 0.503458 +-0.233463 -0.160645 0.959004 +0.529336 -0.621840 0.577163 +0.606825 0.629365 0.485451 +0.501835 0.612707 0.610534 +-0.683857 0.450334 0.574055 +-0.882283 0.443548 0.157614 +0.586683 0.464120 0.663623 +-0.595482 0.233864 0.768576 +0.237607 -0.846347 0.476696 +-0.409129 0.625441 0.664407 +0.664685 -0.741902 0.088182 +-0.588147 -0.803628 0.090915 +-0.682428 -0.728175 0.063668 +0.540892 0.542901 0.642413 +0.117736 -0.786009 0.606900 +0.846712 -0.474373 0.240934 +-0.739743 -0.661408 0.123773 +-0.674807 -0.295222 0.676373 +0.612938 0.564586 0.552766 +-0.200352 -0.584274 0.786437 +-0.583626 -0.608199 0.538028 +-0.842820 -0.537921 0.017206 +-0.914848 -0.365948 0.170690 +-0.722029 -0.691806 0.008805 +-0.749203 0.647075 0.141379 +0.542856 0.713704 0.442644 +0.708415 0.597082 0.376353 +-0.514737 -0.622752 0.589258 +0.517661 -0.651774 0.554273 +0.964970 -0.229158 0.127752 +-0.896947 -0.320221 0.304868 +-0.806679 0.191888 0.558970 +-0.449889 0.492534 0.744990 +-0.121829 0.701839 0.701840 +-0.136385 -0.726159 0.673864 +0.141310 0.776791 0.613700 +0.730240 0.567015 0.381108 +-0.096403 0.876852 0.470997 +-0.407930 0.721095 0.560014 +-0.617285 0.119734 0.777575 +-0.516675 0.784493 0.342954 +-0.409966 -0.414935 0.812254 +0.172975 0.141665 0.974685 +-0.421979 0.745663 0.515674 +-0.657963 -0.199035 0.726271 +0.579425 0.685534 0.440805 +-0.214461 0.856536 0.469418 +0.809815 -0.403364 0.426025 +-0.706903 0.588917 0.391745 +0.585611 0.463666 0.664886 +0.438727 0.698150 0.565779 +-0.464391 -0.446944 0.764580 +-0.657744 0.534413 0.530825 +0.537112 -0.749640 0.386718 +0.007187 -0.597134 0.802109 +-0.356817 -0.675864 0.644895 +0.682514 -0.090759 0.725216 +-0.759950 -0.640982 0.107787 +0.314462 0.320252 0.893618 +0.794300 -0.091894 0.600535 +0.231465 -0.737745 0.634159 +-0.493894 -0.137710 0.858548 +-0.636201 0.372391 0.675703 +0.851855 -0.078785 0.517819 +-0.252937 0.823486 0.507832 +-0.501036 -0.558527 0.661068 +-0.667380 -0.740968 0.074628 +0.826057 -0.356650 0.436383 +0.676558 0.736342 0.008355 +0.356317 0.717007 0.599115 +-0.702754 -0.252940 0.664950 +0.241305 0.873806 0.422179 +-0.444469 0.694911 0.565284 +0.285538 0.893811 0.345789 +-0.816376 -0.543964 0.193993 +0.411338 -0.215215 0.885711 +-0.685665 0.175779 0.706375 +-0.370169 -0.144937 0.917588 +0.415254 -0.282774 0.864640 +0.342285 -0.791855 0.505773 +-0.442990 -0.543366 0.713101 +0.737523 0.300789 0.604637 +-0.648119 0.560986 0.515012 +0.832393 -0.080222 0.548349 +-0.745494 -0.022420 0.666135 +-0.343740 -0.929656 0.132602 +0.632050 -0.340980 0.695878 +-0.670904 0.696398 0.254790 +-0.691893 -0.369253 0.620433 +-0.644716 -0.667477 0.372578 +0.511738 -0.534049 0.672990 +0.542618 -0.778095 0.316437 +-0.369727 -0.900054 0.230662 +-0.681421 -0.572227 0.456313 +0.200343 -0.968269 0.149389 +-0.897349 0.345346 0.274776 +-0.524090 -0.266174 0.809000 +-0.863974 0.483194 0.141680 +-0.549403 -0.740878 0.386336 +0.206515 -0.791156 0.575694 +-0.617364 0.470918 0.630157 +0.964888 0.246811 0.089862 +0.681090 0.695442 0.229080 +-0.635200 -0.708299 0.307949 +0.388299 0.158032 0.907882 +0.573002 0.727986 0.376438 +0.601183 -0.586111 0.543188 +-0.235470 -0.811948 0.534130 +0.155904 -0.681863 0.714672 +-0.672889 0.588006 0.448852 +0.306393 0.874114 0.376892 +0.032428 0.271616 0.961859 +0.107372 0.155924 0.981916 +0.592487 0.224923 0.773543 +-0.585302 -0.568462 0.578163 +0.663301 0.728159 0.172675 +-0.513634 0.781053 0.355157 +0.810010 -0.386643 0.440898 +-0.139469 0.655629 0.742091 +0.621210 0.615790 0.484666 +-0.051261 0.216594 0.974915 +0.658176 -0.726097 0.198966 +0.603351 0.247584 0.758070 +0.686614 -0.089142 0.721537 +0.226818 0.552577 0.802005 +-0.741481 0.327178 0.585799 +-0.366696 0.771805 0.519472 +0.238979 0.647361 0.723749 +-0.672754 -0.332136 0.661126 +0.696711 -0.471073 0.541004 +0.160743 0.905419 0.392909 +-0.912978 0.232968 0.334959 +-0.285567 -0.185395 0.940255 +-0.619693 -0.706342 0.342142 +0.382874 0.892396 0.238822 +-0.381917 0.512306 0.769209 +-0.652722 -0.575238 0.493006 +0.240731 0.522574 0.817902 +-0.047170 0.578270 0.814481 +-0.769256 0.592413 0.239359 +0.517803 -0.372629 0.770083 +0.879867 -0.153159 0.449862 +-0.408953 0.473917 0.779846 +-0.611694 0.790628 0.027172 +0.082968 0.088643 0.992602 +0.329262 0.745222 0.579854 +-0.093733 0.752980 0.651334 +-0.876795 -0.216424 0.429408 +0.659021 0.742999 0.116803 +0.471778 -0.608160 0.638410 +-0.771241 0.625579 0.117638 +0.666548 0.601906 0.439799 +-0.177481 -0.887762 0.424711 +-0.544219 -0.682418 0.487987 +-0.232865 0.617965 0.750929 +-0.761795 -0.037050 0.646758 +0.261925 0.847441 0.461778 +-0.447484 -0.545276 0.708824 +-0.005218 -0.773747 0.633474 +0.216045 0.575576 0.788693 +-0.018365 0.656245 0.754325 +0.305420 0.594325 0.743973 +-0.508168 -0.512279 0.692341 +0.478855 0.493185 0.726269 +0.451841 0.584772 0.673707 +0.253152 -0.875528 0.411540 +-0.653601 0.507497 0.561474 +0.486897 0.719655 0.495003 +0.497595 -0.353890 0.791935 +-0.044254 -0.938949 0.341197 +-0.781823 -0.038665 0.622300 +-0.486930 -0.527387 0.696249 +0.869944 -0.440150 0.222408 +0.279697 0.693758 0.663679 +0.593555 0.421221 0.685759 +0.519810 -0.396648 0.756616 +-0.862087 0.275232 0.425503 +0.237904 -0.755351 0.610612 +-0.614121 -0.664634 0.425579 +0.328900 0.035730 0.943689 +0.769607 0.633896 0.076682 +-0.575359 -0.794269 0.195191 +-0.608405 0.637947 0.472087 +-0.658203 0.089686 0.747479 +-0.913833 -0.389451 0.115050 +0.272020 -0.871201 0.408673 +-0.519856 -0.851058 0.073831 +0.411266 0.672267 0.615563 +0.686633 0.578928 0.439747 +-0.097612 -0.192980 0.976335 +-0.710703 -0.205920 0.672680 +-0.622197 0.068071 0.779896 +-0.296696 0.405710 0.864506 diff --git a/Worksheets/worksheets/gnuplot/tasks/task_4/plot4.plot b/Worksheets/worksheets/gnuplot/tasks/task_4/plot4.plot new file mode 100644 index 0000000..9f91ee7 --- /dev/null +++ b/Worksheets/worksheets/gnuplot/tasks/task_4/plot4.plot @@ -0,0 +1,30 @@ +# set terminal pngcairo transparent enhanced font "arial,10" fontscale 1.0 size 600, 400 +# set output 'scatter.1.png' +set bar 1.000000 front +set style circle radius graph 0.02, first 0.00000, 0.00000 +set style ellipse size graph 0.05, 0.03, first 0.00000 angle 0 units xy +set dummy u, v +set key inside right top vertical Right noreverse enhanced autotitle box lt black linewidth 1.000 dashtype solid +set style textbox transparent margins 1.0, 1.0 border +unset logscale +set parametric +unset paxis 1 tics +unset paxis 2 tics +unset paxis 3 tics +unset paxis 4 tics +unset paxis 5 tics +unset paxis 6 tics +unset paxis 7 tics +set title "Simple demo of scatter data conversion to grid data" +set xlabel "data style point - no dgrid" +set paxis 1 range [ * : * ] noreverse nowriteback +set paxis 2 range [ * : * ] noreverse nowriteback +set paxis 3 range [ * : * ] noreverse nowriteback +set paxis 4 range [ * : * ] noreverse nowriteback +set paxis 5 range [ * : * ] noreverse nowriteback +set paxis 6 range [ * : * ] noreverse nowriteback +set paxis 7 range [ * : * ] noreverse nowriteback +set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front noinvert bdefault +u = 0.0 +## Last datafile plotted: "hemisphr.dat" +splot "hemisphr.dat" \ No newline at end of file diff --git a/Worksheets/worksheets/gnuplot/tasks/task_4/plot5.plot b/Worksheets/worksheets/gnuplot/tasks/task_4/plot5.plot new file mode 100644 index 0000000..5b56db6 --- /dev/null +++ b/Worksheets/worksheets/gnuplot/tasks/task_4/plot5.plot @@ -0,0 +1,33 @@ +# set terminal pngcairo transparent enhanced font "arial,10" fontscale 1.0 size 600, 400 +# set output 'scatter.5.png' +set bar 1.000000 front +set style circle radius graph 0.02, first 0.00000, 0.00000 +set style ellipse size graph 0.05, 0.03, first 0.00000 angle 0 units xy +set dgrid3d 10,10, 16 +set dummy u, v +set key inside right top vertical Right noreverse enhanced autotitle box lt black linewidth 1.000 dashtype solid +set style textbox transparent margins 1.0, 1.0 border +unset logscale +set parametric +set contour base +set style data lines +unset paxis 1 tics +unset paxis 2 tics +unset paxis 3 tics +unset paxis 4 tics +unset paxis 5 tics +unset paxis 6 tics +unset paxis 7 tics +set title "Simple demo of scatter data conversion to grid data" +set xlabel "data style lines, dgrid3d ,,16, contour" +set paxis 1 range [ * : * ] noreverse nowriteback +set paxis 2 range [ * : * ] noreverse nowriteback +set paxis 3 range [ * : * ] noreverse nowriteback +set paxis 4 range [ * : * ] noreverse nowriteback +set paxis 5 range [ * : * ] noreverse nowriteback +set paxis 6 range [ * : * ] noreverse nowriteback +set paxis 7 range [ * : * ] noreverse nowriteback +set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front noinvert bdefault +u = 0.0 +## Last datafile plotted: "hemisphr.dat" +splot "hemisphr.dat" diff --git a/Worksheets/worksheets/licences/.DS_Store b/Worksheets/worksheets/licences/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/Worksheets/worksheets/licences/.DS_Store differ diff --git a/Worksheets/worksheets/licences/Licenses_Worksheet.org b/Worksheets/worksheets/licences/Licenses_Worksheet.org new file mode 100644 index 0000000..d394562 --- /dev/null +++ b/Worksheets/worksheets/licences/Licenses_Worksheet.org @@ -0,0 +1,30 @@ +#+TITLE: Licensing Worksheet +#+AUTHOR: Carey Pridgeon +#+EMAIL: ab0475@ccoventry.ac.uk +#+OPTIONS: toc:nil +#+STARTUP: showeverything +#+LaTeX_CLASS_OPTIONS: [minimal, t] +* Preamble +- Read this worksheet completely before you begin +- Single sentence answers will not be graded. You must use paragraphs. +- Answer *all* questions to gain the full marks associated with this worksheet. +- Citations must use the CUHarvard format. +** Questions +- 1: What would happen if you used MPL licensed code in a proprietary +product? +- 2: If you use an LGPL Licensed library in your project, what effect + would this have on the rest of your code and why? +- 3: If you want to use open source code in your project but would not + like to release any source code, what licence or licences can the + code you want to use be under? +- 4: What is the primary difference between a Free Software Licence and + an Open Source Licence. Name a licence from each category not + including the GPL or licences that fit in both categories. +- 5: Your project is intended for use by academics and may be included + in a product which might have patent bearing or commercial + code. Which license would you select and why. +- 6: Identify a consortium that have co-operated to release an open + source alternative to a Proprietary Licensed Product/Driver/Codec. + + + diff --git a/Worksheets/worksheets/licences/Licenses_Worksheet.pdf b/Worksheets/worksheets/licences/Licenses_Worksheet.pdf new file mode 100644 index 0000000..94607aa Binary files /dev/null and b/Worksheets/worksheets/licences/Licenses_Worksheet.pdf differ diff --git a/Worksheets/worksheets/licences/Licenses_Worksheet.tex b/Worksheets/worksheets/licences/Licenses_Worksheet.tex new file mode 100644 index 0000000..e9511fe --- /dev/null +++ b/Worksheets/worksheets/licences/Licenses_Worksheet.tex @@ -0,0 +1,59 @@ +% Created 2019-08-20 Tue 10:10 +\documentclass[minimal, t]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{fixltx2e} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{wrapfig} +\usepackage{rotating} +\usepackage[normalem]{ulem} +\usepackage{amsmath} +\usepackage{textcomp} +\usepackage{marvosym} +\usepackage{wasysym} +\usepackage{amssymb} +\usepackage{hyperref} +\tolerance=1000 +\author{Carey Pridgeon} +\date{\today} +\title{Licensing Worksheet} +\hypersetup{ + pdfkeywords={}, + pdfsubject={}, + pdfcreator={Emacs 25.3.50.1 (Org mode 8.2.10)}} +\begin{document} + +\maketitle +\section{Preamble} +\label{sec-1} +\begin{itemize} +\item Read this worksheet completely before you begin +\item Single sentence answers will not be graded. You must use paragraphs. +\item Answer \textbf{all} questions to gain the full marks associated with this worksheet. +\item Citations must use the CUHarvard format. +\end{itemize} +\subsection{Questions} +\label{sec-1-1} +\begin{itemize} +\item 1: What would happen if you used MPL licensed code in a proprietary +\end{itemize} +product? +\begin{itemize} +\item 2: If you use an LGPL Licensed library in your project, what effect +would this have on the rest of your code and why? +\item 3: If you want to use open source code in your project but would not +like to release any source code, what licence or licences can the +code you want to use be under? +\item 4: What is the primary difference between a Free Software Licence and +an Open Source Licence. Name a licence from each category not +including the GPL or licences that fit in both categories. +\item 5: Your project is intended for use by academics and may be included +in a product which might have patent bearing or commercial +code. Which license would you select and why. +\item 6: Identify a consortium that have co-operated to release an open +source alternative to a Proprietary Licensed Product/Driver/Codec. +\end{itemize} +% Emacs 25.3.50.1 (Org mode 8.2.10) +\end{document} \ No newline at end of file diff --git a/Worksheets/worksheets/licences/licence_worksheet_answers.org b/Worksheets/worksheets/licences/licence_worksheet_answers.org new file mode 100644 index 0000000..f8631fd --- /dev/null +++ b/Worksheets/worksheets/licences/licence_worksheet_answers.org @@ -0,0 +1,80 @@ +#+TITLE: Licence worksheet +#+AUTHOR: Carey Pridgeon +#+EMAIL: ab0475@ccoventry.ac.uk +#+OPTIONS: toc:nil +#+STARTUP: showeverything +#+LaTeX_CLASS_OPTIONS: [minimal, t] + +* This is only a rough guide, the answers are always changing +- *Question* +- What would happen if you used MPL licensed code in a proprietary +product? + +- *Answer:* + +- It would only effect the code in files that are declared to be under +the MPL. That code would need to be released, all proprietary code +would be able to be kept secret. +- *Question* +- If you use an LGPL Licensed library in your project, what effect would this + have on the rest of your code and why? + +- *Answer:* +- It would not effect the licences used in the rest of your code if the +library covered by the LGPL is dynamically linked. If it is statically +linked the LGPL licence covers all code in your project because the +library is fully integrated into the distributed binary. +- *Question* +- If you want to use open source code in your project but would not +like to release any source code, what licence or licences can the code +you want to use be under and why? + +- *Answer:* +- (There are quite a few answers to this, but it requires they look +outside the lecture slides) + +- You can use Academic Free Licence or the Apache Public Licenced code +or the BSD License because they allow the code relicenced under them +to be re-licensed. +- *Question* +- What is the primary difference between a Free Software Licence and an + Open Source Licence. Give an example of one licence from each type. + +*Answer:* +- Free Software Licenses are intended to restrict or prevent commercial use of + your code, Open Source licences encourage it. GPL (Free Software License) APL + (Open Source Licence). +- *Question* +- Your project is intended for use by academics and may be included in a + product which might have patent bearing or commercial code. Which + license would you select and why. + +- *Answer:* + +- Apache Public License (one option, not the only one) Because it +contains no restriction on either relicencing or using in code with +patented portions. + +- Valid answers are any licence that allows relicencing and does not +object to being used in code with patented components. +- *Question* +- Identify a consortium that have co-operated to release an open source +alternative to a Proprietary Licenced Product/Driver/Codec. + +- *Answer:* +- OpenDocument, developed by The Organization for the Advancement of +Structured Information Standards (OASIS). This is a global consortium +that works on the development, convergence, and adoption of e-business +and web service standards + +- Unified Extensible Firmware Interface (UEFI). Intel developed the original EFI + (Extensible Firmware Interface) specification. +- *Question* +- What is the main difference between allowed software patents in the UK and the US? + +- *Answer:* + +- In the UK, software patents can only be granted of the software in question is + tied to a specific physical device, like an engine control system. In the US + software patents need only be unique. + diff --git a/Worksheets/worksheets/licences/licence_worksheet_answers.pdf b/Worksheets/worksheets/licences/licence_worksheet_answers.pdf new file mode 100644 index 0000000..c957d10 Binary files /dev/null and b/Worksheets/worksheets/licences/licence_worksheet_answers.pdf differ diff --git a/Worksheets/worksheets/licences/licence_worksheet_answers.tex b/Worksheets/worksheets/licences/licence_worksheet_answers.tex new file mode 100644 index 0000000..5c877f7 --- /dev/null +++ b/Worksheets/worksheets/licences/licence_worksheet_answers.tex @@ -0,0 +1,128 @@ +% Created 2019-08-20 Tue 10:11 +\documentclass[minimal, t]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{fixltx2e} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{wrapfig} +\usepackage{rotating} +\usepackage[normalem]{ulem} +\usepackage{amsmath} +\usepackage{textcomp} +\usepackage{marvosym} +\usepackage{wasysym} +\usepackage{amssymb} +\usepackage{hyperref} +\tolerance=1000 +\author{Carey Pridgeon} +\date{\today} +\title{Licence worksheet} +\hypersetup{ + pdfkeywords={}, + pdfsubject={}, + pdfcreator={Emacs 25.3.50.1 (Org mode 8.2.10)}} +\begin{document} + +\maketitle + +\section{This is only a rough guide, the answers are always changing} +\label{sec-1} +\begin{itemize} +\item \textbf{Question} +\item What would happen if you used MPL licensed code in a proprietary +\end{itemize} +product? + +\begin{itemize} +\item \textbf{Answer:} + +\item It would only effect the code in files that are declared to be under +\end{itemize} +the MPL. That code would need to be released, all proprietary code +would be able to be kept secret. +\begin{itemize} +\item \textbf{Question} +\item If you use an LGPL Licensed library in your project, what effect would this +have on the rest of your code and why? + +\item \textbf{Answer:} +\item It would not effect the licences used in the rest of your code if the +\end{itemize} +library covered by the LGPL is dynamically linked. If it is statically +linked the LGPL licence covers all code in your project because the +library is fully integrated into the distributed binary. +\begin{itemize} +\item \textbf{Question} +\item If you want to use open source code in your project but would not +\end{itemize} +like to release any source code, what licence or licences can the code +you want to use be under and why? + +\begin{itemize} +\item \textbf{Answer:} +\item (There are quite a few answers to this, but it requires they look +\end{itemize} +outside the lecture slides) + +\begin{itemize} +\item You can use Academic Free Licence or the Apache Public Licenced code +\end{itemize} +or the BSD License because they allow the code relicenced under them +to be re-licensed. +\begin{itemize} +\item \textbf{Question} +\item What is the primary difference between a Free Software Licence and an +Open Source Licence. Give an example of one licence from each type. +\end{itemize} + +\textbf{Answer:} +\begin{itemize} +\item Free Software Licenses are intended to restrict or prevent commercial use of +your code, Open Source licences encourage it. GPL (Free Software License) APL +(Open Source Licence). +\item \textbf{Question} +\item Your project is intended for use by academics and may be included in a +product which might have patent bearing or commercial code. Which +license would you select and why. + +\item \textbf{Answer:} + +\item Apache Public License (one option, not the only one) Because it +\end{itemize} +contains no restriction on either relicencing or using in code with +patented portions. + +\begin{itemize} +\item Valid answers are any licence that allows relicencing and does not +\end{itemize} +object to being used in code with patented components. +\begin{itemize} +\item \textbf{Question} +\item Identify a consortium that have co-operated to release an open source +\end{itemize} +alternative to a Proprietary Licenced Product/Driver/Codec. + +\begin{itemize} +\item \textbf{Answer:} +\item OpenDocument, developed by The Organization for the Advancement of +\end{itemize} +Structured Information Standards (OASIS). This is a global consortium +that works on the development, convergence, and adoption of e-business +and web service standards + +\begin{itemize} +\item Unified Extensible Firmware Interface (UEFI). Intel developed the original EFI +(Extensible Firmware Interface) specification. +\item \textbf{Question} +\item What is the main difference between allowed software patents in the UK and the US? + +\item \textbf{Answer:} + +\item In the UK, software patents can only be granted of the software in question is +tied to a specific physical device, like an engine control system. In the US +software patents need only be unique. +\end{itemize} +% Emacs 25.3.50.1 (Org mode 8.2.10) +\end{document} \ No newline at end of file diff --git a/Worksheets/worksheets/terminal/.DS_Store b/Worksheets/worksheets/terminal/.DS_Store new file mode 100644 index 0000000..832659a Binary files /dev/null and b/Worksheets/worksheets/terminal/.DS_Store differ diff --git a/Worksheets/worksheets/terminal/Linux_Worksheet.org b/Worksheets/worksheets/terminal/Linux_Worksheet.org new file mode 100644 index 0000000..dba6c0d --- /dev/null +++ b/Worksheets/worksheets/terminal/Linux_Worksheet.org @@ -0,0 +1,216 @@ +#+TITLE: Linux Terminal Worksheet +#+AUTHOR: Dr Carey Pridgeon +#+EMAIL: ab0475@coventry.ac.uk +#+OPTIONS: ^:nil toc:nil +#+STARTUP: showeverything +#+LaTeX_CLASS_OPTIONS: [minimal, t] +* Introduction To the Linux Terminal +* Preamble +- Read the *entire* worksheet before you begin. +- In this Worksheet you will cover a range of the commands available in the + Linux Terminal and commands useful to you for this module +- The format is that the commands you are to use are listed and explained, then + the task you are to do with them follows. +- When you see any text in square brackets, *do not type them, just + what they ask you to type in* +- /[filename]/ means *choose your own filename.* +- Square bracketed sections means you replace that with your own + text/filename/foldername. +- For this worksheet we will be using either our server on campus that is not + available to the general student population or the modules virtual + machine. This virtual machine can be installed on your laptop so you might + consider it more convenient. The entire module can be completed using the virtual + machine. + +- To transfer files in and out of the VM we recommend GIT, for preference the + universities GIT server. +- It's the method we use, and as it minimises the chances of data loss, it's the + only one we recommend. + + +* Accessing a Linux Server from Windows +- On windows we recommend MobaXterm, since that provides everything you need in + one application. If you are familier with X-forwarding, use Putty and an + X-client, but mobaXterm is better for most people. +- To connect to our server from a laptop, MobaXterm can be downloaded + from the following URL - [[http://mobaxterm.mobatek.net/][link]]. +- If you lack install rights on the machine you are using, download + MobaXterm Portable. +- If you are on a university machine in the EEC Faculty. MobaXterm is installed. +- Mobaxterm provides an X server, so programs with graphical user + interfaces should run locally via a process called [[https://www.youtube.com/watch?v=XVFAYuEhrsQ][X Forwarding]]. +** Connecting to Linux Server with MobaXterm +- In the prompt window, type: +- *ssh [username]@servername* (replace this with whatever name we give you. +- At the login prompt, use the password you've been given +- You can allow Mobaxterm to save your password. It's quite safe to do this on + any university machine if you are logged into your own user account. +** Using Putty +- You can use Putty on Windows, but you will need to have a separate X + server installed and configured to use X forwarding, so MobaXterm is still + advised if you're not already familier with the subject. +** Connecting to a Linux Server from a Mac +- *ssh -Y [username]@[machinename]* +- You need an X server again. I suggest XQuartz, installed through + Macports, HomeBrew or via the install package at [[https://www.xquartz.org/][Xquartz.org]] +- Whichever method you use, typing *gedit* to launch a basic text editor with a + graphical user interface will tell you whether you have succeeded in + establishing a connection that allows X forwarding. +** Editing files + - Our server has the text editors vim and emacs installed. When asked to edit + files in this tutorial use vim, unless you know how to use emacs. +- *Nano* is not installed, don't ask for it, do not use it. Nano is evil, Nano + will bring the end times upon us all. +* Commands reference +- This is *not* the exercise, this is the reference *for* the + exercise. +- I reiterate, /never/ type the square brackets, replace any text in + square brackets with new text. +- *ls* + - List your files. +- *ls -la* + - List all your files in long format including hidden files (displays + permissions) +- *ls -R* + - List the files in a folder tree recursively +- *cd [directory name]* + - Change directory +- *cd ~* + - Change to your home directory +- *cd ..* + - Move up one directory in the tree +- *pwd* + - Print the working directory +- *rm [file]* + - Delete the specified file +- *rm -rf [dir]* + - Delete the specified directory recursively(rm alone will not work) +- *cp [file] [dest]* + - Copy a file (send a copy to a new folder or filename) +- *mv file [dest]* + - Move a file (to a new folder or change filename) +- *chmod +x [filename]* + - Change permissions on a file (in this case making it executable) +- *./[filename]* + - Run a program in your home folder +- *sh [filename]* + - Run a bash script (file with an .sh extension) +- *ln -s [file] [/new/location/name]* + - Create a symbolic link to a file in a specified location. + - A symbolic link allows you to keep a reference to a file somewhere + other than where that directory/file exists, so you can access it + directly without navigating to that directory/file through the + normal path. + - It can also be used to allow typing of a simpler name than the + files real one, which can simplify the process of typing complex + filenames. + - This is similar to windows shortcuts some of you will be familiar + with, but more capable. +- *touch [file]* + - Update the timestamp on, or create, a file +- *mkdir [dirname]* + - Create the specified directory +- *Mkdir –m 700 [dirname]* + - Create a folder with the specified permissions (owner can execute) +- *less [filename]* + - Display the contents of a large file one line at a time, advanced + by pressing [return], exit by pressing *q* +- *cat* + - Concatenate specified files to some source file/location, if no + destination is set, the terminal is used. + - *cat [file1] [file2] > [newfile]* +- *wget creative.coventry.ac.uk/~carey/[filename]* + - Download a file from a webserver +- *grep [string] [file]* + - Locate a specified string in a given file +- *less [filename]* + - This utility will allow you to scroll back and forth through a text + file one line at a time in the console. + - Many Linux commands accept input from the keyboard (called + Standard Input) and produce output to the terminal screen (called + Standard Output). +- *> [destination filename]* + - Redirect standard output to a file, over-writing its contents or + creating it if it doesn't exist. +- *>>* + - Append standard output to file at the end of the file, also + creating it if it doesn't exist. +- *date;who* + - List who is logged into the system and the date/time. +- *man [subject]* + - Display the manual (man page) for the specified Linux command or + almost any Linux aspect. +- *man -k [string]* + - search the man system for an entry with a name containing the given + string, or containing that string. +- Tar (Tape Archiver) + - This is a utility to compress a folder into a single + file. Originally intended to create single file backups to write to + large tapes for long term storage. Google are the worlds largest + consumers of tapes of this type. Tar's native compression is light + to the point of non-existent, so it can be combined with external + compression libraries though command options. +- *tar -cvf archive_name.tar dirname/* + - Create a single file archive. +- *tar -cvzf archive_name.tar.gz dirname/* + - Create a single file archive filtered through gzip for compression +- *tar -xvf archive_name.tar.gz + - Extract a file archive +- *tar -zxvf archive_name.tar.gz -C [optional output dir]* + - Extract a file archive to a specified directory +- *tar -tvf archive_name.tar* + - List the contents of a tar file (compressed or not) without extracting it +* Worksheet Tasks +** Part One - Basic Skills Test +- *Do these one at a time, don't combine tasks even if it looks like you + can.* +- list the files in your home directory so that hidden files are also shown. +- make a directory called 389 in your home directory +- change to this sub-directory +- create a folder called *cli* +- print the full path for this directory and redirect the output to /text.txt/ +- Change back to the parent directory +- Create a symbolic link to text.txt in your home directory called txt. +- cat this symlink. +- Create empty file 389/cli/fstab.txt without using a text editor +- Concatenate /etc/fstab to 389/cli/fstab.txt +- Display this file in the terminal +- Search for the word 'reference' in fstab.txt +- Redirect the output you see to the file 389/cli/out.txt and print + this to the console. +- Repeat this with the word /defaults/ +- Create a file myls in 389/cli and write *ls -la /* in it +- Make this file executable and run it. +- If it works (prints the result of *ls -la /*, run it again and + redirect the output, appending it to out.txt +- redirect a list of who is logged in to nostromo to 389/cli/who.txt +- Create a symlink to cli in your home directory. +- Use this symlink to list the contants of cli/ +- Search man for entries containing *less* +- Repeat this search and redirect the output to 389/cli/less.txt, then + display this file in the terminal. +- Fetch this file http://politespider.com/images/mozilla_logo.jpg into 389/cli. + + +- In *man*, find one of the commands you have used in this tutorial. +- tar the 389 folder +- tar the 389 folder with gzip compression +- list content of first tar +- list contents of second tar +- create a folder called tmp in 389 and untar the gzip compressed tar + file into it +- recursively list the content of 389 +* Part Two - Advanced Task + + +* Worksheet Evidence Requirements +** For Task One +- Logout, log in again then type the following command +- *cat .bash_history > cli_done.txt* +- This will create the file that you will submit as evidence of + completing this worksheet. +- It doesn't matter if there are mistakes recorded in this output, everything you type is + recorded in your bash history. Just submit the file as it is. +- To get the text file from Nostromo you can commit it to your university GitHub + repository so you can easily retrieve it to include in your submission. +** For Task Two diff --git a/Worksheets/worksheets/terminal/Linux_Worksheet.pdf b/Worksheets/worksheets/terminal/Linux_Worksheet.pdf new file mode 100644 index 0000000..bfcdf41 Binary files /dev/null and b/Worksheets/worksheets/terminal/Linux_Worksheet.pdf differ diff --git a/Worksheets/worksheets/terminal/Linux_Worksheet.tex b/Worksheets/worksheets/terminal/Linux_Worksheet.tex new file mode 100644 index 0000000..dc4d448 --- /dev/null +++ b/Worksheets/worksheets/terminal/Linux_Worksheet.tex @@ -0,0 +1,370 @@ +% Created 2019-08-20 Tue 11:15 +\documentclass[minimal, t]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{fixltx2e} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{wrapfig} +\usepackage{rotating} +\usepackage[normalem]{ulem} +\usepackage{amsmath} +\usepackage{textcomp} +\usepackage{marvosym} +\usepackage{wasysym} +\usepackage{amssymb} +\usepackage{hyperref} +\tolerance=1000 +\author{Dr Carey Pridgeon} +\date{\today} +\title{Linux Terminal Worksheet} +\hypersetup{ + pdfkeywords={}, + pdfsubject={}, + pdfcreator={Emacs 25.3.50.1 (Org mode 8.2.10)}} +\begin{document} + +\maketitle +\section{Introduction To the Linux Terminal} +\label{sec-1} +\section{Preamble} +\label{sec-2} +\begin{itemize} +\item Read the \textbf{entire} worksheet before you begin. +\item In this Worksheet you will cover a range of the commands available in the +Linux Terminal and commands useful to you for this module +\item The format is that the commands you are to use are listed and explained, then +the task you are to do with them follows. +\item When you see any text in square brackets, \textbf{do not type them, just +what they ask you to type in} +\item \emph{[filename]} means \textbf{choose your own filename.} +\item Square bracketed sections means you replace that with your own +text/filename/foldername. +\item For this worksheet we will be using either our server on campus that is not +available to the general student population or the modules virtual +machine. This virtual machine can be installed on your laptop so you might +consider it more convenient. The entire module can be completed using the virtual +machine. + +\item To transfer files in and out of the VM we recommend GIT, for preference the +universities GIT server. +\item It's the method we use, and as it minimises the chances of data loss, it's the +only one we recommend. +\end{itemize} + + +\section{Accessing a Linux Server from Windows} +\label{sec-3} +\begin{itemize} +\item On windows we recommend MobaXterm, since that provides everything you need in +one application. If you are familier with X-forwarding, use Putty and an +X-client, but mobaXterm is better for most people. +\item To connect to our server from a laptop, MobaXterm can be downloaded +from the following URL - \href{http://mobaxterm.mobatek.net/}{link}. +\item If you lack install rights on the machine you are using, download +MobaXterm Portable. +\item If you are on a university machine in the EEC Faculty. MobaXterm is installed. +\item Mobaxterm provides an X server, so programs with graphical user +interfaces should run locally via a process called \href{https://www.youtube.com/watch?v=XVFAYuEhrsQ}{X Forwarding}. +\end{itemize} +\subsection{Connecting to Linux Server with MobaXterm} +\label{sec-3-1} +\begin{itemize} +\item In the prompt window, type: +\item \textbf{ssh [username]@servername} (replace this with whatever name we give you. +\item At the login prompt, use the password you've been given +\item You can allow Mobaxterm to save your password. It's quite safe to do this on +any university machine if you are logged into your own user account. +\end{itemize} +\subsection{Using Putty} +\label{sec-3-2} +\begin{itemize} +\item You can use Putty on Windows, but you will need to have a separate X +server installed and configured to use X forwarding, so MobaXterm is still +advised if you're not already familier with the subject. +\end{itemize} +\subsection{Connecting to a Linux Server from a Mac} +\label{sec-3-3} +\begin{itemize} +\item \textbf{ssh -Y [username]@[machinename]} +\item You need an X server again. I suggest XQuartz, installed through +Macports, HomeBrew or via the install package at \href{https://www.xquartz.org/}{Xquartz.org} +\item Whichever method you use, typing \textbf{gedit} to launch a basic text editor with a +graphical user interface will tell you whether you have succeeded in +establishing a connection that allows X forwarding. +\end{itemize} +\subsection{Editing files} +\label{sec-3-4} +\begin{itemize} +\item Our server has the text editors vim and emacs installed. When asked to edit +files in this tutorial use vim, unless you know how to use emacs. +\item \textbf{Nano} is not installed, don't ask for it, do not use it. Nano is evil, Nano +will bring the end times upon us all. +\end{itemize} +\section{Commands reference} +\label{sec-4} +\begin{itemize} +\item This is \textbf{not} the exercise, this is the reference \textbf{for} the +exercise. +\item I reiterate, \emph{never} type the square brackets, replace any text in +square brackets with new text. +\item \textbf{ls} +\begin{itemize} +\item List your files. +\end{itemize} +\item \textbf{ls -la} +\begin{itemize} +\item List all your files in long format including hidden files (displays +permissions) +\end{itemize} +\item \textbf{ls -R} +\begin{itemize} +\item List the files in a folder tree recursively +\end{itemize} +\item \textbf{cd [directory name]} +\begin{itemize} +\item Change directory +\end{itemize} +\item \textbf{cd \textasciitilde{}} +\begin{itemize} +\item Change to your home directory +\end{itemize} +\item \textbf{cd ..} +\begin{itemize} +\item Move up one directory in the tree +\end{itemize} +\item \textbf{pwd} +\begin{itemize} +\item Print the working directory +\end{itemize} +\item \textbf{rm [file]} +\begin{itemize} +\item Delete the specified file +\end{itemize} +\item \textbf{rm -rf [dir]} +\begin{itemize} +\item Delete the specified directory recursively(rm alone will not work) +\end{itemize} +\item \textbf{cp [file] [dest]} +\begin{itemize} +\item Copy a file (send a copy to a new folder or filename) +\end{itemize} +\item \textbf{mv file [dest]} +\begin{itemize} +\item Move a file (to a new folder or change filename) +\end{itemize} +\item \textbf{chmod +x [filename]} +\begin{itemize} +\item Change permissions on a file (in this case making it executable) +\end{itemize} +\item \textbf{./[filename]} +\begin{itemize} +\item Run a program in your home folder +\end{itemize} +\item \textbf{sh [filename]} +\begin{itemize} +\item Run a bash script (file with an .sh extension) +\end{itemize} +\item \textbf{ln -s [file] [/new/location/name]} +\begin{itemize} +\item Create a symbolic link to a file in a specified location. +\begin{itemize} +\item A symbolic link allows you to keep a reference to a file somewhere +other than where that directory/file exists, so you can access it +directly without navigating to that directory/file through the +normal path. +\item It can also be used to allow typing of a simpler name than the +files real one, which can simplify the process of typing complex +filenames. +\item This is similar to windows shortcuts some of you will be familiar +with, but more capable. +\end{itemize} +\end{itemize} +\item \textbf{touch [file]} +\begin{itemize} +\item Update the timestamp on, or create, a file +\end{itemize} +\item \textbf{mkdir [dirname]} +\begin{itemize} +\item Create the specified directory +\end{itemize} +\item \textbf{Mkdir –m 700 [dirname]} +\begin{itemize} +\item Create a folder with the specified permissions (owner can execute) +\end{itemize} +\item \textbf{less [filename]} +\begin{itemize} +\item Display the contents of a large file one line at a time, advanced +by pressing [return], exit by pressing \textbf{q} +\end{itemize} +\item \textbf{cat} +\begin{itemize} +\item Concatenate specified files to some source file/location, if no +destination is set, the terminal is used. +\item \textbf{cat [file1] [file2] > [newfile]} +\end{itemize} +\item \textbf{wget creative.coventry.ac.uk/\textasciitilde{}carey/[filename]} +\begin{itemize} +\item Download a file from a webserver +\end{itemize} +\item \textbf{grep [string] [file]} +\begin{itemize} +\item Locate a specified string in a given file +\end{itemize} +\item \textbf{less [filename]} +\begin{itemize} +\item This utility will allow you to scroll back and forth through a text +file one line at a time in the console. +\begin{itemize} +\item Many Linux commands accept input from the keyboard (called +Standard Input) and produce output to the terminal screen (called +Standard Output). +\end{itemize} +\end{itemize} +\item \textbf{> [destination filename]} +\begin{itemize} +\item Redirect standard output to a file, over-writing its contents or +creating it if it doesn't exist. +\end{itemize} +\item \textbf{>>} +\begin{itemize} +\item Append standard output to file at the end of the file, also +creating it if it doesn't exist. +\end{itemize} +\item \textbf{date;who} +\begin{itemize} +\item List who is logged into the system and the date/time. +\end{itemize} +\item \textbf{man [subject]} +\begin{itemize} +\item Display the manual (man page) for the specified Linux command or +almost any Linux aspect. +\end{itemize} +\item \textbf{man -k [string]} +\begin{itemize} +\item search the man system for an entry with a name containing the given +string, or containing that string. +\end{itemize} +\item Tar (Tape Archiver) +\begin{itemize} +\item This is a utility to compress a folder into a single +file. Originally intended to create single file backups to write to +large tapes for long term storage. Google are the worlds largest +consumers of tapes of this type. Tar's native compression is light +to the point of non-existent, so it can be combined with external +compression libraries though command options. +\end{itemize} +\item \textbf{tar -cvf archive\_name.tar dirname/} +\begin{itemize} +\item Create a single file archive. +\end{itemize} +\item \textbf{tar -cvzf archive\_name.tar.gz dirname/} +\begin{itemize} +\item Create a single file archive filtered through gzip for compression +\end{itemize} +\item *tar -xvf archive\_name.tar.gz +\begin{itemize} +\item Extract a file archive +\end{itemize} +\item \textbf{tar -zxvf archive\_name.tar.gz -C [optional output dir]} +\begin{itemize} +\item Extract a file archive to a specified directory +\end{itemize} +\item \textbf{tar -tvf archive\_name.tar} +\begin{itemize} +\item List the contents of a tar file (compressed or not) without extracting it +\end{itemize} +\end{itemize} +\section{Worksheet Tasks} +\label{sec-5} +\subsection{Part One - Basic Skills Test} +\label{sec-5-1} +\begin{itemize} +\item \textbf{Do these one at a time, don't combine tasks even if it looks like you +can.} +\item list the files in your home directory so that hidden files are also shown. +\item make a directory called 389 in your home directory +\item change to this sub-directory +\item create a folder called \textbf{cli} +\item print the full path for this directory and redirect the output to \emph{text.txt} +\item Change back to the parent directory +\item Create a symbolic link to text.txt in your home directory called txt. +\item cat this symlink. +\item Create empty file 389/cli/fstab.txt without using a text editor +\item Concatenate /etc/fstab to 389/cli/fstab.txt +\item Display this file in the terminal +\item Search for the word 'reference' in fstab.txt +\item Redirect the output you see to the file 389/cli/out.txt and print +this to the console. +\item Repeat this with the word \emph{defaults} +\item Create a file myls in 389/cli and write \textbf{ls -la /} in it +\item Make this file executable and run it. +\item If it works (prints the result of \textbf{ls -la /}, run it again and +redirect the output, appending it to out.txt +\item redirect a list of who is logged in to nostromo to 389/cli/who.txt +\item Create a symlink to cli in your home directory. +\item Use this symlink to list the contants of cli/ +\item Search man for entries containing \textbf{less} +\item Repeat this search and redirect the output to 389/cli/less.txt, then +display this file in the terminal. +\item Fetch this file \url{http://politespider.com/images/mozilla_logo.jpg} into 389/cli. +\end{itemize} + + +\begin{itemize} +\item In \textbf{man}, find one of the commands you have used in this tutorial. +\item tar the 389 folder +\item tar the 389 folder with gzip compression +\item list content of first tar +\item list contents of second tar +\item create a folder called tmp in 389 and untar the gzip compressed tar +file into it +\item recursively list the content of 389 +\end{itemize} +\section{Part Two - Advanced Task} +\label{sec-6} +\subsection{Install the latest Python and Pip in your home directory using VirtualEnv} +\label{sec-6-1} +\begin{itemize} +\item You can install virtualenv without root privileges, this is the entire reason +virtualenv exists. +\item Your install must be able to switch between different versions of Python +easily. +\item Virtualenv allows you to have multiple versions of python installed, and to +switch between them easily. + +\item Unlike other tasks, for this one there aren't any instructions in this +worksheet. +\item The reason for this is that there are ample tutorials on the web. As this is a +final year module exercise you should be more than capable of locating +resources yourself. +\end{itemize} + + +\section{Worksheet Evidence Requirements} +\label{sec-7} +\subsection{For Task One} +\label{sec-7-1} +\begin{itemize} +\item Logout, log in again then type the following command +\item \textbf{cat .bash\_history > cli\_done.txt} +\item This will create the file that you will submit as evidence of +completing this worksheet. +\item It doesn't matter if there are mistakes recorded in this output, everything you type is +recorded in your bash history. Just submit the file as it is. +\item To get the text file from Nostromo you can commit it to your university GitHub +repository so you can easily retrieve it to include in your submission. +\end{itemize} +\subsection{For Task Two} +\label{sec-7-2} +\begin{itemize} +\item A screenshot with the first page of the output of ls -R on the root folder of +your created python environment. +\item And: +\item A text file with the full output of ls -R on the root folder of your created +python environment. +\item Screenshots showing at least three versions of Pythons running on your account. +\end{itemize} +% Emacs 25.3.50.1 (Org mode 8.2.10) +\end{document} \ No newline at end of file diff --git a/css/presentation.css b/css/presentation.css new file mode 100644 index 0000000..903833c --- /dev/null +++ b/css/presentation.css @@ -0,0 +1,25 @@ + +img, a {border:none, outline: none;} + +.reveal table th, .reveal table td { + text-align: center; + border: 1px solid white; +} + +.reveal pre { + width: 100%; + border: none; + box-shadow: none; +} + +.main .row img { + display: inline-block; + border: 0px; + background-color: transparent; +} + +.noborder .reveal section img { + background:none; + border:none; + box-shadow:none; + } \ No newline at end of file diff --git a/lectures/.DS_Store b/lectures/.DS_Store new file mode 100644 index 0000000..7949e70 Binary files /dev/null and b/lectures/.DS_Store differ diff --git a/lectures/code_quality.html b/lectures/code_quality.html new file mode 100644 index 0000000..6c84597 --- /dev/null +++ b/lectures/code_quality.html @@ -0,0 +1,233 @@ + + + + +389COM: Code Quality + + + + + + + + + + + + +
+
+

389COM: Code Quality

Dr Carey Pridgeon, Dr Nazaraf Shah

Created: 2019-10-09 Wed 10:14

+
+
+
+

Table of Contents

+ +
+
+
+
+

Why Code Quality Always Matters

+
+
+
+
+
+
+

Readability

+
    +
  • Style guides exist for a reason.
  • +
  • Well written, non obscure code is more likely to be re-used by other +developers.
  • +
  • Compilers can turn any well structured code into a good program, so there +is no reason at all to make your code hard to read.
  • +
  • Potential employers are more likely to be impressed by well structured code.
  • +
  • Comments!!!!!
  • +
  • 'I can understand it so other people can too' has never been a +valid viewpoint. It has always just irritated me.
  • + +
+
+
+
+
+

Appropriate design choices

+
    +
  • In open source coding, especially at the start of a project, there is no rush.
  • +
  • Choose the right Language.
  • +
  • Choose the right programming methodology OOP, Procedural, Functional.
  • +
  • It matters more that the chosen methodology matches the problem then whether +or not it is in vogue. Personally I don't like OOP, but I use it if it is +appropriate for a given task.
  • +
  • Have some design ideas, and make them visible to others in your repository, +write some User Stories, put these online in your repository too.
  • + +
+
+
+
+
+

Documentation

+
    +
  • This is probably the biggest problem in open source development.
  • +
  • Why is it worse for open source then it is for the commercial world?
  • +
  • Why should avoiding this problem be a priority for you?
  • +
  • Automatic Documentation is a thing, and has been for decades, so there is no +excuse. Nor if you use it, is there an excuse for using it badly.
  • + +
+
+
+
+
+

+
    +
  • Wiki pages (gitlab/github et al provide these) are a good place to provide +documentation not suited to automatic generation.
  • +
  • Auto documenters collect up comments from your code, so using them will +encourage you to get into the habit of writing information rich comments.
  • + +
+
+
+
+
+

+
    +
  • There are some good open source auto documenters available, I recommend you try Doxygen
  • +
  • Avoid static documentation formats (hand coded web pages), as these are far +too difficult to maintain.
  • +
  • The websites and materials used on this module, and in all my teaching, are +auto generated from plain text via org mode in emacs, even most of the +diagrams.
  • + +
+
+
+
+
+

Testing

+
    +
  • What do we mean by testing code.
  • +
  • When do you start testing.
  • +
  • What testing approaches are there?
  • +
  • Discussion point: Why is testing one of the highest paid positions in software +engineering?
  • + +
+
+
+
+
+

Bug Tracking/Fixing

+
    +
  • If you don't use an online git repository, your code will +essentially be invisible.
  • +
  • 'Many Eyes' Principle is only true in theory. In practice it's only true for +either very large or very popular projects.
  • +
  • All Bugs need to be reported in your online documentation. Both +gitlab/github both have 'issues' functionality to facilitate this.
  • +
  • All work to fix them, successful or not, must be reported in 'issues', because +of the potential employer visibility aspect.
  • + +
+
+
+
+
+

+
    +
  • Bugs aren't really significant externally till you get to tentative release +level of development, although for shared development.
  • +
  • Non trivial bugs still go in issues.
  • +
  • For shared development, planning and timeline management should also +go online.
  • +
  • Trello is a good place to do this according to some of our past students.
  • + +
+
+
+
+
+

Obligatory XKCD

+ +
+

code_quality.png +

+
+
    +
  • Copyright: Randall Munroe - XKCD
  • +
  • Mirrored in my hosting to avoid bandwidth stealing
  • + +
+
+
+
+
+

Licence for this work

+
    +
  • Licenced under Creative Commons Attribution-ShareAlike 4.0 +International by Dr Carey Pridgeon 2016
  • +
  • (Licence does not cover linked images owned by other content creators)
  • + +
+
+
+
+
+ + + + + + diff --git a/lectures/code_quality.org b/lectures/code_quality.org new file mode 100644 index 0000000..5000d0d --- /dev/null +++ b/lectures/code_quality.org @@ -0,0 +1,87 @@ +# -*- mode: org -*- +#+TITLE: 389COM: Code Quality +#+AUTHOR: Dr Carey Pridgeon, Dr Nazaraf Shah +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:1 num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +# Licenced under Creative Commons Attribution-ShareAlike 4.0 +# International by Dr Carey Pridgeon 2019 +* Why Code Quality Always Matters +** Readability +- Style guides exist for a reason. +- Well written, non obscure code is more likely to be re-used by other + developers. +- Compilers can turn any well structured code into a good program, so there + is *no reason at all* to make your code hard to read. +- Potential employers are more likely to be impressed by well structured code. +- Comments!!!!! +- 'I can understand it so other people can too' has /never/ been a + valid viewpoint. It has always just irritated me. +** Appropriate design choices +- In open source coding, especially at the start of a project, there is no rush. +- Choose the right Language. +- Choose the right programming methodology /OOP/, /Procedural/, /Functional/. +- It matters more that the chosen methodology matches the problem then whether + or not it is in vogue. Personally I don't like OOP, but I use it if it is + appropriate for a given task. +- Have some design ideas, and make them visible to others in your repository, + write some User Stories, put these online in your repository too. +** Documentation +- This is probably the biggest problem in open source development. +- Why is it worse for open source then it is for the commercial world? +- Why should avoiding this problem be a priority for you? +- Automatic Documentation is a thing, and has been for decades, so there is no + excuse. Nor if you use it, is there an excuse for using it badly. +** +- Wiki pages (gitlab/github et al provide these) are a good place to provide + documentation not suited to automatic generation. +- Auto documenters collect up comments from your code, so using them will + encourage you to get into the habit of writing information rich comments. +** +- There are some good open source auto documenters available, I recommend you try [[http://www.stack.nl/~dimitri/doxygen/][Doxygen]] +- Avoid static documentation formats (hand coded web pages), as these are far + too difficult to maintain. +- The websites and materials used on this module, and in all my teaching, are + auto generated from plain text via org mode in emacs, even most of the + diagrams. +** Testing +- What do we mean by testing code. +- When do you start testing. +- What testing approaches are there? +- Discussion point: Why is testing one of the highest paid positions in software + engineering? +** Bug Tracking/Fixing +- If you don't use an online git repository, your code will + essentially be invisible. +- 'Many Eyes' Principle is only true in theory. In practice it's only true for + either very large or very popular projects. +- All Bugs need to be reported in your online documentation. Both + gitlab/github both have 'issues' functionality to facilitate this. +- All work to fix them, successful or not, must be reported in 'issues', because + of the potential employer visibility aspect. +** +- Bugs aren't really significant externally till you get to tentative release + level of development, although for shared development. +- Non trivial bugs still go in issues. +- For shared development, planning and timeline management should also + go online. +- [[https://trello.com/][Trello]] is a good place to do this according to some of our past students. +** Obligatory XKCD +file:img/code_quality.png +- Copyright: Randall Munroe - XKCD +- Mirrored in my hosting to avoid bandwidth stealing +** Licence for this work +- Licenced under Creative Commons Attribution-ShareAlike 4.0 + International by Dr Carey Pridgeon 2016 +- (Licence does not cover linked images owned by other content creators) diff --git a/lectures/emacs.html b/lectures/emacs.html new file mode 100644 index 0000000..e3e3af5 --- /dev/null +++ b/lectures/emacs.html @@ -0,0 +1,359 @@ + + + + +389COM: Emacs and Vi + + + + + + + + + + + + +
+
+

389COM: Emacs and Vi

Dr Carey Pridgeon, Dr Nazaraf Shah

Created: 2019-10-30 Wed 11:57

+
+
+
+

Table of Contents

+ +
+
+
+
+

What is Emacs?

+
+
+
+
+
+
+

The basics

+
    +
  • Emacs is not just a text editor, just like Vim is not just a text editor.
  • +
  • However, Emacs goes much further than Vim into not just a text editor +territory.
  • +
  • We lack time to list everything Emacs can do, suffice to say you could have +completed your entire degree using no other tool but emacs.
  • +
  • Or rather, using it as a frontend to access other tools you need.
  • + +
+
+
+
+
+

Why don't we do this?

+
    +
  • Emacs has, for some things, a near vertical learning curve if you're not +already needing the things you're trying to do. This makes teaching to our +first year students something we have been reluctant to do.
  • +
  • However in other universities they do exactly this. It is after all, free.
  • +
  • The Worksheet you have in this Module began its life as a tutorial for first +year students at Exeter University, although it has become a little more +complex since then. Not much though, I've even removed some elements.
  • +
  • Emacs is a wonderful and complex tool, but it has evolved free from commercial +constraints that say things like user interaction must be easy +from the start.
  • + +
+
+
+
+
+

Why Use it?

+
    +
  • Using Emacs isn't hard once you know what you're doing, but it takes a while +to learn, and you need a reason to make that effort when easier, albeit far +less capable tools exist.
  • +
  • Your main reason to learn it should be that if you intend to be software +developers, you should be using what is essentially the top item in the +developers toolkit.
  • +
  • By this I do not mean don't use Vim.
  • +
  • I do mean Don't use nano, but you should never use nano, just never.
  • + +
+
+
+
+
+

What can Emacs do

+
    +
  • Code editing (duh…). +
      +
    • This is probably the thing I use emacs for the least nowadays, though it is +extraordinarily good at it.
    • + +
  • +
  • Document Production. +
      +
    • Emacs contains functionality greater than any commercial word processor, but +not so easy to access.
    • + +
  • +
  • CLI. +
      +
    • You can get a terminal within Emacs in a different buffer and use that to +compile your code while you are writing it.
    • + +
  • +
  • You can write code in a document, and Emacs will compile this code, then put +its output in your document. Populating tables, producing charts, whatever you +want.
  • + +
+
+
+
+
+

+
    +
  • Other things are useful if you are more interested in relying heavily on +emacs.
  • +
  • Web Browsing.
  • +
  • Email Client (a few staff here use emacs for this).
  • +
  • Music/Media Player.
  • +
  • File Organiser.
  • +
  • Game Engine.
  • +
  • After this the list is vast, and increasingly specialised. Emacs is a long way +from being just a text editor.
  • +
  • This is why I wouldn't tell people to avoid Vim. You wouldn't use a mobile +home to go to a supermarket to do your weekly shop if you had a normal car.
  • + +
+
+
+
+
+

How would it be useful to you now?

+
    +
  • TeX.
  • +
  • A document formatting language, the first in fact, and by far the best. If +only because it has been improved for so many years, because it is free +software (not open source).
  • +
  • TeX, was originally created because Donald Knuth, writer of the hardest books +in computer science, The Art of Computer Science, disliked the document +formatting options available for his first book, so he wrote his own instead.
  • + +
+
+
+
+
+

LaTeX and Academia

+
    +
  • Tex proved so popular it was widely adopted in the academic world and became +LaTeX in the 1980's.
  • +
  • Almost all scientific documents are written in LaTeX now, those that aren't +are written in MsWord.
  • +
  • LaTeX separates content from formatting, unlike MS Word, which requires that +you put formatting in as you write. LaTeX inserts on document final +compilation.
  • + +
+
+
+
+
+

Org Mode

+
    +
  • LaTeX is great, and using it directly has plenty of advantages. Plus there are +lots of ways to do that. Sites like Sharelatex, tool like TexMaker all make +using LaTex fairly painless, but Emacs, through org mode, makes it as simple +as writing a plain text file, with a few simple formatting indicators.
  • + +
+
+ +
** slide title or section title, (depending on export type)
+-- bullet point
+*bolded text*
+/italicized text/
+
+
+
    +
  • Where emacs has the edge is in the potential export targets for documents +created in org mode (which is essentially plain text with a few special +characters and format instructions), there are quite a +few.
  • + +
+
+
+
+
+

+
    +
  • Org mode was originally just meant for people to organise their work in emacs, +which is where the name came from, but it has long since stopped being just +that. There are now hundreds if not thousands of emacs and org-mode plugins +and modifications. We have our own custom emacs/org-mode setup on Nostromo +that we have released as an open source project.
  • + +
+
+
+
+
+

Document generation Time Compilation

+
    +
  • Using Babel and Org Mode emacs will execute code you've written while +compiling your document and insert the results into whatever format you +specify.
  • +
  • This could be an image, a graph (asymptote or gnuplot), or any one of a large +number of supported languages.
  • +
  • Word won't do this. Other LaTeX using editors can, but not as simply. For example:
  • + +
+ +
+

demo2.png +

+
+ +
+
+
+
+

+
    +
  • Without the babel instruction block, here's the code Org-mode executed to +generate the image.
  • + +
+
+ +
import graph;                                                                                                                                                                                             
+import settings;                                                                                                                                                                                          
+defaultpen(2);                                                                                                                                                                                            
+outformat="png";                                                                                                                                                                                          
+draw((0,50)--(50,0),white);   
+0)--(50,0),white);                                                                                                                                                                               
+draw((0,50)--(25,0),white);                                                                                                                                                                               
+draw((0,50)--(0,0),white);                                                                                                                                                                                
+draw((0,50)--(-50,0),white);                                                                                                                                                                              
+draw((0,50)--(-25,0),white);                                                                                                  
+
+
+
+
+
+
+

Alternatives

+
    +
  • There are alternatives, such as Pandoc, which can export from plain +text to many of the same export targets, or Markdown, of which +Pandoc is an advanced version.
  • +
  • Both of these are even simpler than *org Mode to use, as you don't need to +learn Emacs first.
  • +
  • Org mode has more support and capabilities, but the relative complexity of +Emacs, while it makes it useful, causes it to be viewed as less desirable by +some, in spite of it being less complex than most modern Integrated +Development Environments.
  • +
  • When used with libraries such as Org-Reveal, as it is now for these slides, it +produces results faster than many other methods once you understand it.
  • +
  • All materials for this module have been created using Emacs.
  • + +
+
+
+
+
+

Vi (Vim)

+
    +
  • Much lighter text editor.
  • +
  • Still, if you're smart, primarily controlled by keypress combinations.
  • +
  • GUI's are available (Gvim and others, but they slow you down).
  • +
  • Better suited to use over an ssh, or other network connection.
  • +
  • Has full syntax highlighting.
  • +
  • Some scripting support.
  • +
  • Extensible though plugins.
  • + +
+
+
+
+
+

Vim-Pandoc

+
    +
  • You can, with a little setup, use Pandoc with Vim via Vim-Pandoc. It doesn't +seem as yet to be supplied as standard with any Linux distributions, although +this may change.
  • +
  • Advantages +
      +
    • Live Preview
    • +
    • Easy Bibliography creation
    • + +
  • +
  • Disadvantages +
      +
    • Lacks the comprehensive featureset and plugin support of Org-Mode (which you might not use).
    • + +
  • + +
+
+
+
+
+ + + + + + diff --git a/lectures/emacs.html~ b/lectures/emacs.html~ new file mode 100644 index 0000000..f1d8572 --- /dev/null +++ b/lectures/emacs.html~ @@ -0,0 +1,359 @@ + + + + +389COM: Emacs and Vi + + + + + + + + + + + + +
+
+

389COM: Emacs and Vi

Dr Carey Pridgeon, Dr Nazaraf Shah

Created: 2019-10-30 Wed 11:56

+
+
+
+

Table of Contents

+ +
+
+
+
+

What is Emacs?

+
+
+
+
+
+
+

The basics

+
    +
  • Emacs is not just a text editor, just like Vim is not just a text editor.
  • +
  • However, Emacs goes much further than Vim into not just a text editor +territory.
  • +
  • We lack time to list everything Emacs can do, suffice to say you could have +completed your entire degree using no other tool but emacs.
  • +
  • Or rather, using it as a frontend to access other tools you need.
  • + +
+
+
+
+
+

Why don't we do this?

+
    +
  • Emacs has, for some things, a near vertical learning curve if you're not +already needing the things you're trying to do. This makes teaching to our +first year students something we have been reluctant to do.
  • +
  • However in other universities they do exactly this. It is after all, free.
  • +
  • The Worksheet you have in this Module began its life as a tutorial for first +year students at Exeter University, although it has become a little more +complex since then. Not much though, I've even removed some elements.
  • +
  • Emacs is a wonderful and complex tool, but it has evolved free from commercial +constraints that say things like user interaction must be easy +from the start.
  • + +
+
+
+
+
+

Why Use it?

+
    +
  • Using Emacs isn't hard once you know what you're doing, but it takes a while +to learn, and you need a reason to make that effort when easier, albeit far +less capable tools exist.
  • +
  • Your main reason to learn it should be that if you intend to be software +developers, you should be using what is essentially the top item in the +developers toolkit.
  • +
  • By this I do not mean don't use Vim.
  • +
  • I do mean Don't use nano, but you should never use nano, just never.
  • + +
+
+
+
+
+

What can Emacs do

+
    +
  • Code editing (duh…). +
      +
    • This is probably the thing I use emacs for the least nowadays, though it is +extraordinarily good at it.
    • + +
  • +
  • Document Production. +
      +
    • Emacs contains functionality greater than any commercial word processor, but +not so easy to access.
    • + +
  • +
  • CLI. +
      +
    • You can get a terminal within Emacs in a different buffer and use that to +compile your code while you are writing it.
    • + +
  • +
  • You can write code in a document, and Emacs will compile this code, then put +its output in your document. Populating tables, producing charts, whatever you +want.
  • + +
+
+
+
+
+

+
    +
  • Other things are useful if you are more interested in relying heavily on +emacs.
  • +
  • Web Browsing.
  • +
  • Email Client (a few staff here use emacs for this).
  • +
  • Music/Media Player.
  • +
  • File Organiser.
  • +
  • Game Engine.
  • +
  • After this the list is vast, and increasingly specialised. Emacs is a long way +from being just a text editor.
  • +
  • This is why I wouldn't tell people to avoid Vim. You wouldn't use a mobile +home to go to a supermarket to do your weekly shop if you had a normal car.
  • + +
+
+
+
+
+

How would it be useful to you now?

+
    +
  • TeX.
  • +
  • A document formatting language, the first in fact, and by far the best. If +only because it has been improved for so many years, because it is free +software (not open source).
  • +
  • TeX, was originally created because Donald Knuth, writer of the hardest books +in computer science, The Art of Computer Science, disliked the document +formatting options available for his first book, so he wrote his own instead.
  • + +
+
+
+
+
+

LaTeX and Academia

+
    +
  • Tex proved so popular it was widely adopted in the academic world and became +LaTeX in the 1980's.
  • +
  • Almost all scientific documents are written in LaTeX now, those that aren't +are written in MsWord.
  • +
  • LaTeX separates content from formatting, unlike MS Word, which requires that +you put formatting in as you write. LaTeX inserts on document final +compilation.
  • + +
+
+
+
+
+

Org Mode - 1

+
    +
  • LaTeX is great, and using it directly has plenty of advantages. Plus there are +lots of ways to do that. Sites like Sharelatex, tool like TexMaker all make +using LaTex fairly painless, but Emacs, through org mode, makes it as simple +as writing a plain text file, with a few simple formatting indicators.
  • + +
+
+ +
** slide title or section title, (depending on export type)
+-- bullet point
+*bolded text*
+/italicized text/
+
+
+
    +
  • Where emacs has the edge is in the potential export targets for documents +created in org mode (which is essentially plain text with a few special +characters and format instructions), there are quite a +few.
  • + +
+
+
+
+
+

+
    +
  • Org mode was originally just meant for people to organise their work in emacs, +which is where the name came from, but it has long since stopped being just +that. There are now hundreds if not thousands of emacs and org-mode plugins +and modifications. We have our own custom emacs/org-mode setup on Nostromo +that we have released as an open source project.
  • + +
+
+
+
+
+

Document generation Time Compilation

+
    +
  • Using Babel and Org Mode emacs will execute code you've written while +compiling your document and insert the results into whatever format you +specify.
  • +
  • This could be an image, a graph (asymptote or gnuplot), or any one of a large +number of supported languages.
  • +
  • Word won't do this. Other LaTeX using editors can, but not as simply. For example:
  • + +
+ +
+

demo2.png +

+
+ +
+
+
+
+

+
    +
  • Without the babel instruction block, here's the code Org-mode executed to +generate the image.
  • + +
+
+ +
import graph;                                                                                                                                                                                             
+import settings;                                                                                                                                                                                          
+defaultpen(2);                                                                                                                                                                                            
+outformat="png";                                                                                                                                                                                          
+draw((0,50)--(50,0),white);   
+0)--(50,0),white);                                                                                                                                                                               
+draw((0,50)--(25,0),white);                                                                                                                                                                               
+draw((0,50)--(0,0),white);                                                                                                                                                                                
+draw((0,50)--(-50,0),white);                                                                                                                                                                              
+draw((0,50)--(-25,0),white);                                                                                                  
+
+
+
+
+
+
+

Alternatives

+
    +
  • There are alternatives, such as Pandoc, which can export from plain +text to many of the same export targets, or Markdown, of which +Pandoc is an advanced version.
  • +
  • Both of these are even simpler than *org Mode to use, as you don't need to +learn Emacs first.
  • +
  • Org mode has more support and capabilities, but the relative complexity of +Emacs, while it makes it useful, causes it to be viewed as less desirable by +some, in spite of it being less complex than most modern Integrated +Development Environments.
  • +
  • When used with libraries such as Org-Reveal, as it is now for these slides, it +produces results faster than many other methods once you understand it.
  • +
  • All materials for this module have been created using Emacs.
  • + +
+
+
+
+
+

Vi (Vim)

+
    +
  • Much lighter text editor.
  • +
  • Still, if you're smart, primarily controlled by keypress combinations.
  • +
  • GUI's are available (Gvim and others, but they slow you down).
  • +
  • Better suited to use over an ssh, or other network connection.
  • +
  • Has full syntax highlighting.
  • +
  • Some scripting support.
  • +
  • Extensible though plugins.
  • + +
+
+
+
+
+

Vim-Pandoc

+
    +
  • You can, with a little setup, use Pandoc with Vim via Vim-Pandoc. It doesn't +seem as yet to be supplied as standard with any Linux distributions, although +this may change.
  • +
  • Advantages +
      +
    • Live Preview
    • +
    • Easy Bibliography creation
    • + +
  • +
  • Disadvantages +
      +
    • Lacks the comprehensive featureset and plugin support of Org-Mode (which you might not use).
    • + +
  • + +
+
+
+
+
+ + + + + + diff --git a/lectures/emacs.org b/lectures/emacs.org new file mode 100644 index 0000000..9cf522a --- /dev/null +++ b/lectures/emacs.org @@ -0,0 +1,180 @@ +# -*- mode: org -*- +#+TITLE: 389COM: Emacs and Vi +#+AUTHOR: Dr Carey Pridgeon, Dr Nazaraf Shah +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:1 num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +# Licenced under Creative Commons Attribution-ShareAlike 4.0 +# International by Dr Carey Pridgeon 2019 + +* What is Emacs? +** The basics +- *Emacs* is not just a text editor, just like *Vim* is not just a text editor. +- However, *Emacs* goes /much/ further than *Vim* into /not just a text editor/ + territory. +- We lack time to list everything Emacs can do, suffice to say you could have + completed your entire degree using no other tool but emacs. +- Or rather, using it as a frontend to access other tools you need. +** Why don't we do this? +- Emacs has, for some things, a near vertical learning curve if you're not + already needing the things you're trying to do. This makes teaching to our + first year students something we have been reluctant to do. +- However in other universities they do /exactly/ this. It is after all, free. +- The Worksheet you have in this Module began its life as a tutorial for first + year students at Exeter University, although it has become a little more + complex since then. Not much though, I've even removed some elements. +- Emacs is a wonderful and complex tool, but it has evolved free from commercial + constraints that say things like /user interaction must be easy + from the start/. +** Why Use it? +- Using Emacs isn't hard once you know what you're doing, but it takes a while + to learn, and you need a reason to make that effort when easier, albeit far + less capable tools exist. +- Your main reason to learn it should be that if you intend to be software + developers, you should be using what is essentially the top item in the + developers toolkit. +- By this I do not mean /don't use Vim/. +- I do mean /Don't use nano/, but you should never use nano, just /never/. +** What can Emacs do +- Code editing (duh...). + - This is probably the thing I use emacs for the least nowadays, though it is + extraordinarily good at it. +- Document Production. + - Emacs contains functionality greater than any commercial word processor, but + not so easy to access. +- CLI. + - You can get a terminal within Emacs in a different buffer and use that to + compile your code while you are writing it. +- You can write code in a document, and Emacs will compile this code, then put + its output in your document. Populating tables, producing charts, whatever you + want. +** +- Other things are useful if you are more interested in relying heavily on + emacs. +- Web Browsing. +- Email Client (a few staff here use emacs for this). +- Music/Media Player. +- File Organiser. +- Game Engine. +- After this the list is vast, and increasingly specialised. Emacs is a long way + from being /just a text editor/. +- This is why I wouldn't tell people to avoid Vim. You wouldn't use a mobile + home to go to a supermarket to do your weekly shop if you had a normal car. +** How would it be useful to you now? +- [[https://www.latex-project.org/][TeX]]. +- A document formatting language, the first in fact, and by far the best. If + only because it has been improved for so many years, because it is free + software (not open source). +- TeX, was originally created because Donald Knuth, writer of the hardest books + in computer science, The Art of Computer Science, disliked the document + formatting options available for his first book, so he wrote his own instead. +** LaTeX and Academia +- Tex proved so popular it was widely adopted in the academic world and became + *LaTeX* in the 1980's. +- Almost all scientific documents are written in LaTeX now, those that aren't + are written in MsWord. +- LaTeX separates content from formatting, unlike MS Word, which requires that + you put formatting in as you write. LaTeX inserts on document final + compilation. +** Org Mode +- LaTeX is great, and using it directly has plenty of advantages. Plus there are + lots of ways to do that. Sites like [[https://www.sharelatex.com/][Sharelatex]], tool like [[http://www.xm1math.net/texmaker/][TexMaker]] all make + using LaTex fairly painless, but Emacs, through org mode, makes it as simple + as writing a plain text file, with a few simple formatting indicators. +#+begin_src bash + ** slide title or section title, (depending on export type) + -- bullet point + *bolded text* + /italicized text/ +#+end_src +- Where emacs has the edge is in the potential export targets for documents + created in *org mode* (which is essentially plain text with a few special + characters and format instructions), there are quite a + few. +** +- Org mode was originally just meant for people to organise their work in emacs, + which is where the name came from, but it has long since stopped being just + that. There are now hundreds if not thousands of emacs and org-mode plugins + and modifications. We have our own custom emacs/org-mode setup on Nostromo + that we have released as an open source project. +** Document generation Time Compilation +- Using Babel and Org Mode emacs will execute code you've written while + compiling your document and insert the results into whatever format you + specify. +- This could be an image, a graph (asymptote or gnuplot), or any one of a large + number of supported languages. +- Word won't do this. Other LaTeX using editors can, but not as simply. For example: +#+begin_src asymptote :file img/demo2.png +import graph; +import settings; +defaultpen(2); +outformat="png"; +draw((0,50)--(50,0),white); +draw((0,50)--(25,0),white); +draw((0,50)--(0,0),white); +draw((0,50)--(-50,0),white); +draw((0,50)--(-25,0),white); +#+end_src +** +- Without the babel instruction block, here's the code *Org-mode* executed to + generate the image. +#+begin_src bash +import graph; +import settings; +defaultpen(2); +outformat="png"; +draw((0,50)--(50,0),white); +0)--(50,0),white); +draw((0,50)--(25,0),white); +draw((0,50)--(0,0),white); +draw((0,50)--(-50,0),white); +draw((0,50)--(-25,0),white); +#+end_src +** Alternatives +- There are alternatives, such as *Pandoc*, which can export from plain + text to many of the same export targets, or *Markdown*, of which + Pandoc is an advanced version. +- Both of these are even simpler than *org Mode to use, as you don't need to + learn Emacs first. +- Org mode has more support and capabilities, but the relative complexity of + Emacs, while it makes it useful, causes it to be viewed as less desirable by + some, in spite of it being less complex than most modern Integrated + Development Environments. +- When used with libraries such as Org-Reveal, as it is now for these slides, it + produces results faster than many other methods once you understand it. +- All materials for this module have been created using Emacs. +** Vi (Vim) +- Much lighter text editor. +- Still, if you're smart, primarily controlled by keypress combinations. +- GUI's are available (Gvim and others, but they slow you down). +- Better suited to use over an ssh, or other network connection. +- Has full syntax highlighting. +- Some scripting support. +- Extensible though plugins. +** Vim-Pandoc +- You can, with a little setup, use Pandoc with Vim via [[https://github.com/vim-pandoc/vim-pandoc][Vim-Pandoc]]. It doesn't + seem as yet to be supplied as standard with any Linux distributions, although + this may change. +- *Advantages* + - Live Preview + - Easy Bibliography creation +- *Disadvantages* + - Lacks the comprehensive featureset and plugin support of Org-Mode (which you might not use). + + + + + + + diff --git a/lectures/emacs.org~ b/lectures/emacs.org~ new file mode 100644 index 0000000..7f85bbf --- /dev/null +++ b/lectures/emacs.org~ @@ -0,0 +1,180 @@ +# -*- mode: org -*- +#+TITLE: 389COM: Emacs and Vi +#+AUTHOR: Dr Carey Pridgeon, Dr Nazaraf Shah +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:1 num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +# Licenced under Creative Commons Attribution-ShareAlike 4.0 +# International by Dr Carey Pridgeon 2019 + +* What is Emacs? +** The basics +- *Emacs* is not just a text editor, just like *Vim* is not just a text editor. +- However, *Emacs* goes /much/ further than *Vim* into /not just a text editor/ + territory. +- We lack time to list everything Emacs can do, suffice to say you could have + completed your entire degree using no other tool but emacs. +- Or rather, using it as a frontend to access other tools you need. +** Why don't we do this? +- Emacs has, for some things, a near vertical learning curve if you're not + already needing the things you're trying to do. This makes teaching to our + first year students something we have been reluctant to do. +- However in other universities they do /exactly/ this. It is after all, free. +- The Worksheet you have in this Module began its life as a tutorial for first + year students at Exeter University, although it has become a little more + complex since then. Not much though, I've even removed some elements. +- Emacs is a wonderful and complex tool, but it has evolved free from commercial + constraints that say things like /user interaction must be easy + from the start/. +** Why Use it? +- Using Emacs isn't hard once you know what you're doing, but it takes a while + to learn, and you need a reason to make that effort when easier, albeit far + less capable tools exist. +- Your main reason to learn it should be that if you intend to be software + developers, you should be using what is essentially the top item in the + developers toolkit. +- By this I do not mean /don't use Vim/. +- I do mean /Don't use nano/, but you should never use nano, just /never/. +** What can Emacs do +- Code editing (duh...). + - This is probably the thing I use emacs for the least nowadays, though it is + extraordinarily good at it. +- Document Production. + - Emacs contains functionality greater than any commercial word processor, but + not so easy to access. +- CLI. + - You can get a terminal within Emacs in a different buffer and use that to + compile your code while you are writing it. +- You can write code in a document, and Emacs will compile this code, then put + its output in your document. Populating tables, producing charts, whatever you + want. +** +- Other things are useful if you are more interested in relying heavily on + emacs. +- Web Browsing. +- Email Client (a few staff here use emacs for this). +- Music/Media Player. +- File Organiser. +- Game Engine. +- After this the list is vast, and increasingly specialised. Emacs is a long way + from being /just a text editor/. +- This is why I wouldn't tell people to avoid Vim. You wouldn't use a mobile + home to go to a supermarket to do your weekly shop if you had a normal car. +** How would it be useful to you now? +- [[https://www.latex-project.org/][TeX]]. +- A document formatting language, the first in fact, and by far the best. If + only because it has been improved for so many years, because it is free + software (not open source). +- TeX, was originally created because Donald Knuth, writer of the hardest books + in computer science, The Art of Computer Science, disliked the document + formatting options available for his first book, so he wrote his own instead. +** LaTeX and Academia +- Tex proved so popular it was widely adopted in the academic world and became + *LaTeX* in the 1980's. +- Almost all scientific documents are written in LaTeX now, those that aren't + are written in MsWord. +- LaTeX separates content from formatting, unlike MS Word, which requires that + you put formatting in as you write. LaTeX inserts on document final + compilation. +** Org Mode - 1 +- LaTeX is great, and using it directly has plenty of advantages. Plus there are + lots of ways to do that. Sites like [[https://www.sharelatex.com/][Sharelatex]], tool like [[http://www.xm1math.net/texmaker/][TexMaker]] all make + using LaTex fairly painless, but Emacs, through org mode, makes it as simple + as writing a plain text file, with a few simple formatting indicators. +#+begin_src bash + ** slide title or section title, (depending on export type) + -- bullet point + *bolded text* + /italicized text/ +#+end_src +- Where emacs has the edge is in the potential export targets for documents + created in *org mode* (which is essentially plain text with a few special + characters and format instructions), there are quite a + few. +** +- Org mode was originally just meant for people to organise their work in emacs, + which is where the name came from, but it has long since stopped being just + that. There are now hundreds if not thousands of emacs and org-mode plugins + and modifications. We have our own custom emacs/org-mode setup on Nostromo + that we have released as an open source project. +** Document generation Time Compilation +- Using Babel and Org Mode emacs will execute code you've written while + compiling your document and insert the results into whatever format you + specify. +- This could be an image, a graph (asymptote or gnuplot), or any one of a large + number of supported languages. +- Word won't do this. Other LaTeX using editors can, but not as simply. For example: +#+begin_src asymptote :file img/demo2.png +import graph; +import settings; +defaultpen(2); +outformat="png"; +draw((0,50)--(50,0),white); +draw((0,50)--(25,0),white); +draw((0,50)--(0,0),white); +draw((0,50)--(-50,0),white); +draw((0,50)--(-25,0),white); +#+end_src +** +- Without the babel instruction block, here's the code *Org-mode* executed to + generate the image. +#+begin_src bash +import graph; +import settings; +defaultpen(2); +outformat="png"; +draw((0,50)--(50,0),white); +0)--(50,0),white); +draw((0,50)--(25,0),white); +draw((0,50)--(0,0),white); +draw((0,50)--(-50,0),white); +draw((0,50)--(-25,0),white); +#+end_src +** Alternatives +- There are alternatives, such as *Pandoc*, which can export from plain + text to many of the same export targets, or *Markdown*, of which + Pandoc is an advanced version. +- Both of these are even simpler than *org Mode to use, as you don't need to + learn Emacs first. +- Org mode has more support and capabilities, but the relative complexity of + Emacs, while it makes it useful, causes it to be viewed as less desirable by + some, in spite of it being less complex than most modern Integrated + Development Environments. +- When used with libraries such as Org-Reveal, as it is now for these slides, it + produces results faster than many other methods once you understand it. +- All materials for this module have been created using Emacs. +** Vi (Vim) +- Much lighter text editor. +- Still, if you're smart, primarily controlled by keypress combinations. +- GUI's are available (Gvim and others, but they slow you down). +- Better suited to use over an ssh, or other network connection. +- Has full syntax highlighting. +- Some scripting support. +- Extensible though plugins. +** Vim-Pandoc +- You can, with a little setup, use Pandoc with Vim via [[https://github.com/vim-pandoc/vim-pandoc][Vim-Pandoc]]. It doesn't + seem as yet to be supplied as standard with any Linux distributions, although + this may change. +- *Advantages* + - Live Preview + - Easy Bibliography creation +- *Disadvantages* + - Lacks the comprehensive featureset and plugin support of Org-Mode (which you might not use). + + + + + + + diff --git a/lectures/games.html b/lectures/games.html new file mode 100644 index 0000000..b7589e6 --- /dev/null +++ b/lectures/games.html @@ -0,0 +1,567 @@ + + + + +389COM: Games and Open Source + + + + + + + + + + + + +
+
+

389COM: Games and Open Source

Dr Carey Pridgeon, DR Nazaraf Shah

Created: 2019-09-03 Tue 13:02

+
+
+
+

Table of Contents

+
+ +
+
+
+
+
+

Games

+
+
+
+
+
+
+

State of the onion

+
    +
  • Tthere are currently 1,048,980 projects on Github locatable with the search tag +'game' (in 2017 there were 503,637, in 2016 there were 354,421).
  • +
  • This indicaticates open source developers enjoy writing games, and this number +is increasing each year.
  • +
  • There are still no major AAA quality revenue generating Open Source games to +compete with the likes of EA or Blizzard
  • +
  • We will try to examine why this is the case by looking at the history of +computer games development.
  • + +
+
+
+
+
+

Potted history of Games development

+
    +
  • During the 1980's and early nineties, the emergence of home computers meant +that thousands of people could develop games themselves.
  • +
  • Many fortunes were made, and many iconic games series were born. Most people, +like myself, just used game programming as a way to learn how to code that +resulted in something more interesting than text rolling up the screen.
  • +
  • The perception that being a programmer means being wealthy stems from this +era, although even then it was only rarely true. Most games produced, even +during this supposed golden age, were absolute garbage.
  • +
  • The idea that the source code for these games could be revealed, or given away +had simply not occurred to any commercial games developers at this time.
  • + +
+
+
+
+
+

Open Source and Games

+
    +
  • Version one of Nethack was released by Mike Stephenson on July 28, 1987. a +Rogue-like Dungeon crawler that is extremely hard, and still under active +development.
  • +
  • This was never a commercial game, so it likely never occurred to Mike that he +shouldn't share the code.
  • + +
+
+
+
+
+

pic

+ +
+

nethack.png +

+
+
+
+
+
+

+
    +
  • Free software was in its infancy, but lots of people shared code routinely, +just not in an organised way.
  • +
  • This behaviour was common, with all sorts of code and not everyone +approved. It led to the now legendary Open Letter to Hobbyists from Bill Gates +in 1976.
  • +
  • This itself is somewhat ironic, since there is some doubt whether Microsoft +stole from Apple in the early days on their company's development of an +Operating System with a Graphical User Interface.
  • +
  • The timing and similarity of design certainly is suspicious.
  • + +
+ +
+
+
+
+

+
    +
  • Nethack has been very influential in the three decades it has existed. I've +tried several times to get good at it, but I'm just not.
  • +
  • It has also always been free, with contributors gaining reputation and +employment based on the quality of their work, not making money from Nethack +itself.
  • +
  • No commercial game has enjoyed such longevity, or attained a comparable level +of code quality.
  • +
  • Nor has any Open Source game, although classes of them have.
  • + +
+
+
+
+
+

+
    +
  • Id software have released the source code for all their games once they have +moved on. Source code only, but not the resources.
  • +
  • Attempts have been made to duplicate commercial games using all new code. +sometimes these have been stamped on hard.
  • +
  • Diablo is an example of a game that has recently been recreated completely as +an Open Source Project. Unlike other occasions in the past which I will +discuss shortly, Blizzard don't mind this, as to use the recreation, you need +either to own, or buy the full game.
  • +
  • Basically, it earns them money and they don't have to do any work. The new +version works on a Nintendo Switch.
  • + +
+
+
+
+
+

+
    +
  • Simcity has been the inspiration for several open source games (linCity, OpenCity).
  • +
  • Freecraft, a Warcraft 2 clone was killed by Blizzard in June 2003 for +trademark infringement.
  • +
  • Blizzard also killed an attempt at an alternative Open Source Battlenet +service called bnetd by threatening to sue anyone involved.
  • +
  • This would have impacted their revenue stream at the time, whereas the Open +Source rebuild mention above enhances it.
  • + +
+
+
+
+
+

Cast off games

+
    +
  • Some software houses have released entire formally commercial games as open +source.
  • +
  • Laudable, because it does give new games developers an opportunity to legally +view commercial game developers code, but the reality is that these are games +that have run their commercial course and retain no opportunity for someone to +make a living from them.
  • +
  • In fact, if anyone did manage to find a way to make money, it's likely the +copyright holders would step in and demand a major cut anyway.
  • + +
+
+
+
+
+

Clones

+
    +
  • Some very old games, some which made their millions in the eighties have been +cloned (duplicated in their entirety). Manic Miner, Chuckie Egg, Space +Invaders, Missile Command. Familiar names to me, positively archeological to +most of you.
  • +
  • However the problem remains that while these old games remain entertaining +when given a makeover, they're not going to make anyone a living now.
  • + +
+
+
+
+
+

+
    +
  • Recreating classic games is a good way to cut your game development teeth, +since people know what to expect, and can therefore appreciate a good +rendition.
  • +
  • There is NO SUCH THING as Abandonware. If you sell your version of an old +game and it makes money, be aware of this. Someone, might come calling, asking +for compensation.
  • + +
+
+
+
+
+

Examining the problem

+
    +
  • So why hasn't anyone managed to create a commercially viable Open Source game? +At least not one capable of competing with the big number games.
  • +
  • People have managed to use open source tools to make closed source games, so +the tools exist for a totally free project, the limitation is not software based.
  • +
  • The traditional games industry often views attempts at interoperability with their +products as promoting piracy.
  • + +
+
+
+
+
+

+
    +
  • Current AAA games cost multiple millions and several years to develop.
  • +
  • Minecraft, a program initially written by one man, became a worldwide +sensation, and was bought by Microsoft for Billions.
  • +
  • The idea that succesful games must inevitably cost millions to develop is +clearly flawed.
  • +
  • Mobile games are now dominating the games industry, and AAA developers don't +seem to be near mastering that.
  • + +
+
+
+
+
+

The Traditional games industry

+
    +
  • Warning, vast oversimplifications follow.
  • +
  • Since it's emergence in the 1970's, the traditional games industry has grown +more complex and centralised.
  • +
  • The AAA industry has gained, through acquisition, most of the most popular +franchises.
  • +
  • As each iteration of mainstream games appears, changes have been less +significant, and innovation/risk taking has been less appealing to them.
  • + +
+
+
+
+
+

+
    +
  • Gameplay innovation has been replaced by graphical ones, and even that is +beginning to stagnate.
  • +
  • The prime example of this is in FPS and Sports games. Year on Year they change +less and less.
  • +
  • When they first appeared each release brought revelations in gameplay.
  • + +
+
+
+
+
+

+
    +
  • Microtransactions and in game stores have been borrowed from mobile +and web based games and put in games that previously had, and needed +none, to further increase revenue.
  • +
  • They have not thus far seen Open Source as a valid avenue, since any such +game, if true Open Source, would easily slip from their control if +mis-managed.
  • + +
+
+
+
+
+

The Console Market

+
    +
  • As it stands today, the Console market is not available to Open Source games.
  • +
  • Console games also tend to be the primary focus of releases, with PC releases +being ports. This may be changing, I don't buy any new games that were on a +console first, they tend to suck.
  • +
  • Hardware is not the issue, at present Console manufacturers are actively +hostile to the Open Source world. This is possibly due to a lack of perceived +revenue stream.
  • + +
+
+
+
+
+

Platforms

+
    +
  • With the emergence of platforms, not a new thing Steam has been around for +years, but Stadia is taking it to a new level, and there's the Apple platform.
  • +
  • Open Source might find itself locked out of gaming in the future, unless +someone finds a way in. There probably will be one, but it will need to be one +with a profit motive.
  • + +
+
+
+
+
+

Mods - History

+
    +
  • Mods for commercial games have existed since Id software actively promoted +community contributions to their FPS game Doom in the nineties.
  • +
  • Not at first however, initially they were against it. John Romero +seems to have been the driving force in changing their minds.
  • + +
+
+
+
+
+

+
    +
  • Mods have led to careers in gaming they may still, but it seems the field is a +bit crowded.
  • +
  • Id sought to hire many early community developers, and there are examples of +mods becoming full games. (Counterstrike, Desert Combat, Team Fortress).
  • +
  • Steve Polge created an AI mod for Quake Reaper Bot in 1997 that essentially +began the rise of AI NPCs in games that we see everywhere today.
  • +
  • Mods were however predominantly 'free' products that enhanced non +free products.
  • + +
+
+
+
+
+

Reaper Bot

+ +
+

reaper_bot.png +

+
+
+
+
+
+

+
    +
  • There have been, probably still are attempts to monetize modding, but these +seem to be mostly aimed at producing a new revenue stream for AAA games companies, +so not really relevant.
  • +
  • In general I would say todays games market modding should be avoided +in favour of working on your own unique IP.
  • + +
+
+
+
+
+

Kickstarter

+
    +
  • Lots of games, have been funded through Kickstarter.
  • +
  • Kickstarter game projects reward contributors with, among other things, early +game access, a say in game development, and extra features, either exclusive, +or just earlier than non contributors.
  • +
  • How would this work if all the code, and game assets, were free to anyone all the way along?
  • +
  • The advantage of a succesful Kickstarter campaign would be an initial cash lump sum.
  • +
  • It seems to me that Kickstarter favours the closed source model.
  • + +
+
+
+
+
+

Patreon

+
    +
  • Contributors to Patreon projects generally expect to be funding something +which has reguler output.
  • +
  • I initially encountered it on Youtube, though I have since learned that many +freelance creators have successfully used it.
  • +
  • There would be no initial cash lump sum.
  • +
  • Patreon Does seem to favour a more open model, since no-one gets exclusive +content, but they do often get a say in subjects covered.
  • + +
+
+
+
+
+

Game Funding alternatives

+
    +
  • One Time Purchase.
  • +
  • Since an open source game couldn't use DRM (even if that did work), the piracy +endemic in the One Time Purchase model world would kill any potential revenue +stream.
  • + +
+
+
+
+
+

+
    +
  • Episodic purchase (expansions/DLC).
  • +
  • This model shares the same weakness as the One Time Purchase model.
  • +
  • It's probably not relevant, because the DLC could just be released as a new +main game build.
  • +
  • Subscription.
  • +
  • Usually associated with a persistant online world, so not universally +relevant.
  • +
  • Would definitely require seed funding, since subscriptions couldn't start +till the game reached initial release.
  • + +
+
+
+
+
+

+
    +
  • Sponsorship
  • +
  • Usually in the game development world this involves a loss of creative +control.
  • +
  • However it is the most used method of Open Source funding, and in this area, +loss of creative control is not common.
  • +
  • A game using this approach would sell itself to sponsors as a 'value adding +service'.
  • +
  • Email, web browsers and social networking have been used in this regard.
  • +
  • But there would always be conditions.
  • + +
+
+
+
+
+

Should you target Windows?

+
    +
  • Short answer, probably not at first.
  • +
  • Windows has been the dominant operating system for 20+ years.
  • +
  • DirectX was a genius move, and cemented Windows as the best place +for companies to develop games for most of that time.
  • +
  • This was a deliberate move by Microsoft, their dominance of the gaming world +was no happy accident, it was a deliberate and expensive push into the field.
  • + +
+
+
+
+
+

Why Not Linux

+
    +
  • Structurally, there is no significant reason Linux could not run +games as well as Windows.
  • +
  • Linux was not initially focussed on gaming. It still has not +focussed well in this area.
  • +
  • Market share is king, It wasn't worth developing AAA games for Linux first.
  • + +
+
+
+
+
+

+
    +
  • Graphics cards manufacturers have not concentrated on optimising +their products for Linux performance, so Linux falls even further behind.
  • +
  • Unless something really significant occurs, this problem isn't likely to go +away.
  • + +
+
+
+
+
+

Shifting Tides

+
    +
  • The Operating system landscape is changing, Mobile OS have taken +off.
  • +
  • Now there's the Switch.I've read lots of articles declaring it dead on +arrival, and yet I keep seeing people buying and using it. My son uses his a +lot.
  • +
  • Means of exchanging payment for gaming products that consumers are +willing to accept are changing too.
  • + +
+ +
+
+
+
+

Obligatory XKCD

+ +
+

ultimate_game.png +

+
+
    +
  • Copyright: Randall Munroe - XKCD
  • +
  • Mirrored in my hosting to avoid bandwidth stealing
  • + +
+
+
+
+
+

Licence for this work

+
    +
  • Licenced under Creative Commons Attribution-ShareAlike 4.0 +International by Dr Carey Pridgeon 2016
  • +
  • (Licence does not cover linked images owned by other content creators)
  • + +
+
+
+
+
+ + + + + + diff --git a/lectures/games.org b/lectures/games.org new file mode 100644 index 0000000..641531f --- /dev/null +++ b/lectures/games.org @@ -0,0 +1,259 @@ +# -*- mode: org -*- +#+TITLE: 389COM: Games and Open Source +#+AUTHOR: Dr Carey Pridgeon, DR Nazaraf Shah +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:1 num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +# Licenced under Creative Commons Attribution-ShareAlike 4.0 +# International by Dr Carey Pridgeon 2019 + +* Games +** State of the onion +- Tthere are currently 1,048,980 projects on Github locatable with the search tag + 'game' (in 2017 there were 503,637, in 2016 there were 354,421). +- This indicaticates open source developers enjoy writing games, and this number + is increasing each year. +- There are still no major AAA quality revenue generating Open Source games to + compete with the likes of EA or Blizzard +- We will try to examine why this is the case by looking at the history of + computer games development. +** Potted history of Games development +- During the 1980's and early nineties, the emergence of home computers meant + that thousands of people could develop games themselves. +- Many fortunes were made, and many iconic games series were born. Most people, + like myself, just used game programming as a way to learn how to code that + resulted in something more interesting than text rolling up the screen. +- The perception that being a programmer means being wealthy stems from this + era, although even then it was only rarely true. Most games produced, even + during this supposed golden age, were absolute garbage. +- The idea that the source code for these games could be revealed, or given away + had simply not occurred to any commercial games developers at this time. +** Open Source and Games +- Version one of Nethack was released by Mike Stephenson on July 28, 1987. a + Rogue-like Dungeon crawler that is extremely hard, and still under active + development. +- This was never a commercial game, so it likely never occurred to Mike that he + /shouldn't/ share the code. +** pic +[[file:img/nethack.png]] +** +- Free software was in its infancy, but lots of people shared code routinely, + just not in an organised way. +- This behaviour was common, with all sorts of code and not everyone + approved. It led to the now legendary [[https://en.wikipedia.org/wiki/Open_Letter_to_Hobbyists][Open Letter to Hobbyists]] from Bill Gates + in 1976. +- This itself is somewhat ironic, since there is some doubt whether Microsoft + stole from Apple in the early days on their company's development of an + Operating System with a Graphical User Interface. +- The timing and similarity of design certainly is suspicious. + +** +- Nethack has been very influential in the three decades it has existed. I've + tried several times to get good at it, but I'm just not. +- It has also always been free, with contributors gaining reputation and + employment based on the quality of their work, not making money from Nethack + itself. +- No commercial game has enjoyed such longevity, or attained a comparable level + of code quality. +- Nor has any Open Source game, although classes of them have. +** +- Id software have released the source code for all their games once they have + moved on. Source code only, but not the resources. +- Attempts have been made to duplicate commercial games using all new code. + sometimes these have been stamped on hard. +- Diablo is an example of a game that has recently been recreated completely as + an Open Source Project. Unlike other occasions in the past which I will + discuss shortly, Blizzard don't mind this, as to use the recreation, you need + either to own, or buy the full game. +- Basically, it earns them money and they don't have to do any work. The new + version works on a Nintendo Switch. +** +- Simcity has been the inspiration for several open source games (linCity, OpenCity). +- Freecraft, a Warcraft 2 clone was killed by Blizzard in June 2003 for + trademark infringement. +- Blizzard also killed an attempt at an alternative Open Source Battlenet + service called bnetd by threatening to sue anyone involved. +- This /would/ have impacted their revenue stream at the time, whereas the Open + Source rebuild mention above enhances it. +** Cast off games +- Some software houses have released entire formally commercial games as open + source. +- Laudable, because it does give new games developers an opportunity to legally + view commercial game developers code, but the reality is that these are games + that have run their commercial course and retain no opportunity for someone to + make a living from them. +- In fact, if anyone did manage to find a way to make money, it's likely the + copyright holders would step in and demand a major cut anyway. +** Clones +- Some very old games, some which made their millions in the eighties have been + cloned (duplicated in their entirety). Manic Miner, Chuckie Egg, Space + Invaders, Missile Command. Familiar names to me, positively archeological to + most of you. +- However the problem remains that while these old games remain entertaining + when given a makeover, they're not going to make anyone a living now. +** +- Recreating classic games is a good way to cut your game development teeth, + since people know what to expect, and can therefore appreciate a good + rendition. +- There is *NO SUCH THING* as Abandonware. If you sell your version of an old + game and it makes money, be aware of this. Someone, might come calling, asking + for compensation. +** Examining the problem +- So why hasn't anyone managed to create a commercially viable Open Source game? + At least not one capable of competing with the big number games. +- People have managed to use open source tools to make closed source games, so + the tools exist for a totally free project, the limitation is not software based. +- The traditional games industry often views attempts at interoperability with their + products as promoting piracy. +** +- Current AAA games cost multiple millions and several years to develop. +- Minecraft, a program initially written by one man, became a worldwide + sensation, and was bought by Microsoft for Billions. +- The idea that succesful games must inevitably cost millions to develop is + clearly flawed. +- Mobile games are now dominating the games industry, and AAA developers don't + seem to be near mastering that. +** The Traditional games industry +- Warning, vast oversimplifications follow. +- Since it's emergence in the 1970's, the traditional games industry has grown + more complex and centralised. +- The AAA industry has gained, through acquisition, most of the most popular + franchises. +- As each iteration of mainstream games appears, changes have been less + significant, and innovation/risk taking has been less appealing to them. +** +- Gameplay innovation has been replaced by graphical ones, and even that is + beginning to stagnate. +- The prime example of this is in FPS and Sports games. Year on Year they change + less and less. +- When they first appeared each release brought revelations in gameplay. +** +- Microtransactions and in game stores have been borrowed from mobile + and web based games and put in games that previously had, and needed + none, to further increase revenue. +- They have not thus far seen Open Source as a valid avenue, since any such + game, if true Open Source, would easily slip from their control if + mis-managed. +** The Console Market +- As it stands today, the Console market is not available to Open Source games. +- Console games also tend to be the primary focus of releases, with PC releases + being ports. This may be changing, I don't buy any new games that were on a + console first, they tend to suck. +- Hardware is not the issue, at present Console manufacturers are actively + hostile to the Open Source world. This is possibly due to a lack of perceived + revenue stream. +** Platforms +- With the emergence of platforms, not a new thing Steam has been around for + years, but Stadia is taking it to a new level, and there's the Apple platform. +- Open Source might find itself locked out of gaming in the future, unless + someone finds a way in. There probably will be one, but it will need to be one + with a profit motive. +** Mods - History +- Mods for commercial games have existed since Id software actively promoted + community contributions to their FPS game Doom in the nineties. +- Not at first however, initially they were against it. [[https://en.wikipedia.org/wiki/John_Romero][John Romero]] + seems to have been the driving force in changing their minds. +** +- Mods have led to careers in gaming they may still, but it seems the field is a + bit crowded. +- Id sought to hire many early community developers, and there are examples of + mods becoming full games. (Counterstrike, Desert Combat, Team Fortress). +- [[https://en.wikipedia.org/wiki/Steve_Polge][Steve Polge]] created an AI mod for Quake [[http://easttown.co.uk/quake/reaper.html][Reaper Bot]] in 1997 that essentially + began the rise of AI NPCs in games that we see everywhere today. +- Mods were however predominantly 'free' products that enhanced non + free products. +** Reaper Bot +[[file:img/reaper_bot.png]] +** +- There have been, probably still are attempts to monetize modding, but these + seem to be mostly aimed at producing a new revenue stream for AAA games companies, + so not really relevant. +- In general I would say todays games market modding should be avoided + in favour of working on your own unique IP. +** Kickstarter +- Lots of games, have been funded through Kickstarter. +- Kickstarter game projects reward contributors with, among other things, early + game access, a say in game development, and extra features, either exclusive, + or just earlier than non contributors. +- How would this work if all the code, and game assets, were free to anyone all the way along? +- The advantage of a succesful Kickstarter campaign would be an initial cash lump sum. +- It seems to me that Kickstarter favours the closed source model. +** Patreon +- Contributors to Patreon projects generally expect to be funding something + which has reguler output. +- I initially encountered it on Youtube, though I have since learned that many + freelance creators have successfully used it. +- There would be no initial cash lump sum. +- Patreon Does seem to favour a more open model, since no-one gets exclusive + content, but they do often get a say in subjects covered. +** Game Funding alternatives +- One Time Purchase. +- Since an open source game couldn't use DRM (even if that did work), the piracy + endemic in the One Time Purchase model world would kill any potential revenue + stream. +** +- Episodic purchase (expansions/DLC). +- This model shares the same weakness as the One Time Purchase model. +- It's probably not relevant, because the DLC could just be released as a new + main game build. +- Subscription. +- Usually associated with a persistant online world, so not universally + relevant. +- Would definitely require seed funding, since subscriptions couldn't start + till the game reached initial release. +** +- Sponsorship +- Usually in the game development world this involves a loss of creative + control. +- However it is the most used method of Open Source funding, and in this area, + loss of creative control is /not/ common. +- A game using this approach would sell itself to sponsors as a 'value adding + service'. +- Email, web browsers and social networking have been used in this regard. +- But there would always be conditions. +** Should you target Windows? +- Short answer, probably not at first. +- Windows has been the dominant operating system for 20+ years. +- DirectX was a genius move, and cemented Windows as the best place + for companies to develop games for most of that time. +- This was a deliberate move by Microsoft, their dominance of the gaming world + was no happy accident, it was a deliberate and expensive push into the field. +** Why Not Linux +- Structurally, there is no significant reason Linux could not run + games as well as Windows. +- Linux was not initially focussed on gaming. It still has not + focussed well in this area. +- Market share is king, It wasn't worth developing AAA games for Linux first. +** +- Graphics cards manufacturers have not concentrated on optimising + their products for Linux performance, so Linux falls even further behind. +- Unless something really significant occurs, this problem isn't likely to go + away. +** Shifting Tides +- The Operating system landscape is changing, Mobile OS have taken + off. +- Now there's the Switch.I've read lots of articles declaring it dead on + arrival, and yet I keep seeing people buying and using it. My son uses his a + lot. +- Means of exchanging payment for gaming products that consumers are + willing to accept are changing too. + +** Obligatory XKCD +[[file:img/ultimate_game.png]] +- Copyright: Randall Munroe - XKCD +- Mirrored in my hosting to avoid bandwidth stealing +** Licence for this work +- Licenced under Creative Commons Attribution-ShareAlike 4.0 + International by Dr Carey Pridgeon 2016 +- (Licence does not cover linked images owned by other content creators) diff --git a/lectures/games2.html b/lectures/games2.html new file mode 100644 index 0000000..111d094 --- /dev/null +++ b/lectures/games2.html @@ -0,0 +1,867 @@ + + + + +389COM: Games and Open Source + + + + + + + + + + + + +
+
+

389COM: Games and Open Source

Dr Carey Pridgeon, DR Nazaraf Shah

Created: 2019-08-20 Tue 13:34

+
+
+
+

Table of Contents

+
+ +
+
+
+
+
+

Games

+
+
+
+
+
+
+

State of the onion

+
    +
  • In 2017 there were 1,001,073 projects on Github locatable with the search tag +'game' (in 2017 there were 503,637, in 2016 there were 354,421).
  • +
  • In spite of this clear indication that increasing numbers of open source +developers enjoy writing games, there are still no major AAA quality revenue +generating Open Source games to compete with the likes of EA or Blizzard
  • +
  • We will try to examine why this is the case by looking at the history of +computer games development.
  • + +
+
+
+
+
+

Potted history of Games development

+
    +
  • During the 1980's and early nineties, the emergence of home computers meant +that thousands of people could develop games themselves.
  • +
  • Many fortunes were made, and many iconic games series were born. Most people, +like myself, just used game programming as a way to learn how to code that +resulted in something more interesting than text rolling up the screen.
  • +
  • The perception that being a programmer means being wealthy stems from this +era, although even then it was only rarely true. Most games produced, even +during this supposed golden age, were absolute garbage.
  • +
  • The idea that the source code for these games could be revealed, or given away +had simply not occurred to any commercial games developers at this time.
  • + +
+
+
+
+
+

Open Source and Games - 1

+
    +
  • Version one of Nethack was released by Mike Stephenson on July 28, 1987. a +Rogue-like Dungeon crawler that is extremely hard, and still under active +development.
  • +
  • This was never a commercial game, so it likely never occurred to Mike that he +shouldn't share the code.
  • + +
+
+
+
+
+

pic

+ +
+

nethack.png +

+
+
+
+
+
+

+
    +
  • Free software was in its infancy, but lots of people shared code routinely, +just not in an organised way.
  • +
  • This behaviour was common, with all sorts of code and not everyone +approved. It led to the now legendary Open Letter to Hobbyists from Bill Gates +in 1976.
  • +
  • This itself is somewhat ironic, since there is some doubt whether Microsoft +stole from Apple in the early days on their company's development of an +Operating System with a Graphical User Interface.
  • +
  • The timing and similarity of design certainly is suspicious.
  • + +
+ +
+
+
+
+

Open Source and Games - 2

+
    +
  • Nethack has been very influential in the three decades it has existed. I've +tried several times to get good at it, but I'm just not.
  • +
  • It has also always been free, with contributors gaining reputation and +employment based on the quality of their work, not making money from Nethack +itself.
  • +
  • No commercial game has enjoyed such longevity, or attained a comparable level +of code quality.
  • +
  • Nor has any Open Source game, although classes of them have.
  • + +
+
+
+
+
+

Open Source and Games - 3

+
    +
  • Id software have released the source code for all their games once they have +moved on. Source code only, but not the resources.
  • +
  • Attempts have been made to duplicate commercial games using all new code. +sometimes these have been stamped on hard.
  • +
  • Diablo is an example of a game that has recently been recreated completely as +an Open Source Project. Unlike other occasions in the past which I will +discuss shortly, Blizzard don't mind this, as to use the recreation, you need +either to own, or buy the full game.
  • +
  • Basically, it earns them money and they don't have to do any work. The new +version works on a Nintendo Switch.
  • + +
+
+
+
+
+

- Open Source and Games - 4

+
    +
  • Simcity has been the inspiration for several open source games (linCity, OpenCity).
  • +
  • Freecraft, a Warcraft 2 clone was killed by Blizzard in June 2003 for +trademark infringement.
  • +
  • Blizzard also killed an attempt at an alternative Open Source Battlenet +service called bnetd by threatening to sue anyone involved.
  • +
  • This would have impacted their revenue stream at the time, whereas the Open +Source rebuild mention above enhances it.
  • + +
+
+
+
+
+

Cast off games

+
    +
  • Some software houses have released entire formally commercial games as open +source.
  • +
  • Laudable, because it does give new games developers an opportunity to legally +view commercial game developers code, but the reality is that these are games +that have run their commercial course and retain no opportunity for someone to +make a living from them.
  • +
  • In fact, if anyone did manage to find a way to make money, it's likely the +copyright holders would step in and demand a major cut anyway.
  • + +
+
+
+
+
+

Clones

+
    +
  • Some very old games, some which made their millions in the eighties have been +cloned (duplicated in their entirety). Manic Miner, Chuckie Egg, Space +Invaders, Missile Command.
  • +
  • However the problem remains that while entertaining, these are not going to +make anyone a living now.
  • +
  • Recreating classic games is a good way to cut your game development teeth, +since people know what to expect, and can therefore appreciate a good +rendition.
  • +
  • It's important that the games be old enough to not be currently on sale, nor +should you sell them, since old games are almost always still owned by +someone.
  • +
  • There is NO SUCH THING as Abandonware.
  • + +
+
+
+
+
+

Examining the problem

+
    +
  • So why has no-one ever managed to create a commercially viable Open Source game?
  • +
  • People have managed to use open source tools to make closed source games, so +the tools exist for a totally free project, the limitation is not software based.
  • +
  • The traditional games industry often views attempts at interoperability with their +products as promoting piracy.
  • + +
+
+
+
+
+

+
    +
  • Current AAA games cost multiple millions and several years to develop.
  • +
  • Minecraft, a program initially written by one man, became a worldwide +sensation, and was bought by Microsoft for Billions.
  • +
  • The idea that succesful games must inevitably cost millions to develop is +clearly flawed.
  • +
  • Mobile games are now dominating the games industry, and AAA developers don't +seem to be near mastering that.
  • + +
+
+
+
+
+

The Traditional games industry

+
    +
  • Warning, vast oversimplifications follow.
  • +
  • Since it's emergence in the 1970's, the traditional games industry has grown +more complex and centralised.
  • +
  • The AAA industry has gained, through acquisition, most of the most popular +franchises.
  • +
  • As each iteration of mainstream games appears, changes have been less +significant, and innovation/risk taking has been less appealing to them.
  • +
  • Gameplay innovation has been replaced by graphical ones, and even that is +beginning to stagnate.
  • +
  • The prime example of this is in FPS and Sports games. Year on Year they change +less and less.
  • +
  • When they first appeared each release brought revelations in gameplay.
  • + +
+
+
+
+
+

+
    +
  • Microtransactions and in game stores have been borrowed from mobile +and web based games and put in games that previously had, and needed +none, to further increase revenue.
  • +
  • They have not thus far seen Open Source as a valid avenue, since any such +game, if true Open Source, would easily slip from their control if +mis-managed.
  • + +
+
+
+
+
+

The Console Market

+
    +
  • As it stands today, the Console market is not available to Open Source games.
  • +
  • Console games also tend to be the primary focus of releases, with PC releases +being ports. This may be changing, I don't buy any new games that were on a +console first, they tend to suck.
  • +
  • Hardware is not the issue, at present Console manufacturers are actively +hostile to the Open Source world. This is possibly due to a lack of perceived +revenue stream.
  • + +
+
+
+
+
+

Mods - History

+
    +
  • Mods for commercial games have existed since Id software actively promoted +community contributions to their FPS game Doom in the nineties.
  • +
  • Not at first however, initially they were against it. John Romero +seems to have been the driving force in changing their minds.
  • + +
+

+** +

+
    +
  • Mods have led to careers in gaming they may still, but it seems the field is a +bit crowded.
  • +
  • Id sought to hire many early community developers, and there are examples of +mods becoming full games. (Counterstrike, Desert Combat, Team Fortress).
  • +
  • Steve Polge created an AI mod for Quake Reaper Bot in 1997 that essentially +began the rise of AI NPCs in games that we see everywhere today.
  • +
  • Mods were however predominantly 'free' products that enhanced non +free products.
  • + +
+

+** +

+
    +
  • There have been, probably still are attempts to monetize modding, but these +seem to be mostly aimed at producing a new revenue stream for AAA games companies, +so not really relevant.
  • +
  • In general I would say todays games market modding should be avoided +in favour of working on your own unique IP.
  • + +
+
+
+
+
+

Kickstarter

+
    +
  • Lots of games, have been funded through Kickstarter.
  • +
  • Kickstarter game projects reward contributors with, among other things, early +game access, a say in game development, and extra features, either exclusive, +or just earlier than non contributors.
  • +
  • How would this work if all the code, and game assets, were free to anyone all the way along?
  • +
  • The advantage of a succesful Kickstarter campaign would be an initial cash lump sum.
  • +
  • It seems to me that Kickstarter favours the closed source model.
  • + +
+
+
+
+
+

Patreon

+
    +
  • Contributers to Patreon projects generally expect to be funding something +which has reguler output.
  • +
  • I initially encountered it on Youtube, though I have since learned that many +freelance creators have successfully used it.
  • +
  • There would be no initial cash lump sum.
  • +
  • Patreon Does seem to favour a more open model, since no-one gets exclusive +content, but they do often get a say in subjects covered.
  • + +
+
+
+
+
+

Game Funding alternatives

+
    +
  • One Time Purchase.
  • +
  • Since an open source game couldn't use DRM (even if that did work), the piracy +endemic in the One Time Purchase model world would kill any potential revenue +stream.
  • + +
+
+
+
+
+

+
    +
  • Episodic purchase (expansions/DLC).
  • +
  • This model shares the same weakness as the One Time Purchase model.
  • +
  • It's probably not relevant, because the DLC could just be released as a new +main game build.
  • +
  • Subscription.
  • +
  • Usually associated with a persistant online world, so not universally +relevant.
  • +
  • Would definitely require seed funding, since subscriptions couldn't start +till the game reached initial release.
  • + +
+
+
+
+
+

+
    +
  • Sponsorship
  • +
  • Usually in the game development world this involves a loss of creative +control.
  • +
  • However it is the most used method of Open Source funding, and in this area, +loss of creative control is not common.
  • +
  • A game using this approach would sell itself to sponsors as a 'value adding +service'.
  • +
  • Email, web browsers and social networking have been used in this regard.
  • +
  • But there would always be conditions.
  • + +
+
+
+
+
+

Should you target Windows?

+
    +
  • Short answer, probably not at first.
  • +
  • Windows has been the dominant operating system for 20+ years.
  • +
  • DirectX was a genius move, and cemented Windows as the best place +for companies to develop games for most of that time.
  • +
  • This was a deliberate move by Microsoft, their dominance of the gaming world +was no happy accident, it was a deliberate and expensive push into the field.
  • + +
+
+
+
+
+

Why Not Linux

+
    +
  • Structurally, there is no significant reason Linux could not run +games as well as Windows.
  • +
  • Linux was not initially focussed on gaming. It still has not +focussed well in this area.
  • +
  • Market share is king, It wasn't worth developing AAA games for Linux first.
  • + +
+
+
+
+
+

+
    +
  • Graphics cards manufacturers have not concentrated on optimising +their products for Linux performance, so Linux falls even further behind.
  • +
  • Unless something really significant occurs, this problem isn't likely to go +away.
  • + +
+
+
+
+
+

Shifting Tides

+
    +
  • The Operating system landscape is changing, Mobile OS have taken +off.
  • +
  • Now there's the Switch.I've read lots of articles declaring it dead on +arrival, and yet I keep seeing people buying and using it.
  • +
  • Means of exchanging payment for gaming products that consumers are +willing to accept are changing too.
  • + +
+
+
+
+
+

Writing - 1

+
    +
  • We're going to depart from software for a little bit here, but it is +necessary.
  • +
  • Publishing is a market which has undergone and survived many technological +changes.
  • +
  • Magazines were initially threatened by the web, but now many have embraced it.
  • +
  • The end of the printed word (the paperless office) has been much spoken of, +yet print co-exists with digital works, and this will likely continue.
  • + +
+
+
+
+
+

Writing - 2

+
    +
  • The following (except for the statistics) is based around the short video +presentation by Piers Blofeld of Sheil Land Associates titled Seven reasons +why you shouldn't self publish youtube link
  • +
  • Chosen because I see many parallels between a potential market for sale of +Open Source games and self publishing of literature. It definitely needs to +be watched.
  • + +
+
+
+
+
+

Writing - 3

+
    +
  • Nearly 460,000 titles were self-published globally in 2013 source.
  • +
  • In 2012, half of the self published authors made less than $500 source.
  • +
  • Many reasons for their failing probably relate well to the Open Source world.
  • +
  • Ebooks are popular, and sell really well, as this graphic shows, but the +market is so saturated the per author earnings remain far too low.
  • + +
+
+
+
+
+

pic

+

+Image Credit +unit-sales-trend-20160110.png +

+
+
+
+
+

Writing - 4

+
    +
  • Most self published books fail, just as most Open Source Projects (98%) fail, +and for many of the same reasons.
  • +
  • Product Quality - With the primary and critical difference that a +book released with an ISBN number cannot be updated after release
  • +
  • Lack of testing - Too many self publishing writers don't get other people to +read their work, or don't listen to feedback.
  • + +
+
+
+
+
+

Writing - 5

+
    +
  • The literature marketing process (as any marketing process) is complicated, so +any time you spend trying to prepare your book for the market place will take +time away from improving your product.
  • +
  • There is frustration with the 'traditional' publishing world, because it is +hard to get into, so some people resent its gatekeeping role.
  • +
  • Amazon particularly have made it easy for writers to get their work published +electronically, so it is increasingly fashionable to do this.
  • + +
+
+
+
+
+

Writing - 6

+
    +
  • The self publishing market lacks oversight. You can go from writing to +published in a few days. This make the use of the term 'publication' a little +vague. It seems to me little more than a technological gloss on photocopying +your book.
  • +
  • This in effect means you can put your work into a global slush pile without +any checks and hope it might stand out.
  • + +
+
+
+
+
+

Writing - 7

+
    +
  • Sometimes your work just isn't good enough, or just not yet. So you can damage +any potential reputation you might gain by self publishing a sub par book.
  • +
  • Having an experienced Agent tell you your book isn't good enough may +not be nice, but it may still be needed.
  • + +
+
+
+
+
+

Relating this to software - 1

+
    +
  • This also why Open Source can work so well, you are open to constructive +advice on your product.
  • +
  • Sometimes getting an email telling you that one of your functions +isn't working. can help. If they tell you it's rubbish and suggest +a fix, that can be awesome, say thanks, start a dialog.
  • + +
+
+
+
+
+

Relating this to software - 2

+
    +
  • You need to be open to this sort of thing if you want to be a success in the +Open Source world, Similarly, if you find that you have something to say about +someone else's product, tell them, but do it nicely, in a useful +way.
  • +
  • The kind of thinking Self publishers are tending towards now harmed the Free +Software Foundation in its early days, eventually bringing the Open Source +movement into existence out of pure necessity.
  • + +
+
+
+
+
+

Relating this to software - 3

+
    +
  • This is where self publishing, as it is now is most similar to the early days +of Free Software development, unstructured, open to abuse and full of +misinformation.
  • +
  • The problems faced by content producers are identical in both fields in all +respects other than we are trying to sell a product that is 'Free' in a closed +source dominated market.
  • + +
+
+
+
+
+

Farmers Markets - 1

+
    +
  • On the face of it, nothing like software engineering.
  • +
  • Farmers markets provide an avenue for artisans or small farmers to: +
      +
    • Sell products direct to consumers.
    • +
    • Gain future direct customers through direct repeat purchases.
    • +
    • Meet other small producers.
    • + +
  • +
  • The key point here is that it is an opportunity for communities to develop, +and for products to evolve as a result of those communities.
  • + +
+
+
+
+
+

Farmers Markets - 2

+
    +
  • The Artisan food market is taking off again, people are becoming less satisfied +with shelves full of identical, low quality products that use the names +formally associated with higher quality.
  • +
  • Stichelton Dairy is a prime example of meeting this need. Most Stilton is made +counter to the original recipe, making the Stilton name no longer really +applicable, but it has been adopted to refer to the new recipes, so they can, +and do, control it.
  • + +
+
+
+
+
+

Farmers Markets - 3

+
    +
  • Stichleton is actually real Stilton, but due to Joe Schneider's use of raw +milk he can't call it Stilton. That Trademark is now too strictly controlled +by large commercial interests who have legally defined what can be called +Stilton now, and it doesn't include raw milk any more, even though originally +it did.
  • +
  • Joe is in fact similer to an open source developer, since there was no +recipe for him to work from, so he had to recreate the original Stilton recipe +by experimentation.
  • + +
+
+
+
+
+

Farmers Markets - 4

+
    +
  • Artisan food makers have many of the same issues as Open Source +Developers. They are competing in a niche market, often against overwhelming +commercial competition. They also need to group together to be effective.
  • +
  • The main difference currently is that Open Source is not usually sold, +although this document and its companion lecture/discussion lecture is about +how to change that.
  • + +
+
+
+
+
+

Access to products - 1

+
    +
  • Traditional games have plenty of sales avenues to choose from, such as Steam, +GOG.com, or Mobile/OS App and Console Stores, Amazon and in normal shops.
  • +
  • At present Open Source games are released in the same way as most other types +of Open Source software.
  • + +
+
+
+
+
+

Access to products - 2

+
    +
  • This means there is no easy way to promote them as things to exchange money +for.
  • +
  • You could of course put an open source product for sale on your own site, but +without community to address criticism or consumer concerns, success would be +hard.
  • + +
+
+
+
+
+

Changing software landscape - 1

+
    +
  • In the last decade the hardware side of computer science has changed +fundamentally.
  • +
  • Mobile Computing
  • +
  • Better Internet availability.
  • +
  • IOT is a thing now.
  • + +
+
+
+
+
+

Changing software landscape - 2

+
    +
  • Games have started to change, with smaller devs having great access to the +mobile market.
  • +
  • The closed source model still dominates the commercial games landscape, in +spite of the increasing importance of Open Source in other software markets.
  • +
  • Smaller devs/modellers/designers increasingly find that there is a direct way +to make money from their work independant of big industry.
  • +
  • Can Open Source solve all these problems? Almost certainly not.
  • + +
+
+
+
+
+

How could it be done? - 1

+
    +
  • Initially, no open source game could have millions for development.
  • +
  • If you can't afford to pay someone up front, then they would need a financial +reward from the outcome of their work.
  • +
  • This is analogous to Startups with no seed capital.
  • + +
+
+
+
+
+

How could it be done? - 2

+
    +
  • If it were to be a job, people would need a source of income from somewhere.
  • +
  • Games are complex, a place to initially meet and plan would be required. Many +globally distributed Open Source organisations exist, we are working with two +of them, so that can be managed.
  • + +
+
+
+
+
+

How could it be done? - 3

+
    +
  • The fantasy of Startups with lots of money in a fancy building would need to +be dropped.
  • +
  • Small teams of hackers with minimal budgets, working from home or from office +cafe's to a common goal would need to replace it (in fact this is how Apple +started, only without the office cafe part as far as I know).
  • +
  • Eric Raymond was the spokesperson for Open Source, promoting it. Open Source +Games would need their equivalent, or many such people.
  • + +
+
+
+
+
+

The main issues

+
    +
  • The gaming public perception of Open Source games as games that are always +free of financial cost for the end user would need to change.
  • +
  • Piracy at least would be an irrelevance, piracy as it now exists cannot occur +with Open Source.
  • +
  • New models for game delivery, and the concept of games as product would need +to be re-evaluated.
  • + +
+
+
+
+
+

Online Platform - 1

+
    +
  • A platform with a public front for browsing of products, such as the one +provided by Steam could help.
  • +
  • But people would want some element of ownership in the project too.
  • + +
+
+
+
+
+

Online Platform - 2

+
    +
  • What features might an online presence for commercial Open Source Development +need? These are my thoughts. +
      +
    • Project Forums, instantiating a form of social network.
    • +
    • A donation based contribution system for interested parties (for non complete +games).
    • +
    • Project Hosting (probably in partnership with someone like Gitlab or Github).
    • +
    • Firm community oversight by volunteers.
    • +
    • a formal payment scheme for completed games suited to the medium.
    • + +
  • + +
+
+
+
+
+

Obligatory XKCD

+ +
+

ultimate_game.png +

+
+
    +
  • Copyright: Randall Munroe - XKCD
  • +
  • Mirrored in my hosting to avoid bandwidth stealing
  • + +
+
+
+
+
+

Licence for this work

+
    +
  • Licenced under Creative Commons Attribution-ShareAlike 4.0 +International by Dr Carey Pridgeon 2016
  • +
  • (Licence does not cover linked images owned by other content creators)
  • + +
+
+
+
+
+ + + + + + diff --git a/lectures/games2.org b/lectures/games2.org new file mode 100644 index 0000000..141858b --- /dev/null +++ b/lectures/games2.org @@ -0,0 +1,412 @@ +# -*- mode: org -*- +#+TITLE: 389COM: Games and Open Source +#+AUTHOR: Dr Carey Pridgeon, DR Nazaraf Shah +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:1 num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +# Licenced under Creative Commons Attribution-ShareAlike 4.0 +# International by Dr Carey Pridgeon 2019 + +* Games +** State of the onion +- In 2017 there were 1,001,073 projects on Github locatable with the search tag + 'game' (in 2017 there were 503,637, in 2016 there were 354,421). +- In spite of this clear indication that increasing numbers of open source + developers enjoy writing games, there are still no major AAA quality revenue + generating Open Source games to compete with the likes of EA or Blizzard +- We will try to examine why this is the case by looking at the history of + computer games development. +** Potted history of Games development +- During the 1980's and early nineties, the emergence of home computers meant + that thousands of people could develop games themselves. +- Many fortunes were made, and many iconic games series were born. Most people, + like myself, just used game programming as a way to learn how to code that + resulted in something more interesting than text rolling up the screen. +- The perception that being a programmer means being wealthy stems from this + era, although even then it was only rarely true. Most games produced, even + during this supposed golden age, were absolute garbage. +- The idea that the source code for these games could be revealed, or given away + had simply not occurred to any commercial games developers at this time. +** Open Source and Games - 1 +- Version one of Nethack was released by Mike Stephenson on July 28, 1987. a + Rogue-like Dungeon crawler that is extremely hard, and still under active + development. +- This was never a commercial game, so it likely never occurred to Mike that he + /shouldn't/ share the code. +** pic +[[file:img/nethack.png]] +** +- Free software was in its infancy, but lots of people shared code routinely, + just not in an organised way. +- This behaviour was common, with all sorts of code and not everyone + approved. It led to the now legendary [[https://en.wikipedia.org/wiki/Open_Letter_to_Hobbyists][Open Letter to Hobbyists]] from Bill Gates + in 1976. +- This itself is somewhat ironic, since there is some doubt whether Microsoft + stole from Apple in the early days on their company's development of an + Operating System with a Graphical User Interface. +- The timing and similarity of design certainly is suspicious. + +** Open Source and Games - 2 +- Nethack has been very influential in the three decades it has existed. I've + tried several times to get good at it, but I'm just not. +- It has also always been free, with contributors gaining reputation and + employment based on the quality of their work, not making money from Nethack + itself. +- No commercial game has enjoyed such longevity, or attained a comparable level + of code quality. +- Nor has any Open Source game, although classes of them have. +** Open Source and Games - 3 +- Id software have released the source code for all their games once they have + moved on. Source code only, but not the resources. +- Attempts have been made to duplicate commercial games using all new code. + sometimes these have been stamped on hard. +- Diablo is an example of a game that has recently been recreated completely as + an Open Source Project. Unlike other occasions in the past which I will + discuss shortly, Blizzard don't mind this, as to use the recreation, you need + either to own, or buy the full game. +- Basically, it earns them money and they don't have to do any work. The new + version works on a Nintendo Switch. +** - Open Source and Games - 4 +- Simcity has been the inspiration for several open source games (linCity, OpenCity). +- Freecraft, a Warcraft 2 clone was killed by Blizzard in June 2003 for + trademark infringement. +- Blizzard also killed an attempt at an alternative Open Source Battlenet + service called bnetd by threatening to sue anyone involved. +- This /would/ have impacted their revenue stream at the time, whereas the Open + Source rebuild mention above enhances it. +** Cast off games +- Some software houses have released entire formally commercial games as open + source. +- Laudable, because it does give new games developers an opportunity to legally + view commercial game developers code, but the reality is that these are games + that have run their commercial course and retain no opportunity for someone to + make a living from them. +- In fact, if anyone did manage to find a way to make money, it's likely the + copyright holders would step in and demand a major cut anyway. +** Clones +- Some very old games, some which made their millions in the eighties have been + cloned (duplicated in their entirety). Manic Miner, Chuckie Egg, Space + Invaders, Missile Command. +- However the problem remains that while entertaining, these are not going to + make anyone a living now. +- Recreating classic games is a good way to cut your game development teeth, + since people know what to expect, and can therefore appreciate a good + rendition. +- It's important that the games be old enough to not be currently on sale, nor + should you sell them, since old games are almost always still owned by + someone. +- There is *NO SUCH THING* as Abandonware. +** Examining the problem +- So why has no-one ever managed to create a commercially viable Open Source game? +- People have managed to use open source tools to make closed source games, so + the tools exist for a totally free project, the limitation is not software based. +- The traditional games industry often views attempts at interoperability with their + products as promoting piracy. +** +- Current AAA games cost multiple millions and several years to develop. +- Minecraft, a program initially written by one man, became a worldwide + sensation, and was bought by Microsoft for Billions. +- The idea that succesful games must inevitably cost millions to develop is + clearly flawed. +- Mobile games are now dominating the games industry, and AAA developers don't + seem to be near mastering that. +** The Traditional games industry +- Warning, vast oversimplifications follow. +- Since it's emergence in the 1970's, the traditional games industry has grown + more complex and centralised. +- The AAA industry has gained, through acquisition, most of the most popular + franchises. +- As each iteration of mainstream games appears, changes have been less + significant, and innovation/risk taking has been less appealing to them. +- Gameplay innovation has been replaced by graphical ones, and even that is + beginning to stagnate. +- The prime example of this is in FPS and Sports games. Year on Year they change + less and less. +- When they first appeared each release brought revelations in gameplay. +** +- Microtransactions and in game stores have been borrowed from mobile + and web based games and put in games that previously had, and needed + none, to further increase revenue. +- They have not thus far seen Open Source as a valid avenue, since any such + game, if true Open Source, would easily slip from their control if + mis-managed. +** The Console Market +- As it stands today, the Console market is not available to Open Source games. +- Console games also tend to be the primary focus of releases, with PC releases + being ports. This may be changing, I don't buy any new games that were on a + console first, they tend to suck. +- Hardware is not the issue, at present Console manufacturers are actively + hostile to the Open Source world. This is possibly due to a lack of perceived + revenue stream. +** Mods - History +- Mods for commercial games have existed since Id software actively promoted + community contributions to their FPS game Doom in the nineties. +- Not at first however, initially they were against it. [[https://en.wikipedia.org/wiki/John_Romero][John Romero]] + seems to have been the driving force in changing their minds. +** +- Mods have led to careers in gaming they may still, but it seems the field is a + bit crowded. +- Id sought to hire many early community developers, and there are examples of + mods becoming full games. (Counterstrike, Desert Combat, Team Fortress). +- [[https://en.wikipedia.org/wiki/Steve_Polge][Steve Polge]] created an AI mod for Quake [[http://easttown.co.uk/quake/reaper.html][Reaper Bot]] in 1997 that essentially + began the rise of AI NPCs in games that we see everywhere today. +- Mods were however predominantly 'free' products that enhanced non + free products. +** +- There have been, probably still are attempts to monetize modding, but these + seem to be mostly aimed at producing a new revenue stream for AAA games companies, + so not really relevant. +- In general I would say todays games market modding should be avoided + in favour of working on your own unique IP. +** Kickstarter +- Lots of games, have been funded through Kickstarter. +- Kickstarter game projects reward contributors with, among other things, early + game access, a say in game development, and extra features, either exclusive, + or just earlier than non contributors. +- How would this work if all the code, and game assets, were free to anyone all the way along? +- The advantage of a succesful Kickstarter campaign would be an initial cash lump sum. +- It seems to me that Kickstarter favours the closed source model. +** Patreon +- Contributers to Patreon projects generally expect to be funding something + which has reguler output. +- I initially encountered it on Youtube, though I have since learned that many + freelance creators have successfully used it. +- There would be no initial cash lump sum. +- Patreon Does seem to favour a more open model, since no-one gets exclusive + content, but they do often get a say in subjects covered. +** Game Funding alternatives +- One Time Purchase. +- Since an open source game couldn't use DRM (even if that did work), the piracy + endemic in the One Time Purchase model world would kill any potential revenue + stream. +** +- Episodic purchase (expansions/DLC). +- This model shares the same weakness as the One Time Purchase model. +- It's probably not relevant, because the DLC could just be released as a new + main game build. +- Subscription. +- Usually associated with a persistant online world, so not universally + relevant. +- Would definitely require seed funding, since subscriptions couldn't start + till the game reached initial release. +** +- Sponsorship +- Usually in the game development world this involves a loss of creative + control. +- However it is the most used method of Open Source funding, and in this area, + loss of creative control is /not/ common. +- A game using this approach would sell itself to sponsors as a 'value adding + service'. +- Email, web browsers and social networking have been used in this regard. +- But there would always be conditions. +** Should you target Windows? +- Short answer, probably not at first. +- Windows has been the dominant operating system for 20+ years. +- DirectX was a genius move, and cemented Windows as the best place + for companies to develop games for most of that time. +- This was a deliberate move by Microsoft, their dominance of the gaming world + was no happy accident, it was a deliberate and expensive push into the field. +** Why Not Linux +- Structurally, there is no significant reason Linux could not run + games as well as Windows. +- Linux was not initially focussed on gaming. It still has not + focussed well in this area. +- Market share is king, It wasn't worth developing AAA games for Linux first. +** +- Graphics cards manufacturers have not concentrated on optimising + their products for Linux performance, so Linux falls even further behind. +- Unless something really significant occurs, this problem isn't likely to go + away. +** Shifting Tides +- The Operating system landscape is changing, Mobile OS have taken + off. +- Now there's the Switch.I've read lots of articles declaring it dead on + arrival, and yet I keep seeing people buying and using it. +- Means of exchanging payment for gaming products that consumers are + willing to accept are changing too. +** Writing - 1 +- We're going to depart from software for a little bit here, but it is + necessary. +- Publishing is a market which has undergone and survived many technological + changes. +- Magazines were initially threatened by the web, but now many have embraced it. +- The end of the printed word (the paperless office) has been much spoken of, + yet print co-exists with digital works, and this will likely continue. +** Writing - 2 +- The following (except for the statistics) is based around the short video + presentation by Piers Blofeld of Sheil Land Associates titled *Seven reasons + why you shouldn't self publish* [[https://www.youtube.com/watch?v=BGXEpMIfUZ4][youtube link]] +- Chosen because I see many parallels between a potential market for sale of + Open Source games and self publishing of literature. It definitely needs to + be watched. +** Writing - 3 +- Nearly 460,000 titles were self-published globally in 2013 [[http://www.ft.com/cms/s/0/da1b382e-c8ea-1q1e4-bc64-00144feab7de.html][source]]. +- In 2012, half of the self published authors made less than $500 [[https://www.theguardian.com/books/2012/may/24/self-published-author-earnings][source]]. +- Many reasons for their failing probably relate well to the Open Source world. +- Ebooks are popular, and sell really well, as this graphic shows, but the + market is so saturated the per author earnings remain far too low. +** pic +[[http://authorearnings.com/report/february-2016-author-earnings-report/][Image Credit]] +[[file:img/unit-sales-trend-20160110.png]] +** Writing - 4 +- Most self published books fail, just as most Open Source Projects (98%) fail, + and for many of the same reasons. +- Product Quality - With the primary and critical difference that a + book released with an ISBN number cannot be updated after release +- Lack of testing - Too many self publishing writers don't get other people to + read their work, or don't listen to feedback. +** Writing - 5 +- The literature marketing process (as any marketing process) is complicated, so + any time you spend trying to prepare your book for the market place will take + time away from improving your product. +- There is frustration with the 'traditional' publishing world, because it is + hard to get into, so some people resent its gatekeeping role. +- Amazon particularly have made it easy for writers to get their work published + electronically, so it is increasingly fashionable to do this. +** Writing - 6 +- The self publishing market lacks oversight. You can go from writing to + published in a few days. This make the use of the term 'publication' a little + vague. It seems to me little more than a technological gloss on photocopying + your book. +- This in effect means you can put your work into a global slush pile without + any checks and hope it might stand out. +** Writing - 7 +- Sometimes your work /just isn't good enough/, or just /not yet/. So you can damage + any potential reputation you might gain by self publishing a sub par book. +- Having an experienced Agent tell you your book isn't good enough may + not be nice, but it may still be needed. +** Relating this to software - 1 +- This also why Open Source can work so well, you are open to constructive + advice on your product. +- Sometimes getting an email telling you that one of your functions + isn't working. can help. If they tell you it's rubbish and suggest + a fix, that can be awesome, say thanks, start a dialog. +** Relating this to software - 2 +- You need to be open to this sort of thing if you want to be a success in the + Open Source world, Similarly, if you find that you have something to say about + someone else's product, tell them, but do it nicely, in a useful + way. +- The kind of thinking Self publishers are tending towards now harmed the Free + Software Foundation in its early days, eventually bringing the Open Source + movement into existence out of pure necessity. +** Relating this to software - 3 +- This is where self publishing, as it is now is most similar to the early days + of Free Software development, unstructured, open to abuse and full of + misinformation. +- The problems faced by content producers are identical in both fields in all + respects other than we are trying to sell a product that is 'Free' in a closed + source dominated market. +** Farmers Markets - 1 +- On the face of it, nothing like software engineering. +- Farmers markets provide an avenue for artisans or small farmers to: + - Sell products direct to consumers. + - Gain future direct customers through direct repeat purchases. + - Meet other small producers. +- The key point here is that it is an opportunity for communities to develop, + and for products to evolve as a result of those communities. +** Farmers Markets - 2 +- The Artisan food market is taking off again, people are becoming less satisfied + with shelves full of identical, low quality products that use the names + formally associated with higher quality. +- [[http://www.stichelton.co.uk/][Stichelton Dairy]] is a prime example of meeting this need. Most Stilton is made + counter to the original recipe, making the Stilton name no longer really + applicable, but it has been adopted to refer to the new recipes, so they can, + and do, control it. +** Farmers Markets - 3 +- Stichleton is actually /real/ Stilton, but due to Joe Schneider's use of raw + milk he can't call it Stilton. That Trademark is now too strictly controlled + by large commercial interests who have legally defined what can be called + Stilton now, and it doesn't include raw milk any more, even though originally + it did. +- Joe is in fact similer to an open source developer, since there was no + recipe for him to work from, so he had to recreate the original Stilton recipe + by experimentation. +** Farmers Markets - 4 +- Artisan food makers have many of the same issues as Open Source + Developers. They are competing in a niche market, often against overwhelming + commercial competition. They also need to group together to be effective. +- The main difference currently is that Open Source is not usually sold, + although this document and its companion lecture/discussion lecture is about + how to change that. +** Access to products - 1 +- Traditional games have plenty of sales avenues to choose from, such as Steam, + GOG.com, or Mobile/OS App and Console Stores, Amazon and in normal shops. +- At present Open Source games are released in the same way as most other types + of Open Source software. +** Access to products - 2 +- This means there is no easy way to promote them as things to exchange money + for. +- You could of course put an open source product for sale on your own site, but + without community to address criticism or consumer concerns, success would be + hard. +** Changing software landscape - 1 +- In the last decade the hardware side of computer science has changed + fundamentally. +- Mobile Computing +- Better Internet availability. +- IOT is a thing now. +** Changing software landscape - 2 +- Games have started to change, with smaller devs having great access to the + mobile market. +- The closed source model still dominates the commercial games landscape, in + spite of the increasing importance of Open Source in other software markets. +- Smaller devs/modellers/designers increasingly find that there is a direct way + to make money from their work independant of big industry. +- Can Open Source solve all these problems? Almost certainly not. +** How could it be done? - 1 +- Initially, no open source game could have millions for development. +- If you can't afford to pay someone up front, then they would need a financial + reward from the outcome of their work. +- This is analogous to Startups with no seed capital. +** How could it be done? - 2 +- If it were to be a job, people would need a source of income from somewhere. +- Games are complex, a place to initially meet and plan would be required. Many + globally distributed Open Source organisations exist, we are working with two + of them, so that can be managed. +** How could it be done? - 3 +- The fantasy of Startups with lots of money in a fancy building would need to + be dropped. +- Small teams of hackers with minimal budgets, working from home or from office + cafe's to a common goal would need to replace it (in fact this is how Apple + started, only without the office cafe part as far as I know). +- Eric Raymond was the spokesperson for Open Source, promoting it. Open Source + Games would need their equivalent, or many such people. +** The main issues +- The gaming public perception of Open Source games as games that are always + free of financial cost for the end user would need to change. +- Piracy at least would be an irrelevance, piracy as it now exists cannot occur + with Open Source. +- New models for game delivery, and the concept of games as product would need + to be re-evaluated. +** Online Platform - 1 +- A platform with a public front for browsing of products, such as the one + provided by Steam could help. +- But people would want some element of ownership in the project too. +** Online Platform - 2 +- What features might an online presence for commercial Open Source Development + need? These are my thoughts. + - Project Forums, instantiating a form of social network. + - A donation based contribution system for interested parties (for non complete + games). + - Project Hosting (probably in partnership with someone like Gitlab or Github). + - Firm community oversight by volunteers. + - a formal payment scheme for completed games suited to the medium. +** Obligatory XKCD +[[file:img/ultimate_game.png]] +- Copyright: Randall Munroe - XKCD +- Mirrored in my hosting to avoid bandwidth stealing +** Licence for this work +- Licenced under Creative Commons Attribution-ShareAlike 4.0 + International by Dr Carey Pridgeon 2016 +- (Licence does not cover linked images owned by other content creators) diff --git a/lectures/img/.DS_Store b/lectures/img/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/lectures/img/.DS_Store differ diff --git a/lectures/img/branch.png b/lectures/img/branch.png new file mode 100644 index 0000000..f151052 Binary files /dev/null and b/lectures/img/branch.png differ diff --git a/lectures/img/bscram1.jpg b/lectures/img/bscram1.jpg new file mode 100644 index 0000000..8940064 Binary files /dev/null and b/lectures/img/bscram1.jpg differ diff --git a/lectures/img/code_quality.png b/lectures/img/code_quality.png new file mode 100644 index 0000000..0afd7a0 Binary files /dev/null and b/lectures/img/code_quality.png differ diff --git a/lectures/img/compiling.jpg b/lectures/img/compiling.jpg new file mode 100644 index 0000000..803c01e Binary files /dev/null and b/lectures/img/compiling.jpg differ diff --git a/lectures/img/demo2.png b/lectures/img/demo2.png new file mode 100644 index 0000000..2c27f23 Binary files /dev/null and b/lectures/img/demo2.png differ diff --git a/lectures/img/fps.png b/lectures/img/fps.png new file mode 100644 index 0000000..830be74 Binary files /dev/null and b/lectures/img/fps.png differ diff --git a/lectures/img/git.png b/lectures/img/git.png new file mode 100644 index 0000000..3f35d2d Binary files /dev/null and b/lectures/img/git.png differ diff --git a/lectures/img/goto.png b/lectures/img/goto.png new file mode 100644 index 0000000..15893e2 Binary files /dev/null and b/lectures/img/goto.png differ diff --git a/lectures/img/module_introduction.org b/lectures/img/module_introduction.org new file mode 100644 index 0000000..3067f31 --- /dev/null +++ b/lectures/img/module_introduction.org @@ -0,0 +1,169 @@ +# -*- mode: org -*- +#+TITLE: 389COM: Module Introduction +#+AUTHOR: Dr Carey Pridgeon, DR Nazaraf Shah +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:1 num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +* Lecture One +** Module Content +- This Module teaches you how the Open Source World works. +- We do this not via lectures alone, but through several interactive methods +- 1: Worksheets where you get to practice doing things which are either used or + required knowledge in the Open Source community. +- 2: Direct interaction with Mozilla, a widely known Open Source Company. +** Lectures +- The Lectures themselves will cover a variety of topics related to open source + and programming in general. As a rule each will have an accompanying worksheet, + though this may not always be the case. + - Nor would it be required for you to wait for the lecture to begin the + worksheet. +** Worksheet Completion +- Every year we advise people to begin the worksheets when they start the + module. +- Every year some students leave the worksheets til the final week. +- These are, without fail, the students who either end up failing or getting + really low grades. +- Don't be this student, we usually don't have time to help someone who is stuck + on something they should have finished in the first half of the module. Things + get busy. +- Last year 1 in ten students failed on the first attempt, each because they + left the worksheets till too late and didn't think the portfolio mattered. +** Assessment +- The assessment scheme has been split into two parts. + - Medium Difficulty (Low to Medium Grade 0-69) + - Hard Difficulty (High Grade 70-100) +- This is so everyone can participate with the Mozilla contribution portion + without having to be great at programming. +** Mozilla +- The Mozilla foundation began when Netscape decided to release the source code + of their browser in 1998. It took a while for the Foundation to get going, but + you can read up on the history yourself. +- [[https://mozilla.org/]] +- Much of this module revolves around independant work. Nazaraf and I are here + for the most part to support you while you figure things out for yourself, and + with each others help. +** Constant Change +- Every year, because the Open Source world is moving so fast, we find our + materials have been outdated in some way in the time between being written and + you using them, in spite of being re-written each year. +- This is unavoidable. I do my best to minimise the impact of changes, but it's + impossible for me to find them all. +- Sometimes major changes have occurred to Mozilla's systems in the last few + weeks before the module began. They are a commercial Open Source company, we + are having to work around this. +** Portfolio - Medium Difficulty +- Worksheets, an essay, and whatever you can of submissions to Mozilla. To + barely pass You could get away with not submitting anything to Mozilla, but + taking this route would mean two things. +- 1: You get almost nothing of use from this module in terms of either grade, + extra knowledge or things to go on your CV. +- 2: You are extreme risk of having to retake if you misjudge what is needed for + any of the components you submit. +- Submissions to Mozilla will be in the form of online documentation + checking/fixes and reviews. +- These have to be done according to Mozilla's own high standards, and + *absolutely* cannot be rushed at the last minute. +** Portfolio - Hard Difficulty +- This is the ideal target for students with programming ability. +- Thus far, unless you've had a placement year, all the code you've worked on + has been what are called /toy/ projects. +- In this module you get the opportunity to work on a live codebase. The code + you submit to Mozilla, if accepted, will be deployed in the next release of + Firefox. +- Thus, however small your contribution, it is still part of a live Open Source + product in use worldwide by millions of people. +- You still need to complete the Worksheets and Essay, if you are going to take + the programming route you will need these out of the way as soon as possible. +** Benefits +- CV + - Everything you complete and submit to Mozilla can be put on your CV. + - Some past students have gained jobs based directly on things they learned on + this module. +** Questions asked every year +- How many bugs (software fixes) or documentation fixes should I do) +- The answer for documentation is simple. Documentation isn't as difficult, so + the more you do, the better your grade. +- With software fixes the question is harder to answer. In the past A student + has achieved a really high grade with just one fix. +- However that was a *really* complicated one which required that he work with + several engineers at Mozilla, and me over the course of the module to + complete. +- My usual advice is, as many as you can, because each bug fix is marked on its + own merits. +- There are set elements of the marking scheme for bugfixing, I'll discuss those + when I go through the scheme itself. +** So, What *IS* Open Source +- Way back in the 1970's, when I was trying desperately to avoid wearing flared + jeans, and occasionally visiting my local powerstation to play with their + computer, some guys in America were getting fed up with the way big companies + were behaving, always keeping the source code of software to themselves. +- You only really need to know about Richard Stallman + [[file:img/stallman.jpg]] +- He objected to this and created the Free Software Foundation to combat the problem. +- You're already rather experienced in using the products of the Free Software + Foundation, it's just you may not know it. +** Some Products of FSF +- GCC GNU Compiler Collection - C, C++, Objective-C, Objective-C++, Fortran, Ada, D, Go, and BRIG. +- Emacs Code and Text Editor - The Multitool of the development world, and what + all the materials of this module are written in. +- GDB GNU DeBugging Suite. +- GProf GNU Program Profiler. +- Splint - GNU code standards correctness checker, or as I call it, the Stallman Auto + Criticiser. Impossible to please. +** Downside of the FSF +- Stallman, and therefore his organisation, believe all software should be + free. Not always literally free, but the licences they have, which we will + cover soon, do their best to enforce this free of physical cost aspect, + lending the lie to his protest that he only means 'Free as in Freedom, Not + Free as in Beer'. +- The FSF are, by design, hostile to business, but from the outset, not all + software developers who wanted to share code were of the same mind. +- This led to the creation of the *Open Source Initiative*, and it is the OSI's + philosophy that we follow on this module. +** +- Put basically, *free coders gotta eat too*. There are now plenty of examples + of successful companies which started out using free/Open Source Software and + are now multi million or billion dollar businesses. +- It's less common for individual programmers to become wealthy in the Open + Source world, because it isn't the same as the closed source world, but since + all or most your work is visible to everyone, its potentially more stable as a + career path. +- I say most because even Mozilla has to keep certain parts of their operation + secret. This is however far better than closed source companies who routinely + keep everything to themselves. +** How will this Module Work +- Each week for the early part of the module we will have one lecture a week and + the rest of the time will be spent doing worksheets or your portfolio. +- While feedback and help is always available, there is also a component of each + aspect of the portfolio which involves a marked feedback session. +- The mark is always a set amount, all you need is to meet the requirements to + have the feedback, complete it, and you get the grade. +- Later in the module we won't have lectures as you will be too busy on your + portfolios, and we will be busy supporting you. I will be able to revisit + points from lectures if you want. + + + + + + + +** Obligatory XKCD +[[file:img/open_source.png]] +- Copyright: Randall Munroe - XKCD +- /Mirrored on my hosting to avoid bandwidth stealing/ +** Licence for this work +- Licenced under Creative Commons Attribution-ShareAlike 4.0 + International by Dr Carey Pridgeon 2019 +- (Licence does not cover linked images owned by other content creators) diff --git a/lectures/img/nethack.png b/lectures/img/nethack.png new file mode 100644 index 0000000..cc92436 Binary files /dev/null and b/lectures/img/nethack.png differ diff --git a/lectures/img/open_source.png b/lectures/img/open_source.png new file mode 100644 index 0000000..06ae26b Binary files /dev/null and b/lectures/img/open_source.png differ diff --git a/lectures/img/patch.png b/lectures/img/patch.png new file mode 100644 index 0000000..1a127c7 Binary files /dev/null and b/lectures/img/patch.png differ diff --git a/lectures/img/perspective.png b/lectures/img/perspective.png new file mode 100644 index 0000000..43cbba1 Binary files /dev/null and b/lectures/img/perspective.png differ diff --git a/lectures/img/reaper_bot.png b/lectures/img/reaper_bot.png new file mode 100644 index 0000000..d9d23f5 Binary files /dev/null and b/lectures/img/reaper_bot.png differ diff --git a/lectures/img/stallman.jpg b/lectures/img/stallman.jpg new file mode 100644 index 0000000..7b594f6 Binary files /dev/null and b/lectures/img/stallman.jpg differ diff --git a/lectures/img/steal_this_comic.png b/lectures/img/steal_this_comic.png new file mode 100644 index 0000000..7bb99de Binary files /dev/null and b/lectures/img/steal_this_comic.png differ diff --git a/lectures/img/supported_features.png b/lectures/img/supported_features.png new file mode 100644 index 0000000..c742518 Binary files /dev/null and b/lectures/img/supported_features.png differ diff --git a/lectures/img/ultimate_game.png b/lectures/img/ultimate_game.png new file mode 100644 index 0000000..6e4f8c3 Binary files /dev/null and b/lectures/img/ultimate_game.png differ diff --git a/lectures/img/unit-sales-trend-20160110.png b/lectures/img/unit-sales-trend-20160110.png new file mode 100644 index 0000000..163555c Binary files /dev/null and b/lectures/img/unit-sales-trend-20160110.png differ diff --git a/lectures/img/user_interface.jpg b/lectures/img/user_interface.jpg new file mode 100644 index 0000000..29e6761 Binary files /dev/null and b/lectures/img/user_interface.jpg differ diff --git a/lectures/licences_and_copyright.html b/lectures/licences_and_copyright.html new file mode 100644 index 0000000..b41a23c --- /dev/null +++ b/lectures/licences_and_copyright.html @@ -0,0 +1,427 @@ + + + + +389COM: Copyright + + + + + + + + + + + + +
+
+

389COM: Copyright

Dr Carey Pridgeon, DR Nazaraf Shah

Created: 2019-08-20 Tue 13:34

+
+
+
+

Table of Contents

+ +
+
+
+
+

Licences and Copyright

+
+
+
+
+
+
+

What are Licences

+
    +
  • Licences grant you rights to use software you have obtained which someone else +has produced.
  • +
  • There are multiple kinds of licence. For brevity on this module we will only +be concerning ourselves with three types.
  • +
  • These are:
  • +
  • Commercial
  • +
  • Free Software.
  • +
  • Open Source.
  • + +
+ +
+
+
+
+

Commercial

+
    +
  • These are likely to be the ones you are most familer with.
  • +
  • They come with games or software you buy, and dictate what you are allowed +to do with your purchase.
  • +
  • No-one ever reads them.
  • +
  • For most people, commercial licences only cover the compiled version of the +product, not the source code from which it was created.
  • + +
+
+
+
+
+

+
    +
  • Typical restrictions: +
      +
    • Limitations on how many users the software can have.
    • +
    • Install count limits.
    • +
    • Upgrade limits before new purchase is required.
    • + +
  • +
  • Some level of support sometimes specified, though often this is minimal unless +extra money is paid.
  • + +
+
+
+
+
+

Free Software

+
    +
  • For everyone it covers the source code only, not the compiled software, or the +resources (sound, graphice, logos).
  • +
  • These are often available free, but resources are not available for reuse in +new projects, as you have not been granted permission to do +so by the license.
  • +
  • Most of the time the compiled version is made available for convenience, and +because these days most users of computers don't know how to compile software, +but the compiled version is provided as is, with no warranty or support.
  • + +
+
+
+
+
+

+
    +
  • To be a proper Free Software Licence, it must be approved by the Free +Software Foundation.
  • +
  • The main Free Software License we will concern ourselves with on the course is +the GPL and its derivatives.
  • +
  • LGPL - disowned by the FSF as being to permissive.
  • +
  • Affero GPL - An attempt by the FSF to further lock down the GPL which has +failed due to lack of adoption, and in some cases, outright banning by some +organisations.
  • + +
+
+
+
+
+

Open Source

+
    +
  • Formed as a breakaway group from the Free Software Foundation in 1998 by Bruce +Perens in response to the FSFs continued resistance to engage with commercial +interests, which he saw as counter to the needs of both software developers +and those businesses.
  • +
  • Like Free Software Licences, the Open Source Licence only covers source code, +not compiled software (binaries) or resources of any kind.
  • +
  • To be an official Open Source licence, a licence must be approved by the +OSI. Unlike the FSF, the OSI has no products of its own, acting only as a +regulatory and approval body for the Open Source movement.
  • + +
+
+
+
+
+

Crossover

+
    +
  • Some licences are approved by both organisations.
  • +
  • The GPL is not approved by the OSI, as it does not meet with their definition +of freedom, being viewed by some as too restrictive, since the FSF have long +sought to prevent businesses taking control of Free Software.
  • +
  • In many ways their view can be seen as valid, but it simply isn't the case +that all software either can, or should, be completely free.
  • + +
+
+
+
+
+

+
    +
  • We don't live in a world where such things are possible, or possibly even +desirable, yet.
  • +
  • But we are slowly moving that way in some areas.
  • +
  • If you create some software, you can select a licence for it, or even more +than one licence, releasing for example, a commercial and Open Source version +simultaneously. Several companies have had great success with this approach.
  • +
  • As the original creator you can also change the license whenever you want. If +you have received the software you can only do this if the licence terms +permit it. This is called sublicencing.
  • + +
+ + +
+
+
+
+

What is Copyright

+
    +
  • Copyright is legal right that protects the use of your work once your idea has +been physically expressed.
  • +
  • Valid in the country of origin or certain economically co-operating +countries.
  • +
  • Worldwide Copyrights can be obtained.
  • +
  • Copyright is automatic, and can be expressly abandoned.
  • +
  • Copyright can expire (70 years after authors death in the US and EU, +95 if author is unknown), but cannot be assumed to have been +abandoned.
  • + +
+
+
+
+
+

How Does it Work? - 1

+
    +
  • Rights to use Copyrighted work can be granted with or without +payment a fee by the Copyright Holder.
  • +
  • The rights to use Copyrighted work can be expressly denied, or +withdrawn by the Copyright Holder.
  • +
  • Code that lacks a Copyright notice can not be used for 95 years, so +in our terms, never.
  • +
  • Copyright ownership can be transferred.
  • + +
+
+
+
+
+

How Does it Work? - 2

+
    +
  • Copyright cannot be arbitrarily assigned to works you did not +create, or assigned to works that have fallen out of copyright.
  • +
  • Copyrighted names can be co-opted (eg, Linux, which was 'stolen' in this way +in 1996 link), but are usually returnable with enough evidence and work.
  • + +
+
+
+
+
+

Copyrighting Options

+
    +
  • Creative Commons: code, literature, music, hardware.
  • +
  • CopyLeft: Free Software Foundation (software primarily)
  • +
  • Open Source: Software/Documentation/Hardware.
  • +
  • Commercial: Access granted via a fee or under strict non profit conditions.
  • +
  • You can create your own Copyright notice.
  • +
  • Within those options there is a huge range of choices.
  • + +
+
+
+
+
+

TradeMarks - 1

+
    +
  • A symbol or name associated with a given product.
  • +
  • A mark should be unique enough that it won't confuse consumers with a similar +brand. +
      +
    • Names: Champagne, Oreo, Smarties
    • +
    • Symbols: Nike Swoosh, FireFox Logo, FSF Logo, Coke Swirl.
    • + +
  • +
  • Unlike Copyright, Marks must be protected/defended or they can be lost +(Cheddar, Hoover, Aspirin), a process also known as becoming Generic, after +which the name can be used by any similar product, or will more usually be +used to refer to a general class of product.
  • + +
+
+
+
+
+

TradeMarks - 2

+
    +
  • Trademarks can also become effectively, as well as legally, generic, rendering +the Trademarks recovery impossible. +
      +
    • Can you Hoover that up, would you like an Aspirin or somesuch.
    • + +
  • +
  • Owning a Mark for a product does not prevent someone producing the +same thing and using a different Mark for it, you need Copyright to +control that.
  • + +
+
+
+
+
+

TradeMarks - 3

+
    +
  • A Trademark gives you a Brand, Copyright protects the products of +that brand.
  • +
  • Some Marks predate trademark laws, so can be widely used to identify +a process or class of product (Sabatier knives, Damascus steel).
  • + +
+
+
+
+
+

Open Source Relevance

+
    +
  • Marks are as important in the free/open source world as in the +commercial.
  • +
  • Possibly less at risk of becoming generic, because there is no +profit motive to re-use them.
  • +
  • Free and Open Source licences, do not transfer Marks.
  • +
  • Like Copyrights, Marks can be transferred/sold.
  • + +
+
+
+
+
+

Patents - What they protect

+
    +
  • Patents control an idea expressed in a design (usually)
  • +
  • Holding a Patent means you can prevent someone else using your +idea/design in their own product.
  • +
  • Patents are usually made available for a fee, but the can be +licensed for a minimal fee, or none at all.
  • + +
+
+
+
+
+

Free Patents

+
    +
  • Patents can be dedicated (released to the public domain), which means the +owner allows free access to the technology it covers.
  • +
  • Patent licensing abuse is rampant in the US.
  • +
  • Patent Trolls are a thing.
  • +
  • There is a Patent covering the World Wide Web (That thing Facebook/Instagram +are on), which was initially conceived/created by Tim Berners-Lee
  • + +
+
+
+
+
+

Trademark Mistakes - 1

+
    +
  • In 1996, Linux itself had its Trademark stolen by William R. Della Croce of +Boston (who had hoped by registering it, to make a lot of money by claiming +ownership of Linux), and it took a year to get it back.
  • +
  • What happened to Linux occurred mostly because the developers weren't paying +attention to the Trademark issue. Since then they have been a lot more +careful.
  • + +
+
+
+
+
+

Trademark Mistakes - 2

+
    +
  • They weren't alone in being so lax, since in 1999, Microsoft forgot to pay +their domain renewal, causing virtually their entire online presence to +vanish. They've done that more than once too.
  • +
  • So long as you don’t forget that you need to register your trademarks once +your project moves beyond being being a small project with just a few users, +you should be ok.
  • +
  • It isn't free to register them though, so make sure it's worth the cost. A +faily simple metric is that if your project is generating a revenue stream, +it's worth it, if not, it isn't.
  • + +
+
+
+
+
+

Obligatory XKCD

+ +
+

steal_this_comic.png +

+
+
    +
  • Copyright: Randall Munroe - XKCD
  • +
  • Mirrored in my hosting to avoid bandwidth stealing
  • + +
+
+
+
+
+

Licence for this work

+
    +
  • Licenced under Creative Commons Attribution-ShareAlike 4.0 +International by Dr Carey Pridgeon 2016
  • +
  • (Licence does not cover linked images owned by other content creators)
  • + +
+
+
+
+
+ + + + + + diff --git a/lectures/licences_and_copyright.org b/lectures/licences_and_copyright.org new file mode 100644 index 0000000..83bea68 --- /dev/null +++ b/lectures/licences_and_copyright.org @@ -0,0 +1,186 @@ +#+TITLE: 389COM: Copyright +#+AUTHOR: Dr Carey Pridgeon, DR Nazaraf Shah +# -*- mode: org -*- +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:1 num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +* Licences and Copyright +** What are Licences +- Licences grant you rights to use software you have obtained which someone else + has produced. +- There are multiple kinds of licence. For brevity on this module we will only + be concerning ourselves with three types. +- These are: +- Commercial +- Free Software. +- Open Source. + +** Commercial + - These are likely to be the ones you are most familer with. + - They come with games or software you buy, and dictate what you are allowed + to do with your purchase. + - No-one /ever/ reads them. + - For most people, commercial licences only cover the compiled version of the + product, not the source code from which it was created. +** +- Typical restrictions: + - Limitations on how many users the software can have. + - Install count limits. + - Upgrade limits before new purchase is required. +- Some level of support sometimes specified, though often this is minimal unless + extra money is paid. +** Free Software +- For everyone it covers the source code only, not the compiled software, or the + resources (sound, graphice, logos). +- These are often available free, but resources are not available for reuse in + new projects, as you have not been granted permission to do + so by the license. +- Most of the time the compiled version is made available for convenience, and + because these days most users of computers don't know how to compile software, + but the compiled version is provided as is, with no warranty or support. +** +- To be a *proper* Free Software Licence, it must be approved by the Free + Software Foundation. +- The main Free Software License we will concern ourselves with on the course is + the GPL and its derivatives. +- LGPL - disowned by the FSF as being to permissive. +- Affero GPL - An attempt by the FSF to further lock down the GPL which has + failed due to lack of adoption, and in some cases, outright banning by some + organisations. +** Open Source +- Formed as a breakaway group from the Free Software Foundation in 1998 by Bruce + Perens in response to the FSFs continued resistance to engage with commercial + interests, which he saw as counter to the needs of both software developers + and those businesses. +- Like Free Software Licences, the Open Source Licence only covers source code, + not compiled software (binaries) or resources of any kind. +- To be an official Open Source licence, a licence must be approved by the + OSI. Unlike the FSF, the OSI has no products of its own, acting only as a + regulatory and approval body for the Open Source movement. +** Crossover +- Some licences are approved by both organisations. +- The GPL is not approved by the OSI, as it does not meet with their definition + of freedom, being viewed by some as too restrictive, since the FSF have long + sought to prevent businesses taking control of Free Software. +- In many ways their view can be seen as valid, but it simply isn't the case + that *all* software either can, or should, be completely free. +** +- We don't live in a world where such things are possible, or possibly even + desirable, yet. +- But we are slowly moving that way in some areas. +- If you create some software, you can select a licence for it, or even more + than one licence, releasing for example, a commercial and Open Source version + simultaneously. Several companies have had great success with this approach. +- As the original creator you can also change the license whenever you want. If + you have received the software you can only do this if the licence terms + permit it. This is called *sublicencing*. + + +** What is Copyright +- Copyright is legal right that protects the use of your work once your idea has + been physically expressed. +- Valid in the country of origin or certain economically co-operating + countries. +- Worldwide Copyrights can be obtained. +- Copyright is automatic, and can be expressly abandoned. +- Copyright can expire (70 years after authors death in the US and EU, + 95 if author is unknown), but cannot be /assumed/ to have been + abandoned. +** How Does it Work? - 1 +- Rights to use Copyrighted work can be granted with or without + payment a fee by the Copyright Holder. +- The rights to use Copyrighted work can be expressly denied, or + withdrawn by the Copyright Holder. +- Code that lacks a Copyright notice can not be used for 95 years, so + in our terms, never. +- Copyright ownership can be transferred. +** How Does it Work? - 2 +- Copyright cannot be arbitrarily assigned to works you did not + create, or assigned to works that have fallen out of copyright. +- Copyrighted names can be co-opted (eg, Linux, which was 'stolen' in this way + in 1996 [[http://www.linuxjournal.com/article/2559][link]]), but are usually returnable with enough evidence and work. +** Copyrighting Options +- Creative Commons: code, literature, music, hardware. +- CopyLeft: Free Software Foundation (software primarily) +- Open Source: Software/Documentation/Hardware. +- Commercial: Access granted via a fee or under strict non profit conditions. +- You can create your own Copyright notice. +- Within those options there is a *huge* range of choices. +** TradeMarks - 1 +- A symbol or name associated with a given product. +- A mark should be unique enough that it won't confuse consumers with a similar + brand. + - Names: Champagne, Oreo, Smarties + - Symbols: Nike Swoosh, FireFox Logo, FSF Logo, Coke Swirl. +- Unlike Copyright, Marks must be protected/defended or they can be lost + (Cheddar, Hoover, Aspirin), a process also known as becoming Generic, after + which the name can be used by any similar product, or will more usually be + used to refer to a general class of product. +** TradeMarks - 2 +- Trademarks can also become effectively, as well as legally, generic, rendering + the Trademarks recovery impossible. + - /Can you Hoover that up/, /would you like an Aspirin/ or somesuch. +- Owning a Mark for a product does not prevent someone producing the + same thing and using a different Mark for it, you need Copyright to + control that. +** TradeMarks - 3 +- A Trademark gives you a /Brand/, Copyright protects the products of + that brand. +- Some Marks predate trademark laws, so can be widely used to identify + a process or class of product (Sabatier knives, Damascus steel). +** Open Source Relevance +- Marks are as important in the free/open source world as in the + commercial. +- Possibly less at risk of becoming generic, because there is no + profit motive to re-use them. +- Free and Open Source licences, do not transfer Marks. +- Like Copyrights, Marks can be transferred/sold. +** Patents - What they protect +- Patents control an idea expressed in a design (usually) +- Holding a Patent means you can prevent someone else using your + idea/design in their own product. +- Patents are usually made available for a fee, but the can be + licensed for a minimal fee, or none at all. +** Free Patents +- Patents can be dedicated (released to the public domain), which means the + owner allows free access to the technology it covers. +- Patent licensing abuse is rampant in the US. +- Patent Trolls are a thing. +- There is a Patent covering the World Wide Web (That thing Facebook/Instagram + are on), which was initially conceived/created by [[https://en.wikipedia.org/wiki/Tim_Berners-Lee][Tim Berners-Lee]] +** Trademark Mistakes - 1 +- In 1996, Linux itself had its Trademark stolen by William R. Della Croce of + Boston (who had hoped by registering it, to make a lot of money by claiming + ownership of Linux), and it took a year to get it back. +- What happened to Linux occurred mostly because the developers weren't paying + attention to the Trademark issue. Since then they have been a lot more + careful. +** Trademark Mistakes - 2 +- They weren't alone in being so lax, since in 1999, Microsoft forgot to pay + their domain renewal, causing virtually their entire online presence to + vanish. They've done that more than once too. +- So long as you don’t forget that you need to register your trademarks once + your project moves beyond being being a small project with just a few users, + you should be ok. +- It isn't free to register them though, so make sure it's worth the cost. A + faily simple metric is that if your project is generating a revenue stream, + it's worth it, if not, it isn't. +** Obligatory XKCD +[[file:img/steal_this_comic.png]] +- Copyright: Randall Munroe - XKCD +- Mirrored in my hosting to avoid bandwidth stealing +** Licence for this work +- Licenced under Creative Commons Attribution-ShareAlike 4.0 + International by Dr Carey Pridgeon 2016 +- (Licence does not cover linked images owned by other content creators) diff --git a/lectures/module_introduction.html b/lectures/module_introduction.html new file mode 100644 index 0000000..6cfc136 --- /dev/null +++ b/lectures/module_introduction.html @@ -0,0 +1,375 @@ + + + + +389COM: Module Introduction + + + + + + + + + + + + +
+
+

389COM: Module Introduction

Dr Carey Pridgeon, DR Nazaraf Shah

Created: 2019-09-16 Mon 10:16

+
+
+
+

Table of Contents

+
+ +
+
+
+
+
+

Lecture One

+
+
+
+
+
+
+

Module Content

+
    +
  • This Module teaches you how the Open Source World works.
  • +
  • We do this not via lectures alone, but through several interactive methods
  • +
  • 1: Worksheets where you get to practice doing things which are either used or +required knowledge in the Open Source community.
  • +
  • 2: Direct interaction with Mozilla, a widely known Open Source Company.
  • + +
+
+
+
+
+

Lectures

+
    +
  • The Lectures themselves will cover a variety of topics related to open source +and programming in general. As a rule each will have an accompanying worksheet, +though this may not always be the case. +
      +
    • Nor would it be required for you to wait for the lecture to begin the +worksheet.
    • + +
  • + +
+
+
+
+
+

Worksheet Completion

+
    +
  • Every year we advise people to begin the worksheets when they start the +module.
  • +
  • Every year some students leave the worksheets til the final week.
  • +
  • These are, without fail, the students who either end up failing or getting +really low grades.
  • +
  • Don't be this student, we usually don't have time to help someone who is stuck +on something they should have finished in the first half of the module. Things +get busy.
  • +
  • Last year 1 in ten students failed on the first attempt, each because they +left the worksheets till too late and didn't think the portfolio mattered.
  • + +
+
+
+
+
+

Assessment

+
    +
  • The assessment scheme has been split into two parts. +
      +
    • Medium Difficulty (Low to Medium Grade 0-69)
    • +
    • Hard Difficulty (High Grade 70-100)
    • + +
  • +
  • This is so everyone can participate with the Mozilla contribution portion +without having to be great at programming.
  • + +
+
+
+
+
+

Mozilla

+
    +
  • The Mozilla foundation began when Netscape decided to release the source code +of their browser in 1998. It took a while for the Foundation to get going, but +you can read up on the history yourself.
  • +
  • https://mozilla.org/
  • +
  • Much of this module revolves around independant work. Nazaraf and I are here +for the most part to support you while you figure things out for yourself, and +with each others help.
  • + +
+
+
+
+
+

Constant Change

+
    +
  • Every year, because the Open Source world is moving so fast, we find our +materials have been outdated in some way in the time between being written and +you using them, in spite of being re-written each year.
  • +
  • This is unavoidable. I do my best to minimise the impact of changes, but it's +impossible for me to find them all.
  • +
  • Sometimes major changes have occurred to Mozilla's systems in the last few +weeks before the module began. They are a commercial Open Source company, we +are having to work around this.
  • + +
+
+
+
+
+

Portfolio - Medium Difficulty

+
    +
  • Worksheets, an essay, and whatever you can of submissions to Mozilla. To +barely pass You could get away with not submitting anything to Mozilla, but +taking this route would mean two things.
  • +
  • 1: You get almost nothing of use from this module in terms of either grade, +extra knowledge or things to go on your CV.
  • +
  • 2: You are extreme risk of having to retake if you misjudge what is needed for +any of the components you submit.
  • +
  • Submissions to Mozilla will be in the form of online documentation +checking/fixes and reviews.
  • +
  • These have to be done according to Mozilla's own high standards, and +absolutely cannot be rushed at the last minute.
  • + +
+
+
+
+
+

Portfolio - Hard Difficulty

+
    +
  • This is the ideal target for students with programming ability.
  • +
  • Thus far, unless you've had a placement year, all the code you've worked on +has been what are called toy projects.
  • +
  • In this module you get the opportunity to work on a live codebase. The code +you submit to Mozilla, if accepted, will be deployed in the next release of +Firefox.
  • +
  • Thus, however small your contribution, it is still part of a live Open Source +product in use worldwide by millions of people.
  • +
  • You still need to complete the Worksheets and Essay, if you are going to take +the programming route you will need these out of the way as soon as possible.
  • + +
+
+
+
+
+

Benefits

+
    +
  • CV +
      +
    • Everything you complete and submit to Mozilla can be put on your CV.
    • +
    • Some past students have gained jobs based directly on things they learned on +this module.
    • + +
  • + +
+
+
+
+
+

Questions asked every year

+
    +
  • How many bugs (software fixes) or documentation fixes should I do)
  • +
  • The answer for documentation is simple. Documentation isn't as difficult, so +the more you do, the better your grade.
  • +
  • With software fixes the question is harder to answer. In the past A student +has achieved a really high grade with just one fix.
  • +
  • However that was a really complicated one which required that he work with +several engineers at Mozilla, and me over the course of the module to +complete.
  • +
  • My usual advice is, as many as you can, because each bug fix is marked on its +own merits.
  • +
  • There are set elements of the marking scheme for bugfixing, I'll discuss those +when I go through the scheme itself.
  • + +
+
+
+
+
+

So, What IS Open Source

+
    +
  • Way back in the 1970's, when I was trying desperately to avoid wearing flared +jeans, and occasionally visiting my local powerstation to play with their +computer, some guys in America were getting fed up with the way big companies +were behaving, always keeping the source code of software to themselves.
  • +
  • You only really need to know about Richard Stallman +stallman.jpg
  • +
  • He objected to this and created the Free Software Foundation to combat the problem.
  • +
  • You're already rather experienced in using the products of the Free Software +Foundation, it's just you may not know it.
  • + +
+
+
+
+
+

Some Products of FSF

+
    +
  • GCC GNU Compiler Collection - C, C++, Objective-C, Objective-C++, Fortran, Ada, D, Go, and BRIG.
  • +
  • Emacs Code and Text Editor - The Multitool of the development world, and what +all the materials of this module are written in.
  • +
  • GDB GNU DeBugging Suite.
  • +
  • GProf GNU Program Profiler.
  • +
  • Splint - GNU code standards correctness checker, or as I call it, the Stallman Auto +Criticiser. Impossible to please.
  • + +
+
+
+
+
+

Downside of the FSF

+
    +
  • Stallman, and therefore his organisation, believe all software should be +free. Not always literally free, but the licences they have, which we will +cover soon, do their best to enforce this free of physical cost aspect, +lending the lie to his protest that he only means 'Free as in Freedom, Not +Free as in Beer'.
  • +
  • The FSF are, by design, hostile to business, but from the outset, not all +software developers who wanted to share code were of the same mind.
  • +
  • This led to the creation of the Open Source Initiative, and it is the OSI's +philosophy that we follow on this module.
  • + +
+
+
+
+
+

+
    +
  • Put basically, free coders gotta eat too. There are now plenty of examples +of successful companies which started out using free/Open Source Software and +are now multi million or billion dollar businesses.
  • +
  • It's less common for individual programmers to become wealthy in the Open +Source world, because it isn't the same as the closed source world, but since +all or most your work is visible to everyone, its potentially more stable as a +career path.
  • +
  • I say most because even Mozilla has to keep certain parts of their operation +secret. This is however far better than closed source companies who routinely +keep everything to themselves.
  • + +
+
+
+
+
+

How will this Module Work

+
    +
  • Each week for the early part of the module we will have one lecture a week and +the rest of the time will be spent doing worksheets or your portfolio.
  • +
  • While feedback and help is always available, there is also a component of each +aspect of the portfolio which involves a marked feedback session.
  • +
  • The mark is always a set amount, all you need is to meet the requirements to +have the feedback, complete it, and you get the grade.
  • +
  • Later in the module we won't have lectures as you will be too busy on your +portfolios, and we will be busy supporting you. I will be able to revisit +points from lectures if you want.
  • + +
+ + + + + + + +
+
+
+
+

Obligatory XKCD

+ +
+

open_source.png +

+
+
    +
  • Copyright: Randall Munroe - XKCD
  • +
  • Mirrored on my hosting to avoid bandwidth stealing
  • + +
+
+
+
+
+

Licence for this work

+
    +
  • Licenced under Creative Commons Attribution-ShareAlike 4.0 +International by Dr Carey Pridgeon 2019
  • +
  • (Licence does not cover linked images owned by other content creators)
  • + +
+
+
+
+
+ + + + + + diff --git a/lectures/module_introduction.org b/lectures/module_introduction.org new file mode 100644 index 0000000..3067f31 --- /dev/null +++ b/lectures/module_introduction.org @@ -0,0 +1,169 @@ +# -*- mode: org -*- +#+TITLE: 389COM: Module Introduction +#+AUTHOR: Dr Carey Pridgeon, DR Nazaraf Shah +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:1 num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +* Lecture One +** Module Content +- This Module teaches you how the Open Source World works. +- We do this not via lectures alone, but through several interactive methods +- 1: Worksheets where you get to practice doing things which are either used or + required knowledge in the Open Source community. +- 2: Direct interaction with Mozilla, a widely known Open Source Company. +** Lectures +- The Lectures themselves will cover a variety of topics related to open source + and programming in general. As a rule each will have an accompanying worksheet, + though this may not always be the case. + - Nor would it be required for you to wait for the lecture to begin the + worksheet. +** Worksheet Completion +- Every year we advise people to begin the worksheets when they start the + module. +- Every year some students leave the worksheets til the final week. +- These are, without fail, the students who either end up failing or getting + really low grades. +- Don't be this student, we usually don't have time to help someone who is stuck + on something they should have finished in the first half of the module. Things + get busy. +- Last year 1 in ten students failed on the first attempt, each because they + left the worksheets till too late and didn't think the portfolio mattered. +** Assessment +- The assessment scheme has been split into two parts. + - Medium Difficulty (Low to Medium Grade 0-69) + - Hard Difficulty (High Grade 70-100) +- This is so everyone can participate with the Mozilla contribution portion + without having to be great at programming. +** Mozilla +- The Mozilla foundation began when Netscape decided to release the source code + of their browser in 1998. It took a while for the Foundation to get going, but + you can read up on the history yourself. +- [[https://mozilla.org/]] +- Much of this module revolves around independant work. Nazaraf and I are here + for the most part to support you while you figure things out for yourself, and + with each others help. +** Constant Change +- Every year, because the Open Source world is moving so fast, we find our + materials have been outdated in some way in the time between being written and + you using them, in spite of being re-written each year. +- This is unavoidable. I do my best to minimise the impact of changes, but it's + impossible for me to find them all. +- Sometimes major changes have occurred to Mozilla's systems in the last few + weeks before the module began. They are a commercial Open Source company, we + are having to work around this. +** Portfolio - Medium Difficulty +- Worksheets, an essay, and whatever you can of submissions to Mozilla. To + barely pass You could get away with not submitting anything to Mozilla, but + taking this route would mean two things. +- 1: You get almost nothing of use from this module in terms of either grade, + extra knowledge or things to go on your CV. +- 2: You are extreme risk of having to retake if you misjudge what is needed for + any of the components you submit. +- Submissions to Mozilla will be in the form of online documentation + checking/fixes and reviews. +- These have to be done according to Mozilla's own high standards, and + *absolutely* cannot be rushed at the last minute. +** Portfolio - Hard Difficulty +- This is the ideal target for students with programming ability. +- Thus far, unless you've had a placement year, all the code you've worked on + has been what are called /toy/ projects. +- In this module you get the opportunity to work on a live codebase. The code + you submit to Mozilla, if accepted, will be deployed in the next release of + Firefox. +- Thus, however small your contribution, it is still part of a live Open Source + product in use worldwide by millions of people. +- You still need to complete the Worksheets and Essay, if you are going to take + the programming route you will need these out of the way as soon as possible. +** Benefits +- CV + - Everything you complete and submit to Mozilla can be put on your CV. + - Some past students have gained jobs based directly on things they learned on + this module. +** Questions asked every year +- How many bugs (software fixes) or documentation fixes should I do) +- The answer for documentation is simple. Documentation isn't as difficult, so + the more you do, the better your grade. +- With software fixes the question is harder to answer. In the past A student + has achieved a really high grade with just one fix. +- However that was a *really* complicated one which required that he work with + several engineers at Mozilla, and me over the course of the module to + complete. +- My usual advice is, as many as you can, because each bug fix is marked on its + own merits. +- There are set elements of the marking scheme for bugfixing, I'll discuss those + when I go through the scheme itself. +** So, What *IS* Open Source +- Way back in the 1970's, when I was trying desperately to avoid wearing flared + jeans, and occasionally visiting my local powerstation to play with their + computer, some guys in America were getting fed up with the way big companies + were behaving, always keeping the source code of software to themselves. +- You only really need to know about Richard Stallman + [[file:img/stallman.jpg]] +- He objected to this and created the Free Software Foundation to combat the problem. +- You're already rather experienced in using the products of the Free Software + Foundation, it's just you may not know it. +** Some Products of FSF +- GCC GNU Compiler Collection - C, C++, Objective-C, Objective-C++, Fortran, Ada, D, Go, and BRIG. +- Emacs Code and Text Editor - The Multitool of the development world, and what + all the materials of this module are written in. +- GDB GNU DeBugging Suite. +- GProf GNU Program Profiler. +- Splint - GNU code standards correctness checker, or as I call it, the Stallman Auto + Criticiser. Impossible to please. +** Downside of the FSF +- Stallman, and therefore his organisation, believe all software should be + free. Not always literally free, but the licences they have, which we will + cover soon, do their best to enforce this free of physical cost aspect, + lending the lie to his protest that he only means 'Free as in Freedom, Not + Free as in Beer'. +- The FSF are, by design, hostile to business, but from the outset, not all + software developers who wanted to share code were of the same mind. +- This led to the creation of the *Open Source Initiative*, and it is the OSI's + philosophy that we follow on this module. +** +- Put basically, *free coders gotta eat too*. There are now plenty of examples + of successful companies which started out using free/Open Source Software and + are now multi million or billion dollar businesses. +- It's less common for individual programmers to become wealthy in the Open + Source world, because it isn't the same as the closed source world, but since + all or most your work is visible to everyone, its potentially more stable as a + career path. +- I say most because even Mozilla has to keep certain parts of their operation + secret. This is however far better than closed source companies who routinely + keep everything to themselves. +** How will this Module Work +- Each week for the early part of the module we will have one lecture a week and + the rest of the time will be spent doing worksheets or your portfolio. +- While feedback and help is always available, there is also a component of each + aspect of the portfolio which involves a marked feedback session. +- The mark is always a set amount, all you need is to meet the requirements to + have the feedback, complete it, and you get the grade. +- Later in the module we won't have lectures as you will be too busy on your + portfolios, and we will be busy supporting you. I will be able to revisit + points from lectures if you want. + + + + + + + +** Obligatory XKCD +[[file:img/open_source.png]] +- Copyright: Randall Munroe - XKCD +- /Mirrored on my hosting to avoid bandwidth stealing/ +** Licence for this work +- Licenced under Creative Commons Attribution-ShareAlike 4.0 + International by Dr Carey Pridgeon 2019 +- (Licence does not cover linked images owned by other content creators) diff --git a/lectures/mozilla_intro.html b/lectures/mozilla_intro.html new file mode 100644 index 0000000..c98b47e --- /dev/null +++ b/lectures/mozilla_intro.html @@ -0,0 +1,194 @@ + + + + +389COM: Copyright + + + + + + + + + + + + +
+
+

389COM: Copyright

Dr Carey Pridgeon, DR Nazaraf Shah

Created: 2019-08-20 Tue 13:58

+
+
+
+

Table of Contents

+
+ +
+
+
+
+
+

Mozilla

+
+
+
+
+
+
+

The Mozilla foundation

+
    +
  • As mentioned in the first lecture, founded when Netscape released the +source code of their browser. There is a documentary related to this on the +Moodle page.
  • +
  • Since the, the Mozilla Foundation have been committed to promoting Open Source +Software development and actively involve themselves with students who are +interested in learning more.
  • +
  • This is why I created this module.
  • + +
+
+
+
+
+

+
    +
  • You can leave this module having done one of two things" +
      +
    • 1: Completed the minimum possible of the portfolio in order to pass.
    • +
    • 2: Achieved as much as possible, getting valuable work you can put on your CV +along the way.
    • + +
  • +
  • Module staff will help you either way. The latter is preferable in terms of +your own future development, but I've been running this module long enough to +learn that some people want to pass with as little work as possible.
  • +
  • The assignment scheme has been designed with this in mind.
  • +
  • It still isn't easy, and it means if you take the simpler route, there is no chance +you can get a higher grade, and this is made clear, so we don't have to +explain it again. But it's easier than the one with a greater educational payoff.
  • + +
+
+
+
+
+

Mozilla Assignment Walkthrough

+
    +
  • Not a slide.
  • + +
+
+
+
+
+

Why Mozilla

+
    +
  • I went to university with one of the people who is now a senior developer at +Mozilla, so I have contacts there through him.
  • +
  • Their attitude towards encouraging new developers to write Open Source +Software while also seeking to earn money matches my own philosophy.
  • +
  • Which is - You may not get paid for all the code you write, but the more +quality code you release with your name attached, the more likely it is you +will gain highly paid employment.
  • +
  • Closed source companies do not release your source code, so your skills are +invisible to potential employers, leaving only interview skills as your means +to impress them.
  • + +
+
+
+
+
+

+
    +
  • A decent portfolio online is far better, most, if not all employers taking on +developers now look online for evidence of your abilities. Not having an +online coding portfolio now is highly unwise.
  • +
  • It is also rather likely someone at a company you are planning to work for +would be an Open Source Developer themselves, as it has become increasingly +popular.
  • +
  • Gone are the days of bearded weirdos sat in basements surrounded by pizza +boxes. Now it's a way to keep a CV fresh, and meet likeminded people.
  • +
  • in other words it's what the modern professional does.
  • + +
+
+
+
+
+

+
    +
  • This, for some reason doesn't seem to be what the Free Software Foundation +wanted, since their rather outdated stance is hostile to coperation with +commercial interests.
  • +
  • This is why Linux, while GPL 2 licensed at the Kernel level, is fundamentally +Open Source and is heavily funded by many corporations, is a huge success.
  • +
  • Even Microsoft have finally switched from trying to shut it down to supporting +it.
  • +
  • Whereas Hurd, the FSFs attempt at an operating system which would in theory +be far superior to Linux, rejected this approach, was mishandled by Stallman +telling the developers who weren't being paid what they could and could not +do, and thus has never been finished.
  • +
  • Mozilla has always relied on financing by major commercial sponsors. First +AOL, then Google.
  • + +
+
+
+
+
+ + + + + + diff --git a/lectures/mozilla_intro.org b/lectures/mozilla_intro.org new file mode 100644 index 0000000..87bd166 --- /dev/null +++ b/lectures/mozilla_intro.org @@ -0,0 +1,76 @@ +#+TITLE: 389COM: Copyright +#+AUTHOR: Dr Carey Pridgeon, DR Nazaraf Shah +# -*- mode: org -*- +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:1 num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +* Mozilla +** The Mozilla foundation +- As mentioned in the first lecture, founded when Netscape released the + source code of their browser. There is a documentary related to this on the + Moodle page. +- Since the, the Mozilla Foundation have been committed to promoting Open Source + Software development and actively involve themselves with students who are + interested in learning more. +- This is why I created this module. +** +- You can leave this module having done one of two things" + - 1: Completed the minimum possible of the portfolio in order to pass. + - 2: Achieved as much as possible, getting valuable work you can put on your CV + along the way. +- Module staff will help you either way. The latter is preferable in terms of + your own future development, but I've been running this module long enough to + learn that some people want to pass with as little work as possible. +- The assignment scheme has been designed with this in mind. +- It still isn't easy, and it means if you take the simpler route, there is no chance + you can get a higher grade, and this is made clear, so we don't have to + explain it again. But it's easier than the one with a greater educational payoff. +** Mozilla Assignment Walkthrough +- Not a slide. +** Why Mozilla +- I went to university with one of the people who is now a senior developer at + Mozilla, so I have contacts there through him. +- Their attitude towards encouraging new developers to write Open Source + Software while also seeking to earn money matches my own philosophy. +- Which is - You may not get paid for all the code you write, but the more + quality code you release with your name attached, the more likely it is you + will gain highly paid employment. +- Closed source companies do not release your source code, so your skills are + invisible to potential employers, leaving only interview skills as your means + to impress them. +** +- A decent portfolio online is far better, most, if not all employers taking on + developers now look online for evidence of your abilities. Not having an + online coding portfolio now is highly unwise. +- It is also rather likely someone at a company you are planning to work for + would be an Open Source Developer themselves, as it has become increasingly + popular. +- Gone are the days of bearded weirdos sat in basements surrounded by pizza + boxes. Now it's a way to keep a CV fresh, and meet likeminded people. +- in other words it's what the modern professional does. +** +- This, for some reason doesn't seem to be what the Free Software Foundation + wanted, since their rather outdated stance is hostile to coperation with + commercial interests. +- This is why Linux, while GPL 2 licensed at the Kernel level, is fundamentally + Open Source and is heavily funded by many corporations, is a huge success. +- Even Microsoft have finally switched from trying to shut it down to supporting + it. +- Whereas Hurd, the FSFs attempt at an operating system which would /in theory/ + be far superior to Linux, rejected this approach, was mishandled by Stallman + telling the developers who weren't being paid what they could and could not + do, and thus has never been finished. +- Mozilla has always relied on financing by major commercial sponsors. First + AOL, then Google. + diff --git a/lectures/open_source_developer.html b/lectures/open_source_developer.html new file mode 100644 index 0000000..12f9bf2 --- /dev/null +++ b/lectures/open_source_developer.html @@ -0,0 +1,304 @@ + + + + +389COM: Becoming an Open Source Developer + + + + + + + + + + + + +
+
+

389COM: Becoming an Open Source Developer

Dr Carey Pridgeon, DR Nazaraf Shah

Created: 2019-08-20 Tue 13:36

+
+
+
+

Table of Contents

+ +
+
+
+
+

Becoming an Open Source Developer

+
+
+
+
+
+
+

Required Skill level

+
    +
  • None.
  • +
  • All you need is interest in a particular subject.
  • +
  • As you're not being paid, there are no deadlines to meet other than the ones +you set yourself.
  • +
  • If you have agreed to be part of a team who are also working in their free +time, deadlines might be set, but this is a different matter.
  • +
  • As such this is a great way to learn something new. A language, or a +particular tool, or a library you've not previously found time for.
  • +
  • I used Open Source to learn basic OpenGL, then Parallel and Distributed +Computing, none of which I'd learned as an undergraduate.
  • +
  • I also learned several new languages, and enough of .NET to know I hated it, +nasty slow thing that it is.
  • + +
+
+
+
+
+

Immediate benefits

+
    +
  • Also none.
  • +
  • You get the experience of course, and your online portfolio increases, which +makes you even more visible to potential employers, but you won't be writing +code and rolling in coin.
  • +
  • However. +
      +
    • Every Open Source developer I know has ended up working in a far better +position than it's likely they would have obtained had they not been either +producing their own code or contributing to other Open Source projects.
    • +
    • The latter is often better, as there are usually pre-existing communities.
    • + +
  • + +
+
+
+
+
+

What could I do?

+
    +
  • So long as you can code, design, or otherwise create something which other +people can recreate from a design, template or some form of source you +produce, it can be Open Source.
  • +
  • There are, as well as software projects:
  • +
  • Computers.
  • +
  • Cars.
  • +
  • Satellites.
  • +
  • Airplanes.
  • +
  • House building plans.
  • +
  • Music.
  • +
  • And almost anything you can think of.
  • + +
+
+
+
+
+

Long Game vs Short Game

+
    +
  • Why write code or do something you won't get paid for? After all, that effort +could be put into getting promotions, getting more pay.
  • +
  • Companies can have bad periods. When they do, people lose their jobs.
  • +
  • Specialise too much on your job and you could find yourself unable to find +work with the same pay elsewhere.
  • +
  • By all means go for promotions, but look at the history of your industry, +investigate its booms and huge crashes.
  • + +
+
+
+
+
+

+
    +
  • Specialising, while required for promotion is also extremely +dangerous.
  • +
  • Never let your portfolio go stale, even if your position appears to be rock +solid.
  • +
  • There is also the possibility you might feel the need for a radical career +change. I did, plenty of others do. Like me many of those people were prepared +for the change, so it was easy to achieve. If you're not it may be impossible, +or you might have to wait years.
  • + +
+
+
+
+
+

Advantage After Graduating

+
    +
  • Jobs all need experience.
  • +
  • You can't get experience without a job.
  • +
  • A Good Open Source Product can give you that same experience, if your project +is complex enough (it might take several iterations to achieve this).
  • +
  • You get to control everything in your product.
  • +
  • It doesn't matter if you fail to achieve your ultimate goal, the code is still +there to be read.
  • + +
+
+
+
+
+

How To Go About It

+
    +
  • You start by choosing something you're interested in and starting a project +which involves it.
  • +
  • To start with it can be a lone project, but it needn't be, let's look at a +recent example, which isn't code, but it is done by YD Visual (Ken York) and +his portfolio of physics technology animations.
  • + +
+ +
+

bscram1.jpg +

+
+
+
+
+
+

+
    +
  • These seem now to mostly to be in collaboration with Isaac Arthurs Youtube +Channel Science and Futurism. This work is done for free, though he has, I +believe, received funding for other animations.
  • +
  • However the existence of this impressive online portfolio certainly raises his +profile should he be in a job search scenario. Other candidates without a +comparable online presense would find it harder to compete.
  • + +
+
+
+
+
+

+
    +
  • Lone projects can work fine, particularly for new developers. All your +mistakes can happen in secret.
  • +
  • But there will never be a time when you stop making mistakes. The mistakes +just get bigger as your technical knowledge increases, so hiding mistakes is +not a reason to work alone.
  • +
  • It's also more fun to work with other people, so joining an existing, +larger project is perhaps better.
  • + +
+
+
+
+
+

+
    +
  • You will find that your out GiHub/GitLab repository fills up with small +personal projects quickly enough anyway.
  • +
  • Ken Chose to have his own project, but works with Isaac and the somewhat +extensive community which has evolved around his highly technical +channel. Therefore he is not working in a vacuum, nor is he the only person +contributing 3D graphics or resources.
  • + +
+
+
+
+
+

In Summary

+
    +
  • How you approach this is up to you.
  • +
  • The benefits are often indirect, and generally not immediate, but are related +to the amount of effort you put in.
  • +
  • A low quality portfolio will not attract attention.
  • +
  • Failure to engage in any form of community is generally a bad move.
  • +
  • Community means contacts, contacts can lead to opportunties.
  • +
  • These opportunties may not mean jobs, but you can't look at this solely as a +money making or job creation activity. It needs to be fun.
  • + +
+ + + + +
+
+
+
+

Obligatory XKCD

+ +
+

goto.png +

+
+
    +
  • Copyright: Randall Munroe - XKCD
  • +
  • Mirrored in my hosting to avoid bandwidth stealing
  • + +
+
+
+
+
+

Licence for this work

+
    +
  • Licensed under Creative Commons Attribution-ShareAlike 4.0 +International by Dr Carey Pridgeon 2019
  • +
  • (Licence does not cover linked images or content owned by other creators)
  • + +
+
+
+
+
+ + + + + + diff --git a/lectures/open_source_developer.org b/lectures/open_source_developer.org new file mode 100644 index 0000000..cccd2b3 --- /dev/null +++ b/lectures/open_source_developer.org @@ -0,0 +1,131 @@ +# -*- mode: org -*- +#+TITLE: 389COM: Becoming an Open Source Developer +#+AUTHOR: Dr Carey Pridgeon, DR Nazaraf Shah +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:1 num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +# Licenced under Creative Commons Attribution-ShareAlike 4.0 +# International by Dr Carey Pridgeon 2016 + +* Becoming an Open Source Developer +** Required Skill level +- None. +- All you need is interest in a particular subject. +- As you're not being paid, there are no deadlines to meet other than the ones + you set yourself. +- If you have agreed to be part of a team who are also working in their free + time, deadlines might be set, but this is a different matter. +- As such this is a great way to learn something new. A language, or a + particular tool, or a library you've not previously found time for. +- I used Open Source to learn basic OpenGL, then Parallel and Distributed + Computing, none of which I'd learned as an undergraduate. +- I also learned several new languages, and enough of *.NET* to know I hated it, + nasty slow thing that it is. +** Immediate benefits +- Also none. +- You get the experience of course, and your online portfolio increases, which + makes you even more visible to potential employers, but you won't be writing + code and rolling in coin. +- However. + - Every Open Source developer I know has ended up working in a far better + position than it's likely they would have obtained had they not been either + producing their own code or contributing to other Open Source projects. + - The latter is often better, as there are usually pre-existing communities. +** What could I do? +- So long as you can code, design, or otherwise create something which other + people can recreate from a design, template or some form of source you + produce, it can be Open Source. +- There are, as well as software projects: +- Computers. +- Cars. +- Satellites. +- Airplanes. +- House building plans. +- Music. +- And almost anything you can think of. +** Long Game vs Short Game +- Why write code or do something you won't get paid for? After all, that effort + could be put into getting promotions, getting more pay. +- Companies can have bad periods. When they do, people lose their jobs. +- Specialise too much on your job and you could find yourself unable to find + work with the same pay elsewhere. +- By all means go for promotions, but look at the history of your industry, + investigate its booms and *huge* crashes. +** +- Specialising, while required for promotion is also /extremely/ + dangerous. +- Never let your portfolio go stale, even if your position /appears/ to be rock + solid. +- There is also the possibility you might feel the need for a radical career + change. I did, plenty of others do. Like me many of those people were prepared + for the change, so it was easy to achieve. If you're not it may be impossible, + or you might have to wait years. +** Advantage After Graduating +- Jobs all need experience. +- You can't get experience without a job. +- A Good Open Source Product can give you that same experience, if your project + is complex enough (it might take several iterations to achieve this). +- You get to control /everything/ in your product. +- It doesn't matter if you fail to achieve your ultimate goal, the code is still + there to be read. +** How To Go About It +- You start by choosing something you're interested in and starting a project + which involves it. +- To start with it can be a lone project, but it needn't be, let's look at a + recent example, which isn't code, but it is done by [[https://ydvisual.github.io/YdvPortfolio/index.htm][YD Visual (Ken York)]] and + his portfolio of physics technology animations. +file:img/bscram1.jpg +** +- These seem now to mostly to be in collaboration with Isaac Arthurs Youtube + Channel [[https://www.youtube.com/channel/UCZFipeZtQM5CKUjx6grh54g][Science and Futurism]]. This work is done for free, though he has, I + believe, received funding for other animations. +- However the existence of this impressive online portfolio certainly raises his + profile should he be in a job search scenario. Other candidates without a + comparable online presense would find it harder to compete. +** +- Lone projects can work fine, particularly for new developers. All your + mistakes can happen in secret. +- But there will *never* be a time when you stop making mistakes. The mistakes + just get bigger as your technical knowledge increases, so hiding mistakes is + not a reason to work alone. +- It's also more fun to work with other people, so joining an existing, + larger project is perhaps better. +** +- You will find that your out GiHub/GitLab repository fills up with small + personal projects quickly enough anyway. +- Ken Chose to have his own project, but works with Isaac and the somewhat + extensive community which has evolved around his highly technical + channel. Therefore he is not working in a vacuum, nor is he the only person + contributing 3D graphics or resources. +** In Summary +- How you approach this is up to you. +- The benefits are often indirect, and generally not immediate, but are related + to the amount of effort you put in. +- A low quality portfolio will not attract attention. +- Failure to engage in any form of community is generally a bad move. +- Community means contacts, contacts can lead to opportunties. +- These opportunties may not mean jobs, but you can't look at this solely as a + money making or job creation activity. It needs to be fun. + + + + +** Obligatory XKCD +[[file:img/goto.png]] +- Copyright: Randall Munroe - XKCD +- Mirrored in my hosting to avoid bandwidth stealing +** Licence for this work +- Licensed under Creative Commons Attribution-ShareAlike 4.0 + International by Dr Carey Pridgeon 2019 +- (Licence does not cover linked images or content owned by other creators) diff --git a/lectures/saas.html b/lectures/saas.html new file mode 100644 index 0000000..f4f74a9 --- /dev/null +++ b/lectures/saas.html @@ -0,0 +1,268 @@ + + + + +389COM: Software as a Service (SaaS) + + + + + + + + + + + + +
+
+

389COM: Software as a Service (SaaS)

Dr Carey Pridgeon, DR Nazaraf Shah

Created: 2019-08-20 Tue 13:36

+
+
+
+

Table of Contents

+ +
+
+
+
+

What is Software as a Service

+
+
+
+
+
+
+

Why is it relevant

+
    +
  • The definition.
  • +
  • The purpose.
  • +
  • How businesses are reforming around the concept.
  • + +
+
+
+
+
+

Where did we begin

+
    +
  • Software was, and for small businesses, still is, sold in discrete +units, with success measured in per unit sales.
  • +
  • Problems with this model: +
      +
    • Piracy
    • +
    • You need DRM to control your product - which never works -
    • +
    • As Microsoft found with Windows, you are often competing against +previous versions of your own product on a new product release.
    • + +
  • + +
+
+
+
+
+

Partial solution

+
    +
  • Companies began to sell their software products but sell support as +well to ensure an ongoing income and lock out people who stole their +software.
  • +
  • This is where Microsoft still are with some of their products.
  • +
  • In the business world, success is measured by revenue consistency, +not only by large amounts of money coming in occasionally. SaaS therefore has +come to have more appeal over time.
  • + +
+
+
+
+
+

+
    +
  • SaaS goes back to before the current IT world existed, it's beginnings can be +traced to the 1960's.
  • +
  • In short it is software hosted on a centralised computer, delivered to +clients. In the past these would have been thin clients computers able to do +no job other than the task the centralised server sent them, but this is no +longer the case.
  • + +
+
+
+
+
+

+
    +
  • Now customers expect their software to be personalised, their data to be +secure, hosted in a way they specify, either on a secure cloud or locally, and +they want updates they don't have to do themselves.
  • +
  • Also support 24/7, if the software is of a type which requires it.
  • + +
+
+
+
+
+

+
    +
  • Not only this, but with paying so much, they will often no longer perceive the +software itself as having any inherent value. Instead they want to pay for a +service, and want the service to be personalised and reliable.
  • +
  • Time is money, and with so many small enterprises starting up, a good value +SaaS package is better than a large purchase of Commercial software, or even +unsupported Open Source Software.
  • + +
+
+
+
+
+

+
    +
  • This in fact is what held back Open and Free software for so long in the +business world, if there was no-one to call when it broke, no-one wanted to +use it.
  • +
  • The Software Developer is therefore becoming a service provider if he works in +the commercial world, whether Open Source or not, though Open Source +developers currently have more freedom.
  • +
  • You do not need to create Open Source Software to provide a SaaS package for +it.
  • +
  • It just needs to be a really good one, preferably involving the original +developers in time, or at least contributing to Open Source if you are +succesful.
  • + +
+
+
+
+
+

Current Example

+
    +
  • OpenStack - managed by the The OpenStack Foundation is a specification. It +needn't be Open Source, since they only define what it should do to be OpenStack.
  • +
  • Most implementations of this use do use Open Source technologies to provide SaaS +based solutions. For the most assessable of these, look at Red Hats OpenStack +implementation.
  • +
  • You can use theirs, which is available free via Centos and uses MAAS - Metal +As A Service I don't have time to explain this in detail, since it's a +complex topic.
  • +
  • All kinds of services can be overlaid on MAAS, which abstracts away the +hardware of a cluster.
  • + +
+
+
+
+
+

How should a SaaS product be managed

+
    +
  • If it is your own product, frequent updates. How often depends on the type of +product. Unlike The per unit sale model customers won't be happy with cosmetic +changes only, they will expect substantive changes in response to their +feedback.
  • +
  • If it isn't your product the changes must be to your product support service, +so how can you improve? To justify keeping your customers you will need to +evolve your business.
  • + +
+
+
+
+
+

Managing SaaS Customers

+
    +
  • To give a real world example:
  • +
  • A company I recently dealt with ran what was supposed to be a customer +feedback and support day for SaaS products.
  • +
  • Instead it was a day long sales pitch intended to lock customers into multi +year academic contracts.
  • +
  • Doing business this way simply won't cut it in the future when there are more +competitors.
  • + +
+
+
+
+
+

Customer Budgets

+
    +
  • Customers have less money, not no money, but less. A lean company can do well +if it learns how to do SaaS well.
  • +
  • Create your own SaaS infrastructure yes, market that, but market Open Source +products with it. The difficulty is in the support, not in the software.
  • +
  • There's no reason to think massive companies, SME's Small to Medium +Enterprises can use SaaS too, if it's cheap enough.
  • + +
+
+
+
+
+

What does Stallman think?

+
    +
  • Boy does he has a lot to say, he even has his own term SaaSS Server as a +Software Substitute
  • +
  • Unsurprisingly, no-one else uses this - You can read his full statement here
  • + +
+
+
+
+
+ + + + + + diff --git a/lectures/saas.org b/lectures/saas.org new file mode 100644 index 0000000..dc8183a --- /dev/null +++ b/lectures/saas.org @@ -0,0 +1,110 @@ +# -*- mode: org -*- +#+TITLE: 389COM: Software as a Service (SaaS) +#+AUTHOR: Dr Carey Pridgeon, DR Nazaraf Shah +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:1 num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +# Licenced under Creative Commons Attribution-ShareAlike 4.0 +# International by Dr Carey Pridgeon 2019 +* What is Software as a Service +** Why is it relevant +- The definition. +- The purpose. +- How businesses are reforming around the concept. +** Where did we begin +- Software was, and for small businesses, still is, sold in discrete + units, with success measured in per unit sales. +- Problems with this model: + - Piracy + - You need DRM to control your product - which never works - + - As Microsoft found with Windows, you are often competing against + previous versions of your own product on a new product release. +** Partial solution +- Companies began to sell their software products but sell support as + well to ensure an ongoing income and lock out people who stole their + software. +- This is where Microsoft still are with some of their products. +- In the business world, success is measured by revenue consistency, + not only by large amounts of money coming in occasionally. SaaS therefore has + come to have more appeal over time. +** +- SaaS goes back to before the current IT world existed, it's beginnings can be + traced to the 1960's. +- In short it is software hosted on a centralised computer, delivered to + clients. In the past these would have been /thin/ clients computers able to do + no job other than the task the centralised server sent them, but this is no + longer the case. +** +- Now customers expect their software to be personalised, their data to be + secure, hosted in a way they specify, either on a secure cloud or locally, and + they want updates they don't have to do themselves. +- Also support 24/7, if the software is of a type which requires it. +** +- Not only this, but with paying so much, they will often no longer perceive the + software itself as having any inherent value. Instead they want to pay for a + service, and want the service to be personalised and reliable. +- Time is money, and with so many small enterprises starting up, a good value + SaaS package is better than a large purchase of Commercial software, or even + unsupported Open Source Software. +** +- This in fact is what held back Open and Free software for so long in the + business world, if there was no-one to call when it broke, no-one wanted to + use it. +- The Software Developer is therefore becoming a service provider if he works in + the commercial world, whether Open Source or not, though Open Source + developers currently have more freedom. +- You do not need to create Open Source Software to provide a SaaS package for + it. +- It just needs to be a really good one, preferably involving the original + developers in time, or at least contributing to Open Source if you are + succesful. +** Current Example +- OpenStack - managed by the [[https://www.openstack.org/foundation/][The OpenStack Foundation]] is a specification. It + needn't be Open Source, since they only define what it should do to be OpenStack. +- Most implementations of this use do use Open Source technologies to provide SaaS + based solutions. For the most assessable of these, look at Red Hats OpenStack + implementation. +- You can use theirs, which is available free via Centos and uses [[https://docs.maas.io/1.9/en/installconfig-images][MAAS - Metal + As A Service]] I don't have time to explain this in detail, since it's a + complex topic. +- All kinds of services can be overlaid on MAAS, which abstracts away the + hardware of a cluster. +** How should a SaaS product be managed +- If it is your own product, frequent updates. How often depends on the type of + product. Unlike The per unit sale model customers won't be happy with cosmetic + changes only, they will expect substantive changes in response to their + feedback. +- If it isn't your product the changes must be to your product support service, + so how can you improve? To justify keeping your customers you will need to + evolve your business. +** Managing SaaS Customers +- To give a real world example: +- A company I recently dealt with ran what was supposed to be a customer + feedback and support day for SaaS products. +- Instead it was a day long sales pitch intended to lock customers into multi + year academic contracts. +- Doing business this way simply won't cut it in the future when there are more + competitors. +** Customer Budgets +- Customers have less money, not no money, but less. A lean company can do well + if it learns how to do SaaS well. +- Create your own SaaS infrastructure yes, market that, but market Open Source + products with it. The difficulty is in the support, not in the software. +- There's no reason to think massive companies, SME's /Small to Medium + Enterprises/ can use SaaS too, if it's cheap enough. +** What does Stallman think? +- Boy does he has a lot to say, he even has his own term SaaSS /Server as a + Software Substitute/ +- Unsurprisingly, no-one else uses this - You can read his full statement [[https://www.gnu.org/philosophy/who-does-that-server-really-serve.en.html][here]] + diff --git a/lectures/version_control.html b/lectures/version_control.html new file mode 100644 index 0000000..717aed3 --- /dev/null +++ b/lectures/version_control.html @@ -0,0 +1,414 @@ + + + + +389COM: Version Control + + + + + + + + + + + + +
+
+

389COM: Version Control

Dr Carey Pridgeon, Dr Nazaraf Shah

Created: 2019-10-30 Wed 12:05

+
+
+
+

Table of Contents

+ +
+
+
+
+

Version Control

+
    +
  • Version control in all its incarnations exists to allow you to track changes +in your source code, so if you make a change you want to revert, you can do +so.
  • +
  • It has existed in many forms for quite a while, and has evolved in complexity, +so right now there are several different classes of version control in use.
  • +
  • It came into existence because companies were losing code when hardware failed +or was mistakenly discarded, and the losses from this began to mount +significantly.
  • +
  • There are two classes of version control available, they do the same basic +job, but do it in different ways.
  • + +
+
+
+
+
+

Centralised

+
    +
  • SVN Apache Subversion, first released 20 October 2000
  • +
  • All changes are stored in the repository. Your local copy is the +current version only.
  • +
  • Since you only store the current version locally, working on the +same codebase from multiple machines means you introduce conflicts +very easily.
  • +
  • Dropbox's version history takes broadly the same approach as SVN, but much improved.
  • + +
+
+
+
+
+

+
    +
  • Sharing a single repository between multiple developers can be done, +but it is very easy to break things.
  • +
  • When multiple developers use an SVN stored codebase, problems are introduced so +easily you'll often find individual develops storing local copies separately.
  • +
  • Conflicted files are downloaded and timestamped in the filename to +allow you to manually merge to get the file you wanted.
  • +
  • Centralised Version Control isn't really relevant for programming +any more, the only real benefit is that you have a version history.
  • + +
+
+
+
+
+

Decentralised

+
    +
  • Git and Mercurial
  • +
  • Git was written in 2005, when Linux was no longer allowed to use Bitkeeper, a +commercial version control system.
  • +
  • Mercurial was written at around the same time Git was, and for more or less +the same reasons. Thus they are nearly identical in functionality
  • +
  • With both of these there is a central repository, as with +SVN, only not as basic.
  • +
  • Unlike SVN, each developer has their own complete local copy of the entire +codebase, including a full repository history and all branches.
  • + +
+
+
+
+
+

+
    +
  • (Git has the option of only downloading a partial history, Mercurial does not).
  • +
  • Code changes are committed locally first, then the changed portions in the +local repository are pushed (uploaded) to the central repository.
  • +
  • Commits slot into a tree of versions, unlike SVN it is trivially +easy to maintain different versions within the same repository.
  • +
  • You can perform many local commits without pushing them upstream to the global +(online) repository if you want.
  • +
  • Unless you are the only person committing to a codebase this isn't recommended.
  • + +
+
+
+
+
+

How Decentralised Version Control Works

+
    +
  • Revision history for Git and Mercurial is COW Copy On Write based.
  • +
  • When a change is made to a tracked file (a file that is being +managed by version control), a changeset is stored.
  • +
  • Changesets can be applied to turn one version of a file into the one +the changeset represents.
  • +
  • Successive file versions are chains of these Changesets.
  • + +
+
+
+
+
+

Revision History

+
    +
  • Occasionally instead of changesets a new whole file is stored, if +there are enough differences to make this worthwhile.
  • +
  • Every change has a unique id, so it can be referred to later.
  • +
  • Instead of replacing entire files or groups of files, you can apply +a patch that will only update the relevant files.
  • +
  • while both Git and Mercurial do basically the same thing, there is +still a fairly lively 'Emacs vs Vi' style type debate over which +does it better.
  • + +
+
+
+
+
+

+
    +
  • Mozilla use Mercurial primarily, but mirror that repository to git for +read only access or easy forking.
  • +
  • As previously mentioned, Mercurial requires all the history be checked out, +Git has the option not to.
  • +
  • When you checkout the Mozilla codebase you will see why this is an +issue for some people. If you didn't notice, it takes a long time.
  • + +
+
+
+
+
+

Conflict Resolution

+
    +
  • Since multiple developers can be editing the same file, conflicts +can emerge.
  • +
  • Git and Mercurial will let you commit any file locally.
  • +
  • If however that file will cause a conflict on the main (shared) +repository, it won't let you push it there.
  • + +
+
+
+
+
+

+
    +
  • This way problems only exist locally, you won't break other +developers code by making an unexpected change.
  • +
  • The solution to a code conflict is usually to get (pull down) the +committed file your local file conflicts with, edit in your changes, +then commit and push the fixed file.
  • + +
+
+
+
+
+

+
    +
  • The easiest way to minimise this is to always pull down the latest +copy of the code before working on it. The more you keep your code +in sync, the fewer problem you will have.
  • +
  • If conflicts are very likely because you are working on a major +change, the best thing is to create a new branch and work in +that. (more on Branches in a bit).
  • + +
+
+
+
+
+

Tagging

+
    +
  • A Tag marks a milestone in development, this can be a release, or a +point when the design is changed.
  • +
  • Tags mean the code state at that point can be downloaded later.
  • +
  • Create a tag - git tag v1 -m tag_message
  • + +
+
+
+
+
+

Branching

+
    +
  • A branch in Git is simply a lightweight movable pointer to the head +of a commit chain, of which you can have several.
  • +
  • Branching splits the code into two streams for parallel +development/testing. You commit to a specified stream without +effecting the other. This is used for patching or trying a new idea +that might break your code.
  • + +
+ +
+

branch.png +

+
+ +
+
+
+
+

+
    +
  • Create a new branch git branch branchname.
  • +
  • Switch to that branch (or back to another) git checkout branchname
  • +
  • Or you can combine these git checkout -b branchname
  • +
  • Pushing the local branch upstream to your repository.
  • +
  • git push origin branchname
  • +
  • The disparate branches can be merged later if you want.
  • + +
+
+
+
+
+

Forking

+
    +
  • Forking is just like cloning, except you don't commit to the same +upstream repository.
  • +
  • You can see the current upstream repository url by typing git remote -v
  • +
  • Change the upstream repository with the command git remote set-url origin new_url
  • +
  • Any subsequent commits are in your repository/fork, not the original.
  • +
  • Gitlab et al make forking really easy.
  • + +
+
+
+
+
+

Submodules

+
    +
  • Code in one git project can be made part of another via the submodule feature
  • +
  • Submodules are always pointed at a specific commit in the other +another codebase.
  • +
  • This avoids subsequent changes in that codebase breaking your program.
  • +
  • To update a submodule you have to specify a new pull point (head or some specific commit).
  • + +
+
+
+
+
+

Patches

+
    +
  • Patches are diff files that let git/Mercurial write file changes to +your repository
  • +
  • Patches should always be applied to a branch of the main project.
  • +
  • You create the branch, apply the Patch, test the result, and..
  • +
  • Either you merge the branch back in or discard it if the patch didn't work.
  • +
  • So, you can test a change without risking your code.
  • + +
+
+
+
+
+

Good Practice

+
    +
  • Commit/push often.
  • +
  • Use the features available to track progress.
  • +
  • Test on each commit using Continuous Integration.
  • +
  • Use tags whenever you are about to make some major change or set a +release version.
  • + +
+
+
+
+
+

Continuous Integration

+
    +
  • CI Builds you code at each commit, runs your tests and shows you the results.
  • +
  • CI helps you catch errors as they are introduced into your codebase.
  • +
  • It is pointless without some form of embedded testing (compiles != works after +all).
  • + +
+
+
+
+
+

+
    +
  • There are multiple CI platforms - Travis and Jenkins being examples.
  • +
  • Gitlab is the only free Git hosting service I know to have it's own +system, and it is really easy to use.
  • +
  • The worksheet associated with this module includes a section where +you set up rather basic Gitlab CI on a project.
  • + +
+
+
+
+
+

Other things CI Can Do

+
    +
  • You can Lint your code.
  • +
  • Acceptance Testing (how close is your code to the customers requirements, or +the goals you've set for your project?).
  • +
  • Performance testing (requires a local CI instance on a dedicated machine).
  • + +
+
+
+
+
+

Obligatory XKCD

+ +
+

git.png +

+
+
    +
  • Copyright: Randall Munroe - XKCD
  • +
  • Mirrored in my hosting to avoid bandwidth stealing
  • + +
+
+
+
+
+

Licence for this work

+
    +
  • Licenced under Creative Commons Attribution-ShareAlike 4.0 +International by Dr Carey Pridgeon 2016
  • +
  • (Licence does not cover linked images owned by other content creators)
  • + +
+
+
+
+
+ + + + + + diff --git a/lectures/version_control.html~ b/lectures/version_control.html~ new file mode 100644 index 0000000..2a6e00b --- /dev/null +++ b/lectures/version_control.html~ @@ -0,0 +1,414 @@ + + + + +389COM: Version Control + + + + + + + + + + + + +
+
+

389COM: Version Control

Dr Carey Pridgeon, Dr Nazaraf Shah

Created: 2019-10-30 Wed 11:59

+
+
+
+

Table of Contents

+ +
+
+
+
+

Version Control

+
    +
  • Version control in all its incarnations exists to allow you to track changes +in your source code, so if you make a change you want to revert, you can do +so.
  • +
  • It has existed in many forms for quite a while, and has evolved in complexity, +so right now there are several different classes of version control in use.
  • +
  • It came into existence because companies were losing code when hardware failed +or was mistakenly discarded, and the losses from this began to mount +significantly.
  • +
  • There are two classes of version control available, they do the same basic +job, but do it in different ways.
  • + +
+
+
+
+
+

Centralised

+
    +
  • SVN Apache Subversion, first released 20 October 2000
  • +
  • All changes are stored in the repository. Your local copy is the +current version only.
  • +
  • Since you only store the current version locally, working on the +same codebase from multiple machines means you introduce conflicts +very easily.
  • +
  • Dropbox's version history takes broadly the same approach as SVN, but much improved.
  • + +
+
+
+
+
+

+
    +
  • Sharing a single repository between multiple developers can be done, +but it is very easy to break things.
  • +
  • When multiple developers use an SVN stored codebase, problems are introduced so +easily you'll often find individual develops storing local copies separately.
  • +
  • Conflicted files are downloaded and timestamped in the filename to +allow you to manually merge to get the file you wanted.
  • +
  • Centralised Version Control isn't really relevant for programming +any more, the only real benefit is that you have a version history.
  • + +
+
+
+
+
+

Decentralised

+
    +
  • Git and Mercurial
  • +
  • Git was written in 2005, when Linux was no longer allowed to use Bitkeeper, a +commercial version control system.
  • +
  • Mercurial was written at around the same time Git was, and for more or less +the same reasons. Thus they are nearly identical in functionality
  • +
  • With both of these there is a central repository, as with +SVN, only not as basic.
  • +
  • Unlike SVN, each developer has their own complete local copy of the entire +codebase, including a full repository history and all branches.
  • + +
+
+
+
+
+

+
    +
  • (Git has the option of only downloading a partial history, Mercurial does not).
  • +
  • Code changes are committed locally first, then the changed portions in the +local repository are pushed (uploaded) to the central repository.
  • +
  • Commits slot into a tree of versions, unlike SVN it is trivially +easy to maintain different versions within the same repository.
  • +
  • You can perform many local commits without pushing them upstream to the global +(online) repository if you want.
  • +
  • Unless you are the only person committing to a codebase this isn't recommended.
  • + +
+
+
+
+
+

How Decentralised Version Control Works

+
    +
  • Revision history for Git and Mercurial is COW Copy On Write based.
  • +
  • When a change is made to a tracked file (a file that is being +managed by version control), a changeset is stored.
  • +
  • Changesets can be applied to turn one version of a file into the one +the changeset represents.
  • +
  • Successive file versions are chains of these Changesets.
  • + +
+
+
+
+
+

Revision History

+
    +
  • Occasionally instead of changesets a new whole file is stored, if +there are enough differences to make this worthwhile.
  • +
  • Every change has a unique id, so it can be referred to later.
  • +
  • Instead of replacing entire files or groups of files, you can apply +a patch that will only update the relevant files.
  • +
  • while both Git and Mercurial do basically the same thing, there is +still a fairly lively 'Emacs vs Vi' style type debate over which +does it better.
  • + +
+
+
+
+
+

+
    +
  • Mozilla use Mercurial primarily, but mirror that repository to git for +read only access or easy forking.
  • +
  • As previously mentioned, Mercurial requires all the history be checked out, +Git has the option not to.
  • +
  • When you checkout the Mozilla codebase you will see why this is an +issue for some people. If you didn't notice, it takes a long time.
  • + +
+
+
+
+
+

Conflict Resolution

+
    +
  • Since multiple developers can be editing the same file, conflicts +can emerge.
  • +
  • Git and Mercurial will let you commit any file locally.
  • +
  • If however that file will cause a conflict on the main (shared) +repository, it won't let you push it there.
  • + +
+
+
+
+
+

Conflict Resolution

+
    +
  • This way problems only exist locally, you won't break other +developers code by making an unexpected change.
  • +
  • The solution to a code conflict is usually to get (pull down) the +committed file your local file conflicts with, edit in your changes, +then commit and push the fixed file.
  • + +
+
+
+
+
+

Conflict Resolution

+
    +
  • The easiest way to minimise this is to always pull down the latest +copy of the code before working on it. The more you keep your code +in sync, the fewer problem you will have.
  • +
  • If conflicts are very likely because you are working on a major +change, the best thing is to create a new branch and work in +that. (more on Branches in a bit).
  • + +
+
+
+
+
+

Tagging

+
    +
  • A Tag marks a milestone in development, this can be a release, or a +point when the design is changed.
  • +
  • Tags mean the code state at that point can be downloaded later.
  • +
  • Create a tag - git tag v1 -m tag_message
  • + +
+
+
+
+
+

Branching

+
    +
  • A branch in Git is simply a lightweight movable pointer to the head +of a commit chain, of which you can have several.
  • +
  • Branching splits the code into two streams for parallel +development/testing. You commit to a specified stream without +effecting the other. This is used for patching or trying a new idea +that might break your code.
  • + +
+ +
+

branch.png +

+
+ +
+
+
+
+

+
    +
  • Create a new branch git branch branchname.
  • +
  • Switch to that branch (or back to another) git checkout branchname
  • +
  • Or you can combine these git checkout -b branchname
  • +
  • Pushing the local branch upstream to your repository.
  • +
  • git push origin branchname
  • +
  • The disparate branches can be merged later if you want.
  • + +
+
+
+
+
+

Forking

+
    +
  • Forking is just like cloning, except you don't commit to the same +upstream repository.
  • +
  • You can see the current upstream repository url by typing git remote -v
  • +
  • Change the upstream repository with the command git remote set-url origin new_url
  • +
  • Any subsequent commits are in your repository/fork, not the original.
  • +
  • Gitlab et al make forking really easy.
  • + +
+
+
+
+
+

Submodules

+
    +
  • Code in one git project can be made part of another via the submodule feature
  • +
  • Submodules are always pointed at a specific commit in the other +another codebase.
  • +
  • This avoids subsequent changes in that codebase breaking your program.
  • +
  • To update a submodule you have to specify a new pull point (head or some specific commit).
  • + +
+
+
+
+
+

Patches

+
    +
  • Patches are diff files that let git/Mercurial write file changes to +your repository
  • +
  • Patches should always be applied to a branch of the main project.
  • +
  • You create the branch, apply the Patch, test the result, and..
  • +
  • Either you merge the branch back in or discard it if the patch didn't work.
  • +
  • So, you can test a change without risking your code.
  • + +
+
+
+
+
+

Good Practice

+
    +
  • Commit often.
  • +
  • Use the features available to track progress.
  • +
  • Test on each commit using Continuous Integration.
  • +
  • Use tags whenever you are about to make some major change or set a +release version.
  • + +
+
+
+
+
+

Continuous Integration

+
    +
  • CI Builds you code at each commit, runs your tests and shows you the results.
  • +
  • CI helps you catch errors as they are introduced into your codebase.
  • +
  • It is pointless without some form of embedded testing (compiles != works after +all).
  • + +
+
+
+
+
+

+
    +
  • There are multiple CI platforms - Travis and Jenkins being examples.
  • +
  • Gitlab is the only free Git hosting service I know to have it's own +system, and it is really easy to use.
  • +
  • The worksheet associated with this module includes a section where +you set up rather basic Gitlab CI on a project.
  • + +
+
+
+
+
+

Other things CI Can Do

+
    +
  • You can Lint your code.
  • +
  • Acceptance Testing (how close is your code to the customers requirements, or +the goals you've set for your project?).
  • +
  • Performance testing (requires a local CI instance on a dedicated machine).
  • + +
+
+
+
+
+

Obligatory XKCD

+ +
+

git.png +

+
+
    +
  • Copyright: Randall Munroe - XKCD
  • +
  • Mirrored in my hosting to avoid bandwidth stealing
  • + +
+
+
+
+
+

Licence for this work

+
    +
  • Licenced under Creative Commons Attribution-ShareAlike 4.0 +International by Dr Carey Pridgeon 2016
  • +
  • (Licence does not cover linked images owned by other content creators)
  • + +
+
+
+
+
+ + + + + + diff --git a/lectures/version_control.org b/lectures/version_control.org new file mode 100644 index 0000000..cd083ee --- /dev/null +++ b/lectures/version_control.org @@ -0,0 +1,190 @@ +# -*- mode: org -*- +#+TITLE: 389COM: Version Control +#+AUTHOR: Dr Carey Pridgeon, Dr Nazaraf Shah +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:1 num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +# Licenced under Creative Commons Attribution-ShareAlike 4.0 +# International by Dr Carey Pridgeon 2019 +#+BEAMER_HEADER: \institute[Coventry Uni]{Coventry University\\\url{http://www.coventry.ac.uk}} + +* Version Control +- Version control in all its incarnations exists to allow you to track changes + in your source code, so if you make a change you want to revert, you can do + so. +- It has existed in many forms for quite a while, and has evolved in complexity, + so right now there are several different classes of version control in use. +- It came into existence because companies were losing code when hardware failed + or was mistakenly discarded, and the losses from this began to mount + significantly. +- There are two classes of version control available, they do the same basic + job, but do it in different ways. +** Centralised +- SVN /Apache Subversion/, first released 20 October 2000 +- All changes are stored in the repository. Your local copy is the + current version only. +- Since you only store the current version locally, working on the + same codebase from multiple machines means you introduce conflicts + very easily. +- Dropbox's version history takes broadly the same approach as SVN, but much improved. +** +- Sharing a single repository between multiple developers can be done, + but it is very easy to break things. +- When multiple developers use an SVN stored codebase, problems are introduced so + easily you'll often find individual develops storing local copies separately. +- Conflicted files are downloaded and timestamped in the filename to + allow you to manually merge to get the file you wanted. +- Centralised Version Control isn't really relevant for programming + any more, the only real benefit is that you have a version history. +** Decentralised +- [[https://git-scm.com/][Git]] and [[https://www.mercurial-scm.org/][Mercurial]] +- Git was written in 2005, when Linux was no longer allowed to use Bitkeeper, a + commercial version control system. +- Mercurial was written at around the same time Git was, and for more or less + the same reasons. Thus they are nearly identical in functionality +- With both of these there is a central repository, as with + SVN, only not as basic. +- Unlike SVN, each developer has their own complete local copy of the entire + codebase, including a full repository history and all branches. +** +- (Git has the option of only downloading a partial history, Mercurial does not). +- Code changes are committed locally first, then the changed portions in the + local repository are pushed (uploaded) to the central repository. +- Commits slot into a tree of versions, unlike SVN it is trivially + easy to maintain different versions within the same repository. +- You can perform many local commits without pushing them upstream to the global + (online) repository if you want. +- Unless you are the only person committing to a codebase this isn't recommended. +** How Decentralised Version Control Works +- Revision history for Git and Mercurial is *COW* /Copy On Write/ based. +- When a change is made to a tracked file (a file that is being + managed by version control), a changeset is stored. +- Changesets can be applied to turn one version of a file into the one + the changeset represents. +- Successive file /versions/ are chains of these Changesets. +** Revision History +- Occasionally instead of changesets a new whole file is stored, if + there are enough differences to make this worthwhile. +- Every change has a unique id, so it can be referred to later. +- Instead of replacing entire files or groups of files, you can apply + a patch that will only update the relevant files. +- while both Git and Mercurial do basically the same thing, there is + still a fairly lively 'Emacs vs Vi' style type debate over which + does it better. +** +- Mozilla use Mercurial primarily, but mirror that repository to git for + read only access or easy forking. +- As previously mentioned, Mercurial requires all the history be checked out, + Git has the option not to. +- When you checkout the Mozilla codebase you will see why this is an + issue for some people. If you didn't notice, it takes a long time. +** Conflict Resolution +- Since multiple developers can be editing the same file, conflicts + can emerge. +- Git and Mercurial will let you commit any file locally. +- If however that file will cause a conflict on the main (shared) + repository, it won't let you push it there. +** +- This way problems only exist locally, you won't break other + developers code by making an unexpected change. +- The solution to a code conflict is usually to get (pull down) the + committed file your local file conflicts with, edit in your changes, + then commit and push the fixed file. +** +- The easiest way to minimise this is to always pull down the latest + copy of the code before working on it. The more you keep your code + in sync, the fewer problem you will have. +- If conflicts are very likely because you are working on a major + change, the best thing is to create a new branch and work in + that. (more on Branches in a bit). +** Tagging +- A Tag marks a milestone in development, this can be a release, or a + point when the design is changed. +- Tags mean the code state at that point can be downloaded later. +- Create a tag - *git tag v1 -m tag_message* +** Branching +- A branch in Git is simply a lightweight movable pointer to the head + of a commit chain, of which you can have several. +- Branching splits the code into two streams for parallel + development/testing. You commit to a specified stream without + effecting the other. This is used for patching or trying a new idea + that might break your code. + #+begin_src ditaa :file img/branch.png + /---------------------------------------\ /----------------------\ + | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -->| Master Branch pointer| + \---------------------------------------/ \----------------------/ + | + | /----------------\ /----------------------\ + +->| 8b | 9b | 10b | -->| Other Branch Pointer | + \----------------/ \----------------------/ +#+end_src +#+RESULTS: + +** +- Create a new branch *git branch branchname*. +- Switch to that branch (or back to another) *git checkout branchname* +- Or you can combine these *git checkout -b branchname* +- Pushing the local branch upstream to your repository. +- *git push origin branchname* +- The disparate branches can be merged later if you want. +** Forking +- Forking is just like cloning, except you don't commit to the same + upstream repository. +- You can see the current upstream repository url by typing *git remote -v* +- Change the upstream repository with the command *git remote set-url origin new_url* +- Any subsequent commits are in your repository/fork, not the original. +- Gitlab et al make forking really easy. +** Submodules +- Code in one git project can be made part of another via the submodule feature +- Submodules are always pointed at a specific commit in the other + another codebase. +- This avoids subsequent changes in that codebase breaking your program. +- To update a submodule you have to specify a new pull point (head or some specific commit). +** Patches +- Patches are diff files that let git/Mercurial write file changes to + your repository +- Patches should always be applied to a branch of the main project. +- You create the branch, apply the Patch, test the result, and.. +- Either you merge the branch back in or discard it if the patch didn't work. +- So, you can test a change without risking your code. +** Good Practice +- Commit/push often. +- Use the features available to track progress. +- Test on each commit using Continuous Integration. +- Use tags whenever you are about to make some major change or set a + release version. +** Continuous Integration +- CI Builds you code at each commit, runs your tests and shows you the results. +- CI helps you catch errors as they are introduced into your codebase. +- It is pointless without some form of embedded testing (compiles != works after + all). +** +- There are multiple CI platforms - Travis and Jenkins being examples. +- Gitlab is the only free Git hosting service I know to have it's own + system, and it is really easy to use. +- The worksheet associated with this module includes a section where + you set up rather basic Gitlab CI on a project. +** Other things CI Can Do +- You can Lint your code. +- Acceptance Testing (how close is your code to the customers requirements, or + the goals you've set for your project?). +- Performance testing (requires a local CI instance on a dedicated machine). +** Obligatory XKCD +[[file:img/git.png]] +- Copyright: Randall Munroe - XKCD +- Mirrored in my hosting to avoid bandwidth stealing +** Licence for this work +- Licenced under Creative Commons Attribution-ShareAlike 4.0 + International by Dr Carey Pridgeon 2016 +- (Licence does not cover linked images owned by other content creators) diff --git a/lectures/version_control.org~ b/lectures/version_control.org~ new file mode 100644 index 0000000..e6009c6 --- /dev/null +++ b/lectures/version_control.org~ @@ -0,0 +1,190 @@ +# -*- mode: org -*- +#+TITLE: 389COM: Version Control +#+AUTHOR: Dr Carey Pridgeon, DR Nazaraf Shah +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:1 num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +# Licenced under Creative Commons Attribution-ShareAlike 4.0 +# International by Dr Carey Pridgeon 2019 +#+BEAMER_HEADER: \institute[Coventry Uni]{Coventry University\\\url{http://www.coventry.ac.uk}} + +* Version Control +- Version control in all its incarnations exists to allow you to track changes + in your source code, so if you make a change you want to revert, you can do + so. +- It has existed in many forms for quite a while, and has evolved in complexity, + so right now there are several different classes of version control in use. +- It came into existence because companies were losing code when hardware failed + or was mistakenly discarded, and the losses from this began to mount + significantly. +- There are two classes of version control available, they do the same basic + job, but do it in different ways. +** Centralised +- SVN /Apache Subversion/, first released 20 October 2000 +- All changes are stored in the repository. Your local copy is the + current version only. +- Since you only store the current version locally, working on the + same codebase from multiple machines means you introduce conflicts + very easily. +- Dropbox's version history takes broadly the same approach as SVN, but much improved. +** +- Sharing a single repository between multiple developers can be done, + but it is very easy to break things. +- When multiple developers use an SVN stored codebase, problems are introduced so + easily you'll often find individual develops storing local copies separately. +- Conflicted files are downloaded and timestamped in the filename to + allow you to manually merge to get the file you wanted. +- Centralised Version Control isn't really relevant for programming + any more, the only real benefit is that you have a version history. +** Decentralised +- [[https://git-scm.com/][Git]] and [[https://www.mercurial-scm.org/][Mercurial]] +- Git was written in 2005, when Linux was no longer allowed to use Bitkeeper, a + commercial version control system. +- Mercurial was written at around the same time Git was, and for more or less + the same reasons. Thus they are nearly identical in functionality +- With both of these there is a central repository, as with + SVN, only not as basic. +- Unlike SVN, each developer has their own complete local copy of the entire + codebase, including a full repository history and all branches. +** +- (Git has the option of only downloading a partial history, Mercurial does not). +- Code changes are committed locally first, then the changed portions in the + local repository are pushed (uploaded) to the central repository. +- Commits slot into a tree of versions, unlike SVN it is trivially + easy to maintain different versions within the same repository. +- You can perform many local commits without pushing them upstream to the global + (online) repository if you want. +- Unless you are the only person committing to a codebase this isn't recommended. +** How Decentralised Version Control Works +- Revision history for Git and Mercurial is *COW* /Copy On Write/ based. +- When a change is made to a tracked file (a file that is being + managed by version control), a changeset is stored. +- Changesets can be applied to turn one version of a file into the one + the changeset represents. +- Successive file /versions/ are chains of these Changesets. +** Revision History +- Occasionally instead of changesets a new whole file is stored, if + there are enough differences to make this worthwhile. +- Every change has a unique id, so it can be referred to later. +- Instead of replacing entire files or groups of files, you can apply + a patch that will only update the relevant files. +- while both Git and Mercurial do basically the same thing, there is + still a fairly lively 'Emacs vs Vi' style type debate over which + does it better. +** +- Mozilla use Mercurial primarily, but mirror that repository to git for + read only access or easy forking. +- As previously mentioned, Mercurial requires all the history be checked out, + Git has the option not to. +- When you checkout the Mozilla codebase you will see why this is an + issue for some people. If you didn't notice, it takes a long time. +** Conflict Resolution +- Since multiple developers can be editing the same file, conflicts + can emerge. +- Git and Mercurial will let you commit any file locally. +- If however that file will cause a conflict on the main (shared) + repository, it won't let you push it there. +** Conflict Resolution +- This way problems only exist locally, you won't break other + developers code by making an unexpected change. +- The solution to a code conflict is usually to get (pull down) the + committed file your local file conflicts with, edit in your changes, + then commit and push the fixed file. +** Conflict Resolution +- The easiest way to minimise this is to always pull down the latest + copy of the code before working on it. The more you keep your code + in sync, the fewer problem you will have. +- If conflicts are very likely because you are working on a major + change, the best thing is to create a new branch and work in + that. (more on Branches in a bit). +** Tagging +- A Tag marks a milestone in development, this can be a release, or a + point when the design is changed. +- Tags mean the code state at that point can be downloaded later. +- Create a tag - *git tag v1 -m tag_message* +** Branching +- A branch in Git is simply a lightweight movable pointer to the head + of a commit chain, of which you can have several. +- Branching splits the code into two streams for parallel + development/testing. You commit to a specified stream without + effecting the other. This is used for patching or trying a new idea + that might break your code. + #+begin_src ditaa :file img/branch.png + /---------------------------------------\ /----------------------\ + | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -->| Master Branch pointer| + \---------------------------------------/ \----------------------/ + | + | /----------------\ /----------------------\ + +->| 8b | 9b | 10b | -->| Other Branch Pointer | + \----------------/ \----------------------/ +#+end_src +#+RESULTS: + +** +- Create a new branch *git branch branchname*. +- Switch to that branch (or back to another) *git checkout branchname* +- Or you can combine these *git checkout -b branchname* +- Pushing the local branch upstream to your repository. +- *git push origin branchname* +- The disparate branches can be merged later if you want. +** Forking +- Forking is just like cloning, except you don't commit to the same + upstream repository. +- You can see the current upstream repository url by typing *git remote -v* +- Change the upstream repository with the command *git remote set-url origin new_url* +- Any subsequent commits are in your repository/fork, not the original. +- Gitlab et al make forking really easy. +** Submodules +- Code in one git project can be made part of another via the submodule feature +- Submodules are always pointed at a specific commit in the other + another codebase. +- This avoids subsequent changes in that codebase breaking your program. +- To update a submodule you have to specify a new pull point (head or some specific commit). +** Patches +- Patches are diff files that let git/Mercurial write file changes to + your repository +- Patches should always be applied to a branch of the main project. +- You create the branch, apply the Patch, test the result, and.. +- Either you merge the branch back in or discard it if the patch didn't work. +- So, you can test a change without risking your code. +** Good Practice +- Commit often. +- Use the features available to track progress. +- Test on each commit using Continuous Integration. +- Use tags whenever you are about to make some major change or set a + release version. +** Continuous Integration +- CI Builds you code at each commit, runs your tests and shows you the results. +- CI helps you catch errors as they are introduced into your codebase. +- It is pointless without some form of embedded testing (compiles != works after + all). +** +- There are multiple CI platforms - Travis and Jenkins being examples. +- Gitlab is the only free Git hosting service I know to have it's own + system, and it is really easy to use. +- The worksheet associated with this module includes a section where + you set up rather basic Gitlab CI on a project. +** Other things CI Can Do +- You can Lint your code. +- Acceptance Testing (how close is your code to the customers requirements, or + the goals you've set for your project?). +- Performance testing (requires a local CI instance on a dedicated machine). +** Obligatory XKCD +[[file:img/git.png]] +- Copyright: Randall Munroe - XKCD +- Mirrored in my hosting to avoid bandwidth stealing +** Licence for this work +- Licenced under Creative Commons Attribution-ShareAlike 4.0 + International by Dr Carey Pridgeon 2016 +- (Licence does not cover linked images owned by other content creators)