Category Archiveundergrad computer science classes
personal & programming & undergrad computer science classes 09 Mar 2008 11:08 am
Why did I spend so long on my Sleeping Barber OS project?
Thank you for asking!
(11:55:10 AM) Mark: damnit
(11:55:14 AM) Mark: I hate lee
(11:59:35 AM) GK: why?
(12:00:12 PM) Mark: remember how I told you that I wrote the code for sleeping barber…then I had to go back and rewrite it?
(12:00:25 PM) Mark: it is his fault…because of his bad english/typing skills
(12:01:00 PM) Mark: This last sentence on the description of the problem, changes it…(codewise)
(12:01:07 PM) Mark: Here is how the sentence reads:
(12:01:12 PM) Mark: “If the barber is asleep, the customer waits the barber.”
(12:01:34 PM) Mark: it is obviously incorrect, so the way I initially interpreted was:
(12:01:45 PM) Mark: If the barber is asleep, the customer waits for the barber. (to wake up)
(12:02:03 PM) Mark: however, he actually meant:
If the barber is asleep, the customer wakes the barber.
computers and technology & funny & interesting & personal & quotes & undergrad computer science classes 26 Feb 2008 01:50 pm
Remember when?
“Remember when I grabbed your resources at the beginning of class?”
“…and then I returned them.”
- Dr. Lee
geek & linux, unix, and open source & personal & programming & undergrad computer science classes 15 Feb 2008 07:23 pm
The <unistd.h> header defines miscellaneous symbolic constants and types, and declares miscellaneous functions.
The following are declared as functions and may also be defined as macros. Function prototypes must be provided for use with an ISO C compiler.
int access(const char *, int);
unsigned int alarm(unsigned int);
int brk(void *);
int chdir(const char *);
int chroot(const char *); (LEGACY)
int chown(const char *, uid_t, gid_t);
int close(int);
size_t confstr(int, char *, size_t);
char *crypt(const char *, const char *);
char *ctermid(char *);
char *cuserid(char *s); (LEGACY)
int dup(int);
int dup2(int, int);
void encrypt(char[64], int);
int execl(const char *, const char *, …);
int execle(const char *, const char *, …);
int execlp(const char *, const char *, …);
int execv(const char *, char *const []);
int execve(const char *, char *const [], char *const []);
int execvp(const char *, char *const []);
void _exit(int);
int fchown(int, uid_t, gid_t);
int fchdir(int);
int fdatasync(int);
pid_t fork(void);
long int fpathconf(int, int);
int fsync(int);
int ftruncate(int, off_t);
char *getcwd(char *, size_t);
int getdtablesize(void); (LEGACY)
gid_t getegid(void);
uid_t geteuid(void);
gid_t getgid(void);
int getgroups(int, gid_t []);
long gethostid(void);
char *getlogin(void);
int getlogin_r(char *, size_t);
int getopt(int, char * const [], const char *);
int getpagesize(void); (LEGACY)
char *getpass(const char *); (LEGACY)
pid_t getpgid(pid_t);
pid_t getpgrp(void);
pid_t getpid(void);
pid_t getppid(void);
pid_t getsid(pid_t);
uid_t getuid(void);
char *getwd(char *);
int isatty(int);
int lchown(const char *, uid_t, gid_t);
int link(const char *, const char *);
int lockf(int, int, off_t);
off_t lseek(int, off_t, int);
int nice(int);
long int pathconf(const char *, int);
int pause(void);
int pipe(int [2]);
ssize_t pread(int, void *, size_t, off_t);
int pthread_atfork(void (*)(void), void (*)(void),
void(*)(void));
ssize_t pwrite(int, const void *, size_t, off_t);
ssize_t read(int, void *, size_t);
int readlink(const char *, char *, size_t);
int rmdir(const char *);
void *sbrk(intptr_t);
int setgid(gid_t);
int setpgid(pid_t, pid_t);
pid_t setpgrp(void);
int setregid(gid_t, gid_t);
int setreuid(uid_t, uid_t);
pid_t setsid(void);
int setuid(uid_t);
unsigned int sleep(unsigned int);
void swab(const void *, void *, ssize_t);
int symlink(const char *, const char *);
void sync(void);
long int sysconf(int);
pid_t tcgetpgrp(int);
int tcsetpgrp(int, pid_t);
int truncate(const char *, off_t);
char *ttyname(int);
int ttyname_r(int, char *, size_t);
useconds_t ualarm(useconds_t, useconds_t);
int unlink(const char *);
int usleep(useconds_t);
pid_t vfork(void);
ssize_t write(int, const void *, size_t);
The following external variables are declared:
extern char *optarg;
extern int optind, opterr, optopt;
personal & undergrad computer science classes 23 Jan 2008 10:29 am
First day of classes
Well on to my last semester, doesn’t look like it is going to be terribly interesting.
My first class, math455 a.k.a. “numerical analysis”, was a yawn. For one thing, I realized how much I had forgot of Calculus, but then I pretty much remembered it all again, due in part to the teacher’s painstakingly slow walkthrough over fundamental theorems of Calculus. She’s this older Chinese lady and kept saying things like “too hard?”, “too fast?”, “any questions?”, but of course in that not-native English speaking accent. Also, the class is in a room full of old computers..with, of course, windows. Ugh.
My next class, cmps455 a.k.a. “operating systems”, was also pretty boring. I found myself getting pretty sleepy, except for the part when I got angry because blake was asking all kinds of dumb questions again…and it’s the first day. Give it a break.
Other than that, the day was pretty much inconsequential, but I did go to wild wings and had some beer, so that was probably the highlight of the day.
geek & personal & programming & undergrad computer science classes 06 Dec 2007 12:04 am
Ah…am I really done with PL?
Here are some stats on my projects:
Lines Words Characters
87 694 4148 snobol_project/documentation01.txt
181 1375 8689 snobol_project/documentation02.txt
252 1405 11580 snobol_project/documentation03.txt
2005 5828 55929 snobol_project/documentation04.txt
2525 9302 80346 total
(Roughly 45 pages)
139 860 5995 ml_project/documentation01.txt
247 1755 10968 ml_project/documentation02.txt
1275 4565 39615 ml_project/documentation03.txt
776 1613 20911 ml_project/documentation04.txt
2437 8793 77489 total
(Roughly 43 pages)
328 1828 12515 smalltalk_project/documentation01.txt
200 1167 7250 smalltalk_project/documentation02.txt
234 884 5828 smalltalk_project/documentation03.txt
867 2889 20465 smalltalk_project/documentation04.txt
1629 6768 46058 total
(Roughly 29 pages)
geek & interesting & personal & programming & undergrad computer science classes 15 Nov 2007 08:23 pm
SNOBOL: Optimizing variables
—Before—
$ time snobol4 -b algol_recognizer.sno < sample0.a60
x[Q[sin(nXpi/2)],Q[3888888888888888888888888888888888888888888888888,8,4,4,3,5,4]]
*
Yes
real 0m9.340s
user 0m9.273s
sys 0m0.004s
—After—
$ time snobol4 -b algol_recognizer.sno < sample0.a60
Checking…
+ x[Q[sin(nXpi/2)],Q[3888888888888888888888888888888888888888888888888,8,4,4,3,5,4]]
*
Yes
real 0m0.023s
user 0m0.012s
sys 0m0.004s
I call that improvement.
geek & personal & programming & undergrad computer science classes 10 Nov 2007 04:27 pm
String concatenation checking implemented
The proof:
(SOME
(Term_as_Expr
(String_Term
(String_as_Factor (”ab+c”,StringType),
String_Term
(String_as_Factor (”bab-y”,StringType),
Factor_as_Term (Number_as_Factor (”3″,IntType),IntType),Error),
Error),Error)),[]) : Expr option * token option list
geek & personal & programming & undergrad computer science classes 10 Nov 2007 02:14 pm
Finally, a bit of progress.
Hours and hours after I’ve started, I have the first sign of progress, albeit very minor progress. The following is a type check of the expression “1 + 2″: - val it = (SOME (Term_as_Expr (Mult_Term (Number_as_Factor (”1″,IntType), Factor_as_Term (Number_as_Factor (”2″,IntType),IntType),IntType), IntType)),[]) : Expr option * token option list As noted by the first word on the last line, it knows that the expression is valid and of IntType. I still hate ML.
geek & interesting & personal & programming & undergrad computer science classes & wikipedia 29 Sep 2007 11:46 am
ML (programming language)
ML (programming language) - Wikipedia, the free encyclopedia ML is often referred to as an impure functional language, because it permits side-effects, and therefore imperative programming, unlike purely functional programming languages such as Haskell. Features of ML include a call-by-value evaluation strategy, first class functions, automatic memory management through garbage collection, parametric polymorphism, static typing, type inference, algebraic data types, pattern matching, and exception handling. Unlike Haskell, ML uses eager evaluation, which means that all subexpressions are always evaluated. One result of this is that you cannot use infinite lists per se. However, lazy evaluation and hence infinite lists can be simulated, through use of anonymous functions. Today there are several languages in the ML family; the two major dialects are Standard ML and Caml, but others exist, including F# - an open research project that targets the Microsoft .NET platform. Ideas from ML have influenced numerous other languages, such as Haskell, Cyclone, and Nemerle. ML’s strengths are mostly applied in language design and manipulation (compilers, analyzers, theorem provers), but it is a general-purpose language also used in bioinformatics, financial systems, and applications including a genealogical database, a peer-to-peer client/server program, etc. [edit]
computers and technology & personal & programming & undergrad computer science classes 28 Sep 2007 07:35 am
Programming languages at BURKS
Programming languages - Every serious student of computing should be familiar with a range of different languages (for example, I used a mixture of C, C , Delphi, JavaScript, Perl and Tcl/Tk to create this CD). This collection includes compilers and other resources for a wide variety of programming languages, including conventional procedural languages, object-oriented languages, functional languages, logic programming languages, scripting languages, and some just plain weird languages. You can choose which are which! For a light-hearted comparison of a range of languages, I’ve also included a widely-circulated collection of “shooting yourself in the foot” jokes about different languages…
linux, unix, and open source & personal & programming & undergrad computer science classes 28 Sep 2007 07:32 am
ML assignment
Installed smlnj (ML of New Jersery). For linux/unix systems, installation tgz file can be found here http://smlnj.cs.uchicago.edu/dist/working/110.65/index.html I should get started on the project soon since it is due for me by Oct 23…
personal & programming & undergrad computer science classes 17 Sep 2007 11:52 pm
Syntax of the Algorithmic Language Algol 60
personal & programming & undergrad computer science classes 16 Sep 2007 06:41 pm
And the snobol nightmare continues
With the “first draft” of our class’s snobol project due wednesday, I’ve been trying to find the time to get around to it. Fortunately this weekend I managed to sneak some time in on it. At first it started off pretty rocky but now it is coming along pretty well. Just have a few issues to work out and a lot of documentation to do…
funny & personal & programming & undergrad computer science classes 26 Aug 2007 06:23 pm
First snobol program debugged
I am proud to announce that shortly after my first “Hello World” program in snobol, I have successfully debugged my first snobol program (one that I have not written).
personal & undergrad computer science classes 20 Mar 2006 07:13 pm
CMPS341 Homework
The following is from my cmps341 (formal foundations of computer science) class:
In a group of 25, must there be at least 3 who were born in the same month?
How many distinct permutations are there of the characters in the word
APALACHICOLA?In how many ways can a librarian select 4 novels and 3 plays from a
collection of 21 novels and 11 plays?In how many different ways can you seat 11 men and 8 women in a row if no
2 women are to sit together?
personal & undergrad computer science classes 14 Mar 2006 07:09 pm
CMPS341 Notes
Notes from formal foundations class (cmps341):
————————
We will do problem 8 together.
Problem 8: Mix the special powder with the juice, and with the rest of the
occult, quickly ingest it all at once.
Note: Your death will not be in vain!
————————
|b-(c ∪ m)| = |B| - |B ∩ (C ∪ M)|
she wrote ‘cum’ on the board
————————
repatititive
repatititive
repatititive
repatititive
repatititive
mississippi - 11 positions
1 - m
4 - i
4 - s
2 - peas
C(11,1) * C(10,4) * C(6,4) * C(2,2)
I wanna fit these eyes, four eyes.
i’ve given you a flavor…of course, there are more flavors.
personal & undergrad computer science classes 01 Nov 2005 03:33 pm
Some sample mazes from cmps261
Sample mazes generated from my latest program (i know, they’re not that great) in cmps261 (data structures) class.