%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MUW Presentation
% LaTeX Template
% Version 1.0 (27/12/2016)
%
% License:
% CC BY-NC-SA 4.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
% Created by:
% Nicolas Ballarini, CeMSIIS, Medical University of Vienna
% nicoballarini@gmail.com
% http://statistics.msi.meduniwien.ac.at/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[10pt]{beamer} % Change 10pt to make fonts of a different size
\mode<presentation>

\usetheme{MUW}
\usecolortheme{MUW}
\setbeamertemplate{navigation symbols}{} 
\setbeamertemplate{caption}[numbered]
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
% \usetheme[progressbar=frametitle]{metropolis}
\usepackage{appendixnumberbeamer}

\usepackage{booktabs}
\usepackage[scale=2]{ccicons}

% \usepackage{pgfplots}
% \usepgfplotslibrary{dateplot}

\usepackage{xspace}
% \usepackage{minted}
\usepackage{listing}
%\usepackage{tabularx}
% \usepackage{bytefield}

% \usepackage{minted}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% FONTS
%\usefonttheme{serif}  % Uncomment for all serif fonts
%% Comment the following two lines for sans serif fonts in titles
\setbeamerfont{frametitle}{family=\fontfamily{cmr}}
\setbeamerfont{title}{family=\fontfamily{cmr}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Presentation Info
\title[CS-238P]{C - Basic Features \& Pointers}
\author{University of California, Irvine}
% \institute
\date{CS-238P Discussion 2, Fall 2018}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% FOOTLINE
%% Comment/Uncomment the following blocks to modify the footline
%% content in the body slides. 


%% Option A: Title and institute
%\footlineA
%% Option B: Author and institute
%\footlineB
%% Option C: Title, Author and institute
%\footlineC
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Use this block for a blue title slide with modified footline
% {\titlepageBlue
% \begin{frame}
%   \titlepage
% \end{frame}
% }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Use this block for a white title slide with modified footline
{\titlepageWhite
\begin{frame}
  \titlepage
\end{frame}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Comment/Uncomment these lines for an automatically generated outline.
% \begin{frame}{Outline}
%   \tableofcontents
% \end{frame}


\addtocounter{framenumber}{-1} %To control the number in which numbering begins

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{Introduction}
% \begin{frame}{Introduction}
% \begin{itemize}
%   \item Your introduction goes here!
%   \item Use \texttt{itemize} to organize your main points.
%   \begin{itemize}
%   	\item up to 3 text levels with \texttt{itemize}
% 	\begin{itemize}
%   	  	\item Indents increase level by level, font size decreases
% 		\begin{description}[abc]  % for indentation of length of abc
%   			\item[$\bullet$] Should you require more levels, use \texttt{description} instead of \texttt{itemize}.
%         	\begin{description}[abc]  % for indentation of length of abc
%   				\item[$\bullet$] Note: Please try not to write too much copy onto your slides.
% 			\end{description}
% 		\end{description}
% 	\end{itemize}
%   \end{itemize}
% \end{itemize}

% \end{frame}

% \iffalse
% \begin{frame}{Data types}
% 	\begin{itemize}
% 	\item char (1 byte)
% 	\item int, long (4/8 bytes)
% 	\item float, double
% 	\end{itemize}
% 	\end{frame}
	
% 	\begin{frame}{Loops}
% 	\begin{itemize}
% 	\item \texttt{for}
% 	\item \texttt{do...while}
% 	\item \texttt{while}
% 	\end{itemize}
% 	\end{frame}
% 	\fi
	
% 	\begin{frame}[fragile]{Hw1(xv6 shell)}
% 	\begin{itemize}
% 	\item<1-> \texttt{if...else}
% 	\begin{minted}{c}
% 		pid = fork();
% 		if(pid == -1)
% 			perror("fork:");
% 	\end{minted}
% 	\item<2-> \texttt{switch...case}
% 	\begin{minted}{c}
% 		switch(cmd->type){
% 		case '>': ...; break;
% 		default: ...; break;
% 		}
% 	\end{minted}
% 	\item<3-> Functions
% 	\begin{itemize}
% 	\item Process creation (\texttt{fork, exec})
% 	\item File I/O (\texttt{open, close, read, write})
% 	\begin{minted}{c}
% 	fd = open(rcmd->file, rcmd->mode);
% 	\end{minted}
% 	\end{itemize}
% 	\item<4-> Typecasting (next slide)
% 	\item<5-> Command line arguments (\texttt{argv})
% 	\end{itemize}
% 	\end{frame}
	
% 	\begin{frame}[fragile]{Typecasting}
% 	\begin{itemize}
% 	\item<1-> Change the type of the object for a single operation
% 	\begin{minted}{c}
% 		var = (dest_type) source;
% 	\end{minted}
% 	\item<2-> Pass generic objects
% 	\begin{minted}{c}
% 	struct cmd { int type; };
% 	struct execcmd {
% 		int type;
% 		char *argv[MAXARGS];
% 	};
% 	void runcmd(struct cmd *cmd) {
% 			...
% 			ecmd = (struct execcmd*)cmd;
% 	}
% 	struct cmd* execcmd(void) {
% 		struct execcmd *cmd;
% 		...
% 		return (struct cmd*)cmd;
% 	}
% 	\end{minted}
% 	\item<3-> Beware of strings! (demo: str.c)
% 	\end{itemize}
% 	\end{frame}
	
% 	\begin{frame}[fragile]{Arrays}
% 	\begin{itemize}
% 	\item<1-> Collection of objects of the same data type
% 	\item<2-> Accessed by index (\texttt{0 ... size - 1})
% 	\item<3-> String is an array of characters (demo: string.c)
% 	\item<4-> No reference operator
% 	\begin{minted}{c}
% 	printf("Address of a \%p | \%p\n", a, &a);
% 	>> Address of a 0x7aff07024060 | 0x7aff07024060
% 	\end{minted}
% 	\end{itemize}
% 	\end{frame}
	
% 	\begin{frame}[fragile]{Array Intialization}
% 	Designated Initializers\footnote{http://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/Designated-Inits.html}
% 	\begin{minted}{c}
% 	#define CAPSLOCK (1<<3)
% 	#define NUMLOCK (1<<4)
% 	#define SCROLLLOCK (1<<5)
% 	static uchar togglecode[256] = {
% 	[0x3A] CAPSLOCK,
% 	[0x45] NUMLOCK,
% 	[0x46] SCROLLLOCK
% 	};
% 	/* equivalent to */
% 	togglecode[0x3A] = CAPSLOCK;
% 	togglecode[0x45] = NUMLOCK;
% 	togglecode[0x46] = SCROLLLOCK;
% 	\end{minted}
% 	Initialize the array elements 0x3A, 0x45, 0x46 only~\footnote{sheet 77, xv6-rev9.pdf}
% 	\end{frame}
	
% 	\begin{frame}[fragile=singleslide]{Bit fields\footnote{sheet 09 xv6-rev9.pdf}}
% 	\begin{minted}{c}
% 	// Gate descriptors for interrupts and traps
% 	struct gatedesc {
% 		uint off_15_0 : 16; // low 16 bits of offset in segment
% 		uint cs : 16; // code segment selector
% 		uint args : 5; // # args, 0 for interrupt/trap gates
% 		uint rsv1 : 3; // reserved(should be zero I guess)
% 		uint type : 4; // type(STS_{TG,IG32,TG32})
% 		uint s : 1; // must be 0 (system)
% 		uint dpl : 2; // descriptor(meaning new) privilege level
% 		uint p : 1; // Present
% 		uint off_31_16 : 16; // high bits of offset in segment
% 	};
	
% 	struct gatedesc d;
% 	d.s = 0; d.args = 0;
% 	\end{minted}
% 	\end{frame}
	
% 	\begin{frame}[fragile]{Access low-level data}
% 	\begin{bytefield}[endianness=little,bitwidth=1em]{32}
% 	\bitheader[lsb=32]{32,36,37,39,40,43,44,45,46,47,48,63} \\
% 	\bitbox{5}{args} & \bitbox{3}{rsvd} & \bitbox{4}{type} & \bitbox{1}{\textcolor{red}{s}} & \bitbox{2}{dpl} & \bitbox{1}{p} & \bitbox{16}{offset high} \\ [3ex]
% 	\bitheader{0,15,16,31} \\
% 	\bitbox{16}{offset} & \bitbox{16}{segment} \\
% 	\end{bytefield}
% 	\begin{itemize}
% 	\item<2-> Set bit 44 (s) - Or ($|$) it
% 	\begin{minted}{c}
% 	/* on a 64-bit data type */
% 	data = data | (1 << 44);
% 	data |= (1 << 44);
% 	\end{minted}
% 	\item<3-> Clear a bit (s) - And ($\&$) and Not ($\sim$) 
% 	\begin{minted}{c}
% 	/* on a 64-bit data type */
% 	data = data & ~(1 << 44);
% 	data &= ~(1 << 44);
% 	\end{minted}
% 	\end{itemize}
% 	\end{frame}
	
% 	\begin{frame}[fragile]{Dynamic registration}
% 	\small
% 	\begin{itemize}
% 	\item<1-> Declare a struct to hold function pointers~\footnote{sheet 40 xv6-rev9.pdf}
% 	\begin{minted}[fontsize=\footnotesize]{c}
% 	#define NDEV  10
% 	#define CONSOLE 1
% 	struct devsw {
% 		int (*read)(struct inode*, char*, int);
% 		int (*write)(struct inode*, char*, int);
% 	};
% 	struct devsw devsw[NDEV]; /* global data structure */
% 	\end{minted}
% 	\item<2-> Register function pointer~\footnote{sheet 82 xv6-rev9.pdf}
% 	\begin{minted}{c}
% 	int consolewrite(struct inode *ip, char *buf, int n);
% 	int consoleread(struct inode *ip, char *dst, int n);
% 	devsw[CONSOLE].write = consolewrite;
% 	devsw[CONSOLE].read = consoleread;
% 	\end{minted}
% 	\end{itemize}
% 	\end{frame}
\section{Section 1}
{
	% \begin{frame}[fragile]{Pointers \& buffer management}
	\begin{frame}[fragile]{Pointers \& buffer management}

		\begin{lstlisting}
			#define KERNBASE 0x80000000

			#define P2V(a) (((void *) (a)) + KERNBASE)

			uchar *code;
			
			code = P2V(0x7000);
		\end{lstlisting}

	\begin{itemize}
	\item<1-> Access raw memory
	% \begin{minted}{c}
		
	% \end{minted}
	% \item<2-> kalloc, memset, kfree
	% \begin{minted}{c}
	% mem = kalloc(); /* allocate a page */
	% memset(mem, 0, PGSIZE); /* memset */
	% kfree(mem); /* free it when done */
	% \end{minted}
	% \item<3-> memcpy, memmove
	% \begin{minted}{c}
	% /* move start to code */
	% memmove(code, _binary_entryother_start,
	% 			(uint)_binary_entryother_size);
	% \end{minted}
	\end{itemize}
	\end{frame}
	% }
}	
	

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Section 1}
{\sectionheaderWhite %Enclose the frame with {} and add this command for white background in section header
\begin{frame}{Section Header 1}{Version - white background}
\end{frame}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Section 2}
{\sectionheaderSkin %Enclose the frame with {} and add this command for skin background in section header
\begin{frame}{Section Header 2}{Version - backgroundcolour skin}
\end{frame}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Section 3}
{\sectionheaderGreen %Enclose the frame with {} and add this command for green background in section header
\begin{frame}{Section Header 3}{Version - backgroundcolour green}
\end{frame}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Content}
% Slide with black Background
{\blackSlide %Enclose the frame with {} and add this command for black background in frame
\begin{frame}{Title and Content - Black}
\begin{columns}
  \begin{column}{0.3\textwidth}
    \begin{center}
     \includegraphics[width=0.8\textwidth]{Images/xray.png}
     \end{center}
  \end{column}
  \begin{column}{0.7\textwidth}  %%<--- here
    \begin{itemize}
	  \item Especially for big pictures like x-ray
	  \item Enter explanation text - e.g. what can be seen in the picture
	\end{itemize}
  \end{column}
\end{columns}

\end{frame}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{Title, subtitle and content}{Enter subtitle here}
Enter text, charts, pictures, … here
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Figures}
\begin{frame}{Figures}

\begin{itemize}
  \item You can upload a figure (JPEG, PNG or PDF) using the files menu. 
  \item To include it in your document, use the \texttt{includegraphics} command (see the comment below in the source code).
\end{itemize}

% Commands to include a figure:
\begin{figure}
  \includegraphics[width=0.5\textwidth]{Images/image.png}
  \caption{\label{fig:your-figure}Caption goes here.}
\end{figure}

\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Chart}
\begin{frame}{Sample Chart}
Insert charts as images
\begin{figure}
	\centering
	\includegraphics[width=0.75\textwidth]{Images/chart.png}
    \caption{Caption}
\end{figure}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]{Two Columns} %use [t] after \begin{frame} to top alignment
\begin{columns}
  \begin{column}{0.5\textwidth}
    \begin{itemize}
	  \item Left column for content
	  \begin{itemize}
	  	\item Can contain text, charts, pictures, … 
		\end{itemize}
	\end{itemize}
  \end{column}
  \begin{column}{0.5\textwidth}  %%<--- here
    \begin{itemize}
	  \item Right column for content
	  \begin{itemize}
	  	\item Can contain text, charts, pictures, … 
		\end{itemize}
	\end{itemize}
  \end{column}
\end{columns}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]{Comparison} %use [t] after \begin{frame} to top alignment
\begin{columns}
  \begin{column}{0.5\textwidth}
  	{\large \textcolor{hellblauMUW}{Headline for left column}}
    \begin{itemize}
	  \item Left column for content
	  \begin{itemize}
	  	\item Can contain text, charts, pictures, … 
		\end{itemize}
	\end{itemize}
  \end{column}
  \begin{column}{0.5\textwidth}  %%<--- here
  {\large \textcolor{hellblauMUW}{Headline for right column}}
    \begin{itemize}
	  \item Right column for content
	  \begin{itemize}
	  	\item Can contain text, charts, pictures, … 
		\end{itemize}
	\end{itemize}
  \end{column}
\end{columns}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{Blocks}

\begin{block}{Block}
Some examples of commonly used commands and features are included, to help you get started.
\end{block}

\begin{exampleblock}{Example Block}
Some examples of commonly used commands and features are included, to help you get started.
\end{exampleblock}

\begin{alertblock}{Alert Block}
Some examples of commonly used commands and features are included, to help you get started.
\end{alertblock}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Some \LaTeX{} Examples}
\subsection{Tables}

\begin{frame}{Tables}

\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Mathematics}

\begin{frame}{Readable Mathematics}

Let $X_1, X_2, \ldots, X_n$ be a sequence of independent and identically distributed random variables with $\text{E}[X_i] = \mu$ and $\text{Var}[X_i] = \sigma^2 < \infty$, and let
$$S_n = \frac{X_1 + X_2 + \cdots + X_n}{n}
      = \frac{1}{n}\sum_{i}^{n} X_i$$
denote their mean. Then as $n$ approaches infinity, the random variables $\sqrt{n}(S_n - \mu)$ converge in distribution to a normal $\mathcal{N}(0, \sigma^2)$.

\end{frame}


\end{document}

