Tuesday, July 03, 2007

Chapter�5.�Textuality

Chapter�5.�Textuality: "It's a well-known fact that computing devices such as the abacus were invented thousands of years ago. But it's not well known that the first use of a common computer protocol occurred in the Old Testament. This, of course, was when Moses aborted the Egyptians' process with a control-sea.
-- Tom Galloway rec.arts.comics, February 1992 "

Compactness and Orthogonality

Compactness and Orthogonality: "The purpose of emphasizing compactness as a virtue is not to condition you to treat compactness as an absolute requirement, but to teach you to do what Unix programmers do: value compactness properly, design for it whenever possible, and not throw it away casually."

Compactness and Orthogonality

Compactness and Orthogonality: "The Magical Number Seven, Plus or Minus Two: Some Limits on Our Capacity for Processing Information [Miller] is one of the foundation papers in cognitive psychology (and, incidentally, the specific reason that U.S. local telephone numbers have seven digits). It showed that the number of discrete items of information human beings can hold in short-term memory is seven, plus or minus two. This gives us a good rule of thumb for evaluating the compactness of APIs: Does a programmer have to remember more than seven entry points? Anything larger than this is unlikely to be strictly compact."

Encapsulation and Optimal Module Size

Encapsulation and Optimal Module Size: "Brooks's Law predicts that adding programmers to a late project makes it later. More generally, it predicts that costs and error rates rise as the square of the number of programmers on a project."

Thursday, June 28, 2007

Origins and History of the Hackers, 1961-1995

Origins and History of the Hackers, 1961-1995: "“Given a sufficiently large number of eyeballs, all bugs are shallow”."

I think this also applies to hardware design.

Tuesday, June 26, 2007

Perl Basics: For Loops

for (starting assignment; test condition; increment)
{
code to repeat
}

Example:

for ($count=1; $count<11; $count++)
{
print 'cool\n';
}

Monday, June 25, 2007

Redbeard's Thoughts

Redbeard's Thoughts: "Here's a simple tip for using xargs to replace for loops on the commandline.

The other day I needed to rename a set of files to a set of names that didn't necessarily work well programatically. While there are tools to do this (vidir comes to mind) I didn't have any available. So I created a simple file to math things up:
sourcefile1 destfile-a
sourcefile3 destfile-b
sourcefile2 destfile-c
Then I ran this command:
cat movelist xargs -n 2 mv"

cheatsheet

cheatsheet: "Using awk, uniq, and grep to filter files

For example for a file web.log with entries that look like
216.103.110.18 - - [27/Mar/2002:03:59:14 -0500] 'GET /people/index.htm HTTP/1.1'
304 - 'http://www.plambeck.org.com/index.htm' 'Mozilla/4.0 (compatible; MSIE 6.0; Win
dows 98; Q312461)'

Use the command
cat web.log awk -F- '{print $1}'

to display the first word on each line that comes before the - sign (ie, the IP address in the example above).

Then use some combination of use 'uniq' and 'sort' to achieve your goal; for example
cat web.log awk -F- '{print $1}' sort uniq -c

to print out number of log entries per IP number.

To get grep to print out lines that don't match a pattern, use the -v option:
cat web.log grep -v 216 "

Thursday, June 14, 2007

Slurping Text

perl.com: Perl Slurp-Eaze: "Perl Slurp-Eaze
by Uri Guttman"

Very useful article on slurping text. The implementation at the end of the article allows easy access to a file and its content.