Binary file handouts/ho05.pdf has changed
--- a/handouts/ho05.tex Sat Dec 20 14:48:15 2014 +0000
+++ b/handouts/ho05.tex Sat Dec 27 04:10:36 2014 +0000
@@ -811,6 +811,16 @@
\subsubsection*{Further Reading}
+A blogpost that describes the first few milliseconds of an HTTPS connection
+is here
+
+\begin{center}
+\url{http://www.moserware.com/2009/06/first-few-milliseconds-of-https.html}
+\end{center}
+
+\noindent
+it disentangles every message sent between a client and a server.
+
If you want to know more about how cars can be hijacked,
the paper
--- a/handouts/ho08.tex Sat Dec 20 14:48:15 2014 +0000
+++ b/handouts/ho08.tex Sat Dec 27 04:10:36 2014 +0000
@@ -837,3 +837,6 @@
http://www.imponderablethings.com/2013/07/how-bitcoin-works-under-hood.html
http://randomwalker.info/bitcoin/
+
+Jeffrey Robinson
+Bitcon: The Naked Truth about Bitcoin
Binary file handouts/ho09.pdf has changed
--- a/handouts/ho09.tex Sat Dec 20 14:48:15 2014 +0000
+++ b/handouts/ho09.tex Sat Dec 27 04:10:36 2014 +0000
@@ -194,11 +194,11 @@
Designing a language is like playing god: you can say what
names for variables you allow; what programs should look like;
most importantly you can decide what each part of the program
-should mean and do. While our language is rather simple and
-the meaning of statements, for example, is rather
-straightforward, there are still places where we need to make
-real choices. For example consider the conditional jumps, say
-the one in the factorial program:
+should mean and do. While our language is quite simple and the
+meaning of statements, for example, is rather straightforward,
+there are still places where we need to make real choices. For
+example consider the conditional jumps, say the one in the
+factorial program:
\begin{center}
\code{jmp? n = 0 done}
@@ -224,12 +224,10 @@
First we will pre-process our programs. This will simplify the
definition of our interpreter later on. By pre-processing our
-programs we will transform programs into \emph{snippets}.
-Their purpose is to simplify the definition of what the
-interpreter should do in case of a jump. A snippet is a label
-and all the code that comes after the label. This essentially
-means a snippet is a \emph{map} from labels to
-code.\footnote{Be sure you know what maps are. In a
+programs we will transform programs into \emph{snippets}. A
+snippet is a label and all the code that comes after the
+label. This essentially means a snippet is a \emph{map} from
+labels to code.\footnote{Be sure you know what maps are. In a
programming context they are often represented as association
list where some data is associated with a key.}
@@ -527,16 +525,70 @@
$\textit{eval\_stmts}(sn(\pcode{""}), \varnothing)$
\end{center}
-\noindent It is interesting to not that our interpreter when
+\noindent It is interesting to note that our interpreter when
it comes to the end of the program returns an environment. Our
programming language does not contain any constructs for input
and output. Therefore this environment is the only effect we
can observe when running the program (apart from that our
interpreter might need some time before finishing the
-evaluation of the program)
+evaluation of the program and the CPU getting hot). Evaluating
+the factorial program with our interpreter we receive as
+``answer''-environment
+
+\begin{center}
+\begin{tabular}{ll}
+$\fbox{\texttt{a}} \mapsto \texttt{120}$ &
+$\fbox{\texttt{n}} \mapsto \texttt{0}$
+\end{tabular}
+\end{center}
+
+\noindent While the discussion above should have illustrated
+the ideas, in order to do some serious calculation we clearly
+need to implement the interpreter.
+\subsubsection*{Code of the Interpreter}
+Functional programming languages are very convenient for
+implementations of interpreters. A convenient choice for a
+functional programming language is Scala. This is a
+programming language that combines functional and
+object-oriented programming-styles. It has received in the
+last five years or so quite a bit of attention. One reason for
+this attention is that, like the Java programming language,
+Scala compiles to the Java Virtual Machine (JVM) and therefore
+Scala programs can run under MacOSX, Linux and
+Windows.\footnote{There are also experimental backends for
+Android and JavaScript.} Unlike Java, however, Scala often
+allows programmers to write very concise and elegant code.
+Some therefore say Scala is the much better Java. A number of
+companies, The Guardian, Twitter, Coursera, FourSquare,
+LinkedIn to name a few, either use Scala exclusively in
+production code, or at least to some substantial degree. If
+you want to try out Scala yourself, the Scala compiler can be
+downloaded from
+
+\begin{quote}
+\url{http://www.scala-lang.org}
+\end{quote}
+
+
+\begin{figure}[t]
+\small
+\lstinputlisting[language=Scala]{../progs/inter.scala}
+\caption{Bla}
+\end{figure}
+
+
+\subsubsection*{Static Analysis}
+
+Finally we can come back to our original problem, namely
+finding out what the signs of variables are
+
+\begin{center}
+
+
+\end{center}
\end{document}
Binary file hws/so04.pdf has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/progs/read.c Sat Dec 27 04:10:36 2014 +0000
@@ -0,0 +1,49 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int main(int argc, char *argv[])
+{
+ FILE *f; //file pointer
+
+ printf("Real UID = %d\n", getuid());
+ printf("Effective UID = %d\n", geteuid());
+
+ //read test
+ if ((f = fopen(argv[1], "r")) == NULL) {
+ fprintf(stderr, "%s is not readable\n", argv[1]);
+ } else {
+ fprintf(stderr, "%s is readable\n", argv[1]); fclose(f);
+ }
+
+ //write test
+ if ((f = fopen(argv[1], "w")) == NULL) {
+ fprintf(stderr, "%s is not writable\n", argv[1]);
+ } else {
+ fprintf(stderr, "%s is writable\n", argv[1]); fclose(f);
+ }
+
+ //lowering the access rights to the caller
+ if (setuid(getuid())) {
+ fprintf(stderr, "Could not reset setuid\n"); return 1;
+ }
+
+ printf("Real UID = %d\n", getuid());
+ printf("Effective UID = %d\n", geteuid());
+
+ //read test
+ if ((f = fopen(argv[1], "r")) == NULL) {
+ fprintf(stderr, "%s is not readable\n", argv[1]);
+ } else {
+ fprintf(stderr, "%s is readable\n", argv[1]); fclose(f);
+ }
+
+ //write test
+ if ((f = fopen(argv[1], "w")) == NULL) {
+ fprintf(stderr, "%s is not writable\n", argv[1]);
+ } else {
+ fprintf(stderr, "%s is writable\n", argv[1]); fclose(f);
+ }
+
+ return 0;
+}