25 June 2008
After checking code in to trunk at work
Dogster HQ
Potrero Hill
San Francisco
I made my deadline at work with about 7 minutes to spare. *phew* I ran into an issue with scoping that got fixed. Now I have free time to explore the homework.
So my editor is installed. My Webserver is running with PHP installed.
#1: a hello world page that counts from 1 to 10.
What is counting? When I look at pennies to figure out how much money I have, counting will tell me how much money I have. How much is a number.
What is number? Number is a pretty perplexing concept. There is nothing empirical that is a number, except the representation of it. I see two cups in front of me, but where in those cups does 2 exist? Numbers must exist in my mind, then, and my mind binds objects together with them. So my mind takes the idea of one cup, and makes a copy of it, and so it imagines two cups. So to count 10 cups, I just repeat the process of imagining a cup 10 times.
<?php
echo 'hello world!' . "\n";
count_to_10();
function count_to_10() {
for($i = 1; $i <=10; $i++) {
echo "$i , ";
}
}
?>
This is one way to count to 10.
One could also count to 10 recursively.
<?php
echo 'hello world!' . "\n";
echo count_to_10(1) . "\n\n";
function count_to_10($i_start) {
if ($i_start < 10) {
print $i_start . ', ';
$i_start = $i_start + 1;
return count10($i_start);
}
return $i_start;
}
?>
24 June 2008
Afterwork
Dogster HQ
Potrero Hill
San Francisco
"[I]t is really the essential property of the thing that is its undoing." -- Hegel, Phenomenology of Spirit, section 125.
"[A] signifier is that which represents the subject for another signifier." -- Lacan, Écrits, pp. 290 - 291.
A step by step guide for doing Homework #1
Part I: Setting up your editor, PHP and web server on your laptop
1) In order to do the work of web programming one needs three things: an editor for editing files, a scripting language for coding, and a web server. My web server will live on my laptop which is a Powerbook G4 running Mac OS X 10.4 and has 1GiB of memory.
For my purposes, as an editor, I have selected subethaedit:
http://www.codingmonkeys.de/subethaedit/
Why? I like the idea that I can share the files that I am working on with my chat buddies. I can have as many friends as I want working on the same file.
The scripting language has been chosen for me: PHP.
For a webserver, I decided to use lighthttpd because it is fast and small: http://www.lighttpd.net/benchmark/
2) Set up subethaedit.
3) Install lighthttpd by following these instructions: http://trac.lighttpd.net/trac/wiki/TutorialInstallation
Skip to step 6 if the above is not your cup of tea.
4) Configure lighthttpd by following these instructions:
http://trac.lighttpd.net/trac/wiki/TutorialConfiguration
I set my doc root to /Users/barce/public_html/
5) Install PHP by following these instructions: http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP
6) 3, 4 & 5 are pretty technically advanced. You need a working compiler. Root access or some sort of Administrator or Super user access to your machine, and a whole set of software for running a configure and make command. If 3 & 4 are not of interest to you, then just install this: http://www.mamp.info/en/mamp.html on a Mac. For windows install this: http://www.en.wampserver.com/ The big caveat with the latter is that Ajax doesn't work on it.
7) Now you're ready to code... more later.
8) Why Hegel? I think he is talking about desire when he says that the essential property of a thing is its undoing. I always wanted to code as a child even before my parents gave me my first computer at the age of 11. The movie, Wargames, really influenced what I thought of technology, what I still think of technology. Yet this desire to code has undone itself. How? Because in the real world, coding is really about making money. After 9 years of web programming, I realize that I do not really know how to code. My desire was undone because it is the nature of capital to keep labor cheap, and what better way to do that than to prevent someone from learning.
9) Why Lacan? The word "I" is used to stand for the subject. It is the signifier which represents the subject for another signifier, or does it? The "I" is something that could never be coded. People have tried, and people speak as if it were so when they point to an avatar and say, "That is me," but can an avatar have an unconscious whose dreams are in need of interpretation? That would be really interesting code.
The trouble with "I" is that it is in a context, and so, too, is the art of coding. I sometimes feel as if following the stylepoints of a good coder (i.e. wear sneakers, wear glasses, eat junk food, eschew light, read science fiction, study martial arts, be awkward in romance, be a night owl) makes one a better coder than the actual study of coding.
23 June 2008
In Class
Cupertino
What is a form?
A form consists of a form tag and a set of input tags.
A form can send data via a get method or a post method.
A post method can send more data than a get method.
A post method does not expose form data in a url.
A get method exposes form data in a url.
A form tag has a method and an action.
A form action is the script that the form data is sent to.
How do HTML forms send data to a PHP script?
HTML forms send data to a PHP script through either an input type of submit, or by pressing enter from within a box of input type of text.
How does the state for the board get preserved?
The state is preserved as input type hidden in a serizlied string of the board array. See http://www.php.net/serialize for more info.
Home work 1 by Barce:
http://www.codebelay.com/learn-cs/connect4_homework_1/index.php
Source code:
http://www.codebelay.com/learn-cs/connect4_homework_1/index.phps
http://www.codebelay.com/learn-cs/connect4_homework_1/functions.phps
http://www.codebelay.com/learn-cs/connect4_homework_1/controllers.phps
http://www.codebelay.com/learn-cs/connect4_homework_1/models.phps
Comments (0)
You don't have permission to comment on this page.