Random Access

From BenningtonWiki

Jump to: navigation, search

Contents

[edit] Simple Upkeep

December 10, 2007 (notes from October)

Activity Monitor

  • CPU/Active Processes - Sort by % CPU. kernel_task is the disk and internet. pmTool is Activity Monitor. Window Server is the screen.
  • System Memory - Computer works best when Green (Free) is > 50 MB. Pay attention to what activities make it go under 50 MB. Get more RAM if this happens a lot.
  • Disk Usage - Computer works best when Green (Space free) is > 5 GB. Delete stuff if it's less. Or get a bigger hard drive.

[edit] Antisocial Networks

December 10, 2007

For all of these reasons, I believe that technically-mediated social networking at any level beyond very simple, local applications is fundamentally, and probably persistently, a bad idea. From where I stand, the only sane response is to keep our conceptions of friendship and affinity from being polluted by technical metaphors and constraints to begin with.
I don't know what made me delete it. It just looked ugly: the page layout, the blue writing. I felt like a sheep, letting social pressures, memes and fads herd me around. I wondered why I needed yet another social networking website to check: After all, I was already on Friendster and Japanese network Mixi, not to mention LiveJournal, a network organized around daily content rather than mere profiles and links. Mostly, I just wondered why I needed to affirm tenuous affiliation with a new set of ghosts.

[edit] Line Rasterization Algorithm

December 5, 2007

I continued to spend my Saturday nights in the lobby. There was no hope of a phone call, but I didn't know what else to do with the time. I would switch on the baseball game and pretend to watch it as I cut the empty space between me and the television set in two, then cut each half in two again, over and over, until I had fashioned a space small enough to hold in my hand.

Haruki Murakami, Norwegian Wood

[edit] Rigid C vs. Flexible Ruby

December 1, 2007

Both C and Ruby syntaxes are described by BNF (Backus–Naur Form) rules (read it). However Ruby has a much more "liberal-feeling" grammar. The lack of semicolons being an obvious example. The difference in feel is due to the invention of GLR (Generalized Left to Right) parsing, which occurred after the creation of C.

In non-GLR parsing — called LALR(1) (1 Lookahead Left to Right) parsing, invented in 1960 — the parser looks ahead a single token and must be able to determine from that next token the entirety of meaning up to that point. Things cannot be ambiguous. It cannot look any farther than one token ahead. C grammar is limited by this.

GLR (Generalized) parsing, invented in 1974, relaxes this requirement. It allows temporary ambiguity during parsing. It works like this (from the Bison manual):

In some grammars, Bison’s standard LALR(1) parsing algorithm cannot decide whether to apply a certain grammar rule at a given point. That is, it may not be able to decide (on the basis of the input read so far) which of two possible reductions (applications of a grammar rule) applies, or whether to apply a reduction or read more of the input and apply a reduction later in the input. These are known respectively as reduce/reduce conflicts and shift/reduce conflicts.
To use a grammar that is not easily modified to be LALR(1), a more general parsing algorithm is sometimes necessary. If you include %glr-parser among the Bison declarations in your file, the result is a Generalized LR (GLR) parser. These parsers handle Bison grammars that contain no unresolved conflicts (i.e., after applying precedence declarations) identically to LALR(1) parsers. However, when faced with unresolved shift/reduce and reduce/reduce conflicts, GLR parsers use the simple expedient of doing both, effectively cloning the parser to follow both possibilities. Each of the resulting parsers can again split, so that at any given time, there can be any number of possible parses being explored. The parsers proceed in lockstep; that is, all of them consume (shift) a given input symbol before any of them proceed to the next. Each of the cloned parsers eventually meets one of two possible fates: either it runs into a parsing error, in which case it simply vanishes, or it merges with another parser, because the two of them have reduced the input to an identical set of symbols.
During the time that there are multiple parsers, semantic actions are recorded, but not performed. When a parser disappears, its recorded semantic actions disappear as well, and are never performed. When a reduction makes two parsers identical, causing them to merge, Bison records both sets of semantic actions. Whenever the last two parsers merge, reverting to the single-parser case, Bison resolves all the outstanding actions either by precedences given to the grammar rules involved, or by performing both actions, and then calling a designated user-defined function on the resulting values to produce an arbitrary merged result.

[Bison manual, pp. 14-15]

Ruby, invented in 1993, makes extensive use of GLR parsing to provide a more flexible grammar. It's interesting that GLR parsing was developed by folks interested in natural language processing.

J.W. Backus, P. Naur, et al, "Report on the algorithmic language ALGOL 60," Communications of the ACM Vol. 3, No. 6, pp. 299-314, June 1960.

Bernard Lang, "Deterministic Techniques for Efficient Non-deterministic Parsers," Lecture Notes In Computer Science; Vol. 14. Proceedings of the 2nd Colloquium on Automata, Languages and Programming, pp. 255-269, Springer-Verlag, 1974 (ISBN:3-540-06841-4).

Masaru Tomita, "Efficient Parsing for Natural Language," International Series in Engineering and Computer Science, Springer-Verlag, 1985.

[edit] AND Gates

October 12, 2007

After ten minutes, May Kasahara came back. She handed me a large glass. Ice clinked inside when I took it. The sound seemed to reach me from a distant world. There were several gates connecting that world with the place where I was, and I could hear the sound because they all just happened to be open at the moment. But this was strictly temporary. If even one of them closed, the sound would no longer reach my ears. "Drink it," she said. "Lemon juice in water. It'll clear your head."

Haruki Murakami, The Wind-Up Bird Chronicle

[edit] What is Computing?

October 8, 2007

Computing is thinking clearly about processes.

An algorithm is a formal description of a process.

A computer is a machine that can run an algorithm.

Computer Engineering is making these machines. Usually these machines can run lots of different algorithms.

Coding is (strictly speaking) turning algorithms into instructions for these machines.

Programming is developing algorithms and then coding them for a computer.

All the great inventions that harness computers and science are because some scientist knew how to program. The next great scientific tool will be made by a scientist who knows what computers are good for.

[edit] fsck_hfs

<source lang="bash"> $ df / Filesystem 512-blocks Used Avail Capacity Mounted on /dev/disk0s3 312319584 219920864 91886720 71% / $ sudo fsck_hfs -fln /dev/disk0s3

    • /dev/rdisk0s3 (NO WRITE)
    • Root file system
    • Checking HFS Plus volume.
    • Checking Extents Overflow file.
    • Checking Catalog file.
    • Checking multi-linked files.
    • Checking Catalog hierarchy.
    • Checking Extended Attributes file.
    • Checking volume bitmap.
    • Checking volume information.
    • The volume Go appears to be OK.

</source>

[edit] Timings

September 22, 2007

  • firewire400 means 40MB/sec.
  • Gigabit ethernet means 100MB/sec.
  • SATA is what, 3gbit/sec. Means 300MB/sec. 7.5x faster than firewire.

So:

  • Client to server: 100MB/sec.
  • Server to SATA drive: 300MB/sec.
  • Server to firewire drive: 40MB/sec.

Data formats:

  • DV is 3.5MB/sec.
  • 1 hour of DV is 12.5GB on disk.
  • Uncompressed 1080i (HDV) video is 95MB/sec.
  • MPEG2 compressed HDV is 3.5MB/sec.

Also:

  • rsync copies 15.5MB/sec on the Xserve between two 400mbit firewire drives (on the same bus). 930MB/min.
  • 52MB/sec between two SATA drives. 3.1GB/min. 3.3x faster than firewire. Must be SATA 1.5.
  • Copying an hour of DV takes 13.5 minutes between the firewire drives. Copying on the SATA drives takes 4 minutes.
  • Copying between the Xserve and my laptop over 100mbit ethernet is 9.8MB/sec. 588MB/min.

[edit] Moving the Wiki

September 22, 2007

  • Turn off the wiki with upgrading.html.
  • Export the MySQL wikidb.
  • Import the wikidb on bibliofile.
  • copy mediawiki/images.
  • Add redirect to wiki.bennington.edu.
  • Have Todd switch over DNS.
  • Edit TWiki.cfg, replacing bibliofile with wiki.

<source lang="bash">

  1. ! /bin/sh

echo "Dumping wikidb..." ssh joe@kvalda.com 'mysqldump -uroot -pserve wikidb > wikidb.sql' echo "Copying wikidb.sql..." rsync -az joe@kvalda.com:wikidb.sql . echo "Importing wikidb.sql..." mysql5 -uroot -pserve wikidb < wikidb.sql echo "Copying images..." sudo rsync -az --delete root@kvalda.com:/alias/wikiroot/mediawiki/images /alias/wiki/root/mediawiki/images </source>

Test on new wiki:

  • Go to Main Page
  • Look at recent changes.
  • Log in.
  • Edit a page, save it.
  • Look at history.

[edit] TeX

September 17, 2007

<source lang="text"> ax2 + bx + c = 0 </source> ax2 + bx + c = 0

Notice that the expression is displayed as HTML (selectable text). It does this whenever it can. Otherwise it renders the expression as an image.

<source lang="text"> x=\frac{-b\pm\sqrt{b^2-4ac}}{2a} </source> x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}

<source lang="text"> {}_pF_q(a_1,\dots,a_p;c_1,\dots,c_q;z)  = \sum_{n=0}^\infty  \frac{(a_1)_n\cdot\cdot\cdot(a_p)_n}{(c_1)_n\cdot\cdot\cdot(c_q)_n}  \frac{z^n}{n!} </source> {}_pF_q(a_1,\dots,a_p;c_1,\dots,c_q;z)  = \sum_{n=0}^\infty  \frac{(a_1)_n\cdot\cdot\cdot(a_p)_n}{(c_1)_n\cdot\cdot\cdot(c_q)_n}  \frac{z^n}{n!}

Instructions for and examples of using {\mathrm{T\!_{\displaystyle e} \! X}} in a wiki: http://en.wikipedia.org/wiki/Wikipedia:Editing_Math.

[edit] gnuplot

September 15, 2007

<source lang="text"> <gnuplot> set xlabel "x" set ylabel "y" plot [x=-4:4] x**2-3, -x**2 </gnuplot> </source>

<gnuplot>

  set xlabel "x"
  set ylabel "y"
  plot [x=-4:4] x**2-3, -x**2

</gnuplot>

Lots of gnuplot demos here: http://gnuplot.sourceforge.net/demo/. I don't know why the text is so small, so remember that you can increase the font size in your browser (usually by typing command/control-plus).

Some details and examples for using gnuplot within a wiki: http://meta.wikimedia.org/wiki/Gnuplot.

[edit] Uncategorized Randomness

[edit] PHP in your Wiki

<source lang="php"> <php> function tag($arg) { return "<" . $arg . ">"; }

echo tag("pre"); echo `date; ping -c 1 -t 1 cs0.bennington.edu`; echo tag("/pre"); </php> </source>

[edit] Interdisciplinary Computing

January 10, 2007

You may know how I feel about computing for its own sake. It's a bit of a circle jerk. I prefer seeing computing applied to other disciplines. I find this description of Mills College's ICS program intriguing:

The interdisciplinary part of the Mills College ICS program's name means students combine computer science with another area of study to produce their master's theses. "It gives you a really broad brush," says Wetherby, the former casino worker. When a student comes to Spertus with a thesis idea, she always asks how it uses what the student has learned about computer science. But she also asks why the thesis is something that she, a narrowly trained computer scientist, couldn't do. She finds the interdisciplinary approach helps students make more of a contribution and also realize they can do things that Spertus, who has a PhD from MIT, can't. SFBG

I like the idea of asking students what they're going to do that I can't, because I'm not trained in their discipline.

[edit] IP Addresses on Campus

December 12, 2006

I want a map that correlates IP addresses to their areas on campus.

  • 12.16.112.64 - Paris Borden, Perkins, Fels, Sawtell, Noyes, Bingham, Swan, Woolley wireless
  • 12.16.112.84 - Paris Borden, Merck, Perkins, Commons downstairs wired
  • 12.16.113.2 -
  • 12.16.114.92 - McCullough, Leigh, Dewey, Stokes wireless
  • 12.16.114.116 - Library, upstairs reading room, wireless
  • 12.16.115.34 - Dickinson, kvalda, wired
  • 12.16.115.88 - Dickinson, Computer Center, wireless
  • 12.16.115.243 - Dickinson, my office, wireless
  • 12.16.115.244 - Dickinson, my office, wired
  • 12.16.116.195 - Commons, upstairs
  • 12.16.117.21 - Welling, Kilpatrick, Booth, Commons, Canfield, Franklin wireless
  • 12.16.117.101 - Barn, Chris Miller's office, wireless

[edit] GPS

June 11, 2006

I got my nifty little GPS dongle working today. It was ridiculously easy. After sitting on it for weeks and digging into how to talk to USB devices through some wonky IOKit API, I began to suspect that it was a simple serial thing. The GPS device inside the dongle is actually serial and there's a Prolific USB chip in it that gives the whole thing a USB interface. The Prolific driver turns it back into a serial-looking device, and all I needed to do was find a simple serial terminal app. Which I did. 4800-N-1 and I'm running. Here I am: 42 55.4415'N 73 13.5025W.

That particular device is no longer made, but there've got to be other similar ones. $50. Good deal.

[edit] Experiments with RAID

June 2, 2006

For such a simple thing, RAID on OS X sure can be uncertain and unpredictable. So many questions. And since you're playing with YOUR DATA it's not like you really want to try things to find out. I've been playing with two new drives this afternoon in a simple mirrored RAID configuration and I've been abusing them to find out what RAID can and can't do. Here are my adventures.

2 x 250GB drives. Firewire external.

Something I haven't done yet is timed them. Both drives on the same Firewire bus sounds slow. Add a DV camera that you're capturing from and I imagine it may not even be fast enough to keep up. I wonder.

I turned one of the drives off in the middle of a copy. The remaining drive paused for a few seconds and then the copy completed. In Disk Utility it listed the RAID set as "degraded". When I powered the other drive up it was recognized as belonging to the set, and Disk Utility offered to rebuild the set. THREE HOURS later it was back online. But it worked. And supposedly you can use the drive while it's rebuilding, but I stayed away from it.

I was wondering if you could remove a drive from a RAID set. I selected one of the drives and reformatted it (in Disk Utility). There was a warning about possibly affecting the set, but the message seemed generic, and of course this would be a not-so-good action to take with a striped RAID set. The RAID set went away and came back degraded (again), and the newly formatted drive showed up on its own. Disk Utility doesn't offer a cleaner way to remove a drive from a set.

I can add the reformatted drive back to the RAID set, but I see I'm offered to rebuild it again. I've got better things to do.

When I drag the new drive into the set, it gives me an insertion bar and lets me place it above or below the remaining drive. Why? What does it matter what order they appear in Disk Utility?

Oh, and when I created the set I changed the RAID block size to 256K from the default 32K. What difference does it make? I don't know.

I unmounted the two drives. When I plugged the RAID drive back in, it took a good 15 seconds before it came online. I would guess this is because it's degraded. The other drive (not part of a RAID set) comes up right away.

Can you have more than two drives in a mirrored set?

Speed:

  • Copying a 300MB file from the internal (ATA) drive to the un-RAIDed drive took 17 sec. Equals 17.6MB/sec.
  • Copying the same file to the RAID (degraded) drive took the same amount of time.
  • What I really want to see is how long it takes with the rebuilt RAID set.

This is odd. In the middle of rebuilding the RAID set I unmounted the set in the Finder just because I could. Surprisingly, nothing bad happened. The rebuild continued, and I was able to remount the set in Disk Utility.

I also copied about a gig's worth of files around on the degraded set while it was rebuilding. This didn't seem to perturb it at all.

Interesting. After the most recent Rebuild the set still said that it's degraded. I unmounted, rebooted, etc. and it's still degraded. It seems to work okay, and both drives mount. But I don't know what degraded means here. If the wrong drive fails, is it kaput? So I reformatted the drive that I'd messed with, figuring that it was the bad boy -- but not knowing for sure. The set still looked okay with all its files intact. Then I added the drive back to the set and rebuilt.

[edit] Stupid OS X Server serial number checks

June 2, 2006

Every 34 seconds this broadcast check goes out:

$sudo tcpdump -i en0 -n -X port 626
14:46:46.324200 IP 12.16.115.34.626 > 224.0.0.1.626: UDP, length: 31
        0x0000:  4500 003b 6326 0000 0111 f758 0c10 7322  E..;c&.....X..s"
        0x0010:  e000 0001 0272 0272 0027 6710 534e 5155  .....r.r.'g.SNQU
        0x0020:  4552 593a 6b76 616c 6461 2e63 6f6d 3a54  ERY:kvalda.com:T
        0x0030:  6557 4367 503a 7873 7672 00              eWCgP:xsvr.
14:46:46.324657 IP 12.16.115.40.626 > 12.16.115.34.626: UDP, length: 173
        0x0000:  4500 00c9 48a1 0000 4011 3319 0c10 7328  E...H...@.3...s(
        0x0010:  0c10 7322 0272 0272 00b5 9c1b 534e 5245  ..s".r.r....SNRE
        0x0020:  5350 533a 6373 302e 6c6f 6361 6c3a 3078  SPS:cs0.local:0x
        0x0030:  3832 3038 6164 6531 3537 6130 6632 6336  8208ade157a0f2c6
        0x0040:  3962 3739 6634 3636 6232 6566 3262 3836  9b79f466b2ef2b86
        0x0050:  3030                                     00
...
14:47:20.325642 IP 12.16.115.34.626 > 224.0.0.1.626: UDP, length: 31
        0x0000:  4500 003b 6452 0000 0111 f62c 0c10 7322  E..;dR.....,..s"
        0x0010:  e000 0001 0272 0272 0027 ac6d 534e 5155  .....r.r.'.mSNQU
        0x0020:  4552 593a 6b76 616c 6461 2e63 6f6d 3a33  ERY:kvalda.com:3
        0x0030:  4941 3841 323a 7873 7672 00              IA8A2:xsvr.
14:47:20.326124 IP 12.16.115.40.626 > 12.16.115.34.626: UDP, length: 173
        0x0000:  4500 00c9 48d2 0000 4011 32e8 0c10 7328  E...H...@.2...s(
        0x0010:  0c10 7322 0272 0272 00b5 9435 534e 5245  ..s".r.r...5SNRE
        0x0020:  5350 533a 6373 302e 6c6f 6361 6c3a 3078  SPS:cs0.local:0x
        0x0030:  3031 6663 3964 3735 3362 6562 3132 3236  01fc9d753beb1226
        0x0040:  3066 6561 6536 3834 3836 3433 3031 6261  0feae684864301ba
        0x0050:  6465                                     de

Also this firewall entry:

$sudo ipfw -det show
00001     8    1040 Fri Jun  2 14:47:54 2006 allow udp from any 626 to any dst-port 626
65535 56910 8852426 Fri Jun  2 14:48:28 2006 allow ip from any to any

Gets re-added every 2 minutes.

Thank you /usr/sbin/serialnumberd.

[edit] Moving kvalda to a new computer with 10.4

June 1, 2006

  • Install ports
    • Install DarwinPorts
    • Install gdbm, libid3tag, sqlite
  • Configure network
  • Change the machine name
  • Attach KidA
  • Create accounts
    • Create mail-only accounts for abinfo, admin
    • Create accounts for Patti Maciesz and lobsterrags, homes in /Volumes/KidA/Users
  • Start basic web services
    • Copy /etc/httpd/sites
    • Turn off performance cache
    • I changed the log location from /var/log to /Volumes/KidA/log
    • Copy current logs
    • Start apache
  • Start MySQL
    • Copy /etc/my.cnf
    • Start using /Applications/Server/MySQL Manager
  • Start AFP, FTP, etc.
    • Manually copy and double-check prefs
  • Copy crontab

[edit] Is there a gigabit link between cs0 and the Video Lab?

April 2006

396M file on cs0.

  • Copying the file to my office: 9.16M/sec. It's a 100mbit link.
  • Copying the file to the Video Lab: 9.19M/sec.

10M/sec is the theoretical max for 100Mbit/sec ethernet.

Nope.

Personal tools