# HG changeset patch # User Christian Urban # Date 1411296409 -3600 # Node ID e8ef8f38ca84c8da1045dba71d4446da0d1b52c2 # Parent 5b5a68df6d1687a332e1aeeb1c5c3207f0b1d64c added style files diff -r 5b5a68df6d16 -r e8ef8f38ca84 graphics.sty --- a/graphics.sty Mon Sep 15 09:36:02 2014 +0100 +++ b/graphics.sty Sun Sep 21 11:46:49 2014 +0100 @@ -1,3 +1,12 @@ \usepackage{tikz} \usepackage{pgf} -\usetikzlibrary{plotmarks} +\usetikzlibrary{positioning} +\usetikzlibrary{calc} +\usepackage{graphicx} + +\newenvironment{bubble}[1][]{% +\begin{tikzpicture}% +\draw (0,0) node[inner sep=2mm,fill=cream,ultra thick,draw=red,rounded corners=2mm]% +\bgroup\begin{minipage}{#1}\raggedright{}} +{\end{minipage}\egroup;% +\end{tikzpicture}} diff -r 5b5a68df6d16 -r e8ef8f38ca84 handouts/ho01.pdf Binary file handouts/ho01.pdf has changed diff -r 5b5a68df6d16 -r e8ef8f38ca84 handouts/ho01.tex --- a/handouts/ho01.tex Mon Sep 15 09:36:02 2014 +0100 +++ b/handouts/ho01.tex Sun Sep 21 11:46:49 2014 +0100 @@ -149,7 +149,7 @@ regular expression matching in Python and in Ruby. \begin{center} -\begin{tikzpicture}[y=.1cm, x=.15cm] +\begin{tikzpicture}[y=.09cm, x=.15cm] %axis \draw (0,0) -- coordinate (x axis mid) (30,0); \draw (0,0) -- coordinate (y axis mid) (0,30); @@ -184,18 +184,21 @@ Ruby is even slightly worse.\footnote{In this example Ruby uses the slightly different regular expression \texttt{a?a?a?...a?a?aaa...aa}, where the \texttt{a?} and -\texttt{a} each occur $n$ times.} Admittedly, this regular -expression is carefully chosen to exhibit this exponential -behaviour, but similar ones occur more often than one wants in -``real life''. They are sometimes called \emph{evil regular -expressions} because they have the potential to make regular -expression matching engines to topple over, like in Python and -Ruby. The problem with evil regular expressions is that they -can have some serious consequences, for example, if you use -them in your web-application. The reason is that hackers can -look for these instances where the matching engine behaves -badly and then mount a nice DoS-attack against your -application. +\texttt{a} each occur $n$ times. More test results can be +found at \url{http://www.computerbytesman.com/redos/}.} +Admittedly, this regular expression is carefully chosen to +exhibit this exponential behaviour, but similar ones occur +more often than one wants in ``real life''. They are sometimes +called \emph{evil regular expressions} because they have the +potential to make regular expression matching engines to +topple over, like in Python and Ruby. The problem with evil +regular expressions is that they can have some serious +consequences, for example, if you use them in your +web-application. The reason is that hackers can look for these +instances where the matching engine behaves badly and then +mount a nice DoS-attack against your application. These +attacks are already have their own name: +\emph{Regular Expression Denial of Servive Attack (ReDoS)}. It will be instructive to look behind the ``scenes'' to find out why Python and Ruby (and others) behave so badly when @@ -208,7 +211,7 @@ up to 12,000 in less than 10(!) seconds, see the graph below: \begin{center} -\begin{tikzpicture}[y=.1cm, x=.0006cm] +\begin{tikzpicture}[y=.09cm, x=.0006cm] %axis \draw (0,0) -- coordinate (x axis mid) (12000,0); \draw (0,0) -- coordinate (y axis mid) (0,30); diff -r 5b5a68df6d16 -r e8ef8f38ca84 slides.sty --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides.sty Sun Sep 21 11:46:49 2014 +0100 @@ -0,0 +1,83 @@ +\usepackage[absolute,overlay]{textpos} +\usepackage{xcolor} +\usepackage{fontspec} +\usepackage[sc]{mathpazo} +\usefonttheme{serif} +\defaultfontfeatures{Ligatures=TeX} +\defaultfontfeatures{Mapping=tex-text} +\setromanfont{Hoefler Text} +\setmonofont[Scale=.88]{Consolas} +\newfontfamily{\consolas}{Consolas} + +\definecolor{darkblue}{rgb}{0,0,0.6} +\hypersetup{colorlinks=true} +\hypersetup{linkcolor=darkblue} +\hypersetup{urlcolor=darkblue} + + + +\newcommand{\tttext}[1]{{\consolas{#1}}} + +\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% +\newcommand{\slidecaption}{} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Frametitles + +\setbeamerfont{frametitle}{size={\LARGE}} +\setbeamerfont{frametitle}{family={\fontspec{Hoefler Text Black}}} +\setbeamercolor{frametitle}{fg=ProcessBlue,bg=white} + +\setbeamertemplate{frametitle}{% +\vskip 2mm % distance from the top margin +\hskip -3mm % distance from left margin +\vbox{% +\begin{minipage}{1.05\textwidth}% +\centering% +\begin{tabular}{@{}c@{}}% +\insertframetitle% +\end{tabular}% +\end{minipage}}% +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Foot +% +\setbeamertemplate{navigation symbols}{} +\usefoottemplate{% +\vbox{% + \tinyline{% + \tiny\hfill\textcolor{gray!50}{\slidecaption{} -- + p.~\insertframenumber/\inserttotalframenumber}}}% +} + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\beamertemplateballitem +\setlength\leftmargini{2mm} +\setlength\leftmarginii{0.6cm} +\setlength\leftmarginiii{1.5cm} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% blocks +%\definecolor{cream}{rgb}{1,1,.65} +\definecolor{cream}{rgb}{1,1,.8} +\setbeamerfont{block title}{size=\normalsize} +\setbeamercolor{block title}{fg=black,bg=cream} +\setbeamercolor{block body}{fg=black,bg=cream} + +\setbeamertemplate{blocks}[rounded][shadow=true] + +\setbeamercolor{boxcolor}{fg=black,bg=cream} + +\mode + + + + + + + diff -r 5b5a68df6d16 -r e8ef8f38ca84 slides/slides01.tex --- a/slides/slides01.tex Mon Sep 15 09:36:02 2014 +0100 +++ b/slides/slides01.tex Sun Sep 21 11:46:49 2014 +0100 @@ -1,34 +1,43 @@ \documentclass[dvipsnames,14pt,t,xelatex]{beamer} -\usepackage{beamerthemeplaincu} -\usepackage{fontenc,xltxtra,xunicode} -\defaultfontfeatures{Mapping=tex-text} -\usepackage[absolute,overlay]{textpos} -\usepackage{ifthen} -\usepackage{tikz} -\usepackage{pgf} -\usepackage{calc} -\usepackage{ulem} -\usepackage{listings} -\renewcommand{\uline}[1]{#1} -\usetikzlibrary{arrows} -\usetikzlibrary{automata} -\usetikzlibrary{shapes} -\usetikzlibrary{shadows} -\usetikzlibrary{positioning} -\usetikzlibrary{calc} -\usetikzlibrary{plotmarks} -\usepackage{graphicx} -\usepackage{pgfplots} +\usepackage{../slides} +\usepackage{../graphics} \usepackage{../langs} \usepackage{../data} -\makeatletter -\lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}} -\@empty\z@\@empty -\makeatother +\hfuzz=220pt + +%\setmonofont[Scale=.88]{Consolas} +%\newfontfamily{\consolas}{Consolas} +%\usepackage{beamerthemeplaincu} +%\usepackage{fontenc,xltxtra,xunicode} +%\defaultfontfeatures{Mapping=tex-text} +%\usepackage[absolute,overlay]{textpos} +%\usepackage{ifthen} +%\usepackage{tikz} +%\usepackage{pgf} +%\usepackage{calc} +%\usepackage{ulem} +%\usepackage{listings} +%\renewcommand{\uline}[1]{#1} +%\usetikzlibrary{arrows} +%\usetikzlibrary{automata} +%\usetikzlibrary{shapes} +%\usetikzlibrary{shadows} +%\usetikzlibrary{positioning} +%\usetikzlibrary{calc} +%\usetikzlibrary{plotmarks} +%\usepackage{graphicx} +%\usepackage{pgfplots} +%\usepackage{../langs} +%\usepackage{../data} + +%\makeatletter +%\lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}} +%\@empty\z@\@empty +%\makeatother % beamer stuff -\renewcommand{\slidecaption}{AFL 01, King's College London, 25.~September 2013} +\renewcommand{\slidecaption}{AFL 01, King's College London} \begin{document}