#lang racket
(require mrlib/gif)
(require racket/draw)
(define (random-lines-bitmap width height line-count)
(let* ([target (make-bitmap width height)]
[dc (new bitmap-dc% [bitmap target])])
(begin
(send dc draw-rectangle
0 0 ; Top-left at (0, 10), 10 pixels down from top-left
(- width 1) (- height 1))
(for ([i line-count])
(send dc draw-line
(random width) (random height)
(random width) (random height)))
target)))
(define (write-random-lines-gif width height line-count frame-count filename)
(write-animated-gif
(for/list ([i frame-count])
(random-lines-bitmap width height line-count))
10
filename
#:loop? true))
(write-random-lines-gif 300 200 50 10 "random-lines.gif")
An occasionally updated blog, mostly related to programming. (Views are my own, not my employer's.)
Wednesday, May 19, 2021
Playing with Racket: random lines GIF
"Why Concatenative Programming Matters"
"https://evincarofautumn.blogspot.com/2012/02/why-concatenative-programming-matters.html" >url http-get* length ... 261104(This seems to work. Am I leaving extra stuff on the stack?)
Sunday, May 16, 2021
Clojure!
sudo port install clojure +rlwrap sudo port install openjdk11
clj user=> (+ 1 1) 2Woohoo!
Friday, April 30, 2021
Notes on "Mythical Man-Month": "Why did the tower of Babel fall?"
Brooks uses the metaphor of the tower of Babel to again emphasize the importance of but difficulties with communication. Several times he (again) brings up problems with potential superlinear complexity owing to to the number of pairs or other groupings of workers.
"How, then, shall teams communicate with one another? In as many ways as possible: Informally... Meetings... Workbook..."
He goes into some detail talking about the workbook and processing surrounding it. It seems that online documentation has solved a lot of his problems though introducing new ones. He talks about the introduction of microfiche to avoid printing out an unwieldy number of pages, but notes the lack of ability to add notes as an important limitation. We have that problem too with online docs -- no margins to write in as an individual reader. Also, support for showing diffs in documentation is pretty uneven.
"If there are n workers on a project, there are (n^2 - n)/2 interfaces across which there may be communication, and there are potentially almost 2^n teams within which coordination must occur. The purpose of organization is to reduce the amount of communication and coordination necessary... The means by which communication is obviated are division of labor and specialization of function."
A tree structure arises because no one should have two bosses. Brooks also notes even if the reporting change forms a tree, plenty of communication outside this is necessary, forming a network.
Necessaries for any subtree:- a mission
- a producer
- a technical director or architect
- a schedule
- a division of labor
- interface definitions among the parts
What Brooks calls "producer" sounds very much just like "manager" or "technical lead manager" to me while "technical director" seems to map very closely to what I think I know of as "tech lead". (In the group I'm reading this with, we had noted some of the roles he described seemed a bit unfamiliar, but here even if the names are different, the roles seem pretty close to what we have today.)
He talks about three possible arrangements between producer and director: same person, director reports to producer, or producer reports to director. He illustrates the 3rd arrangement, which I don't believe I've seen in real life, with a quote from Heinlein's "The Moon is a Harsh Mistress" where the top engineer is happy to be freed from management work.
Monday, April 19, 2021
x XOR y MOD 9 in R
x <- 1:32
image(x, x,
outer(x, x, FUN=function(x, y) (bitwXor(x, y) %% 9) != 0),
col=c("white", "black"))
dev.copy(png, "~/x_xor_y_mod_9.png")
dev.off()
Looking forward to creating a GIF using the gifski package, which I learned about from gganimate, which I'm also looking forward to exploring.
Friday, April 16, 2021
Zooming out on x ^ y % 9
import os.path
from contrib import gif
from org.das2.graph import DasColorBar
def xor_mod_plot(n=256, modulus=9):
x = outerProduct(linspace(0, n - 1, n), ones(n))
plot(gt(bitwiseXor(x, transpose(x)) % modulus, zeros(n, n)), renderType='nnSpectrogram>rebin=noInterpolate')
dom.plots[0].setColortable(DasColorBar.Type.GRAYSCALE)
gif.plot_to_gif(xor_mod_plot, os.path.expanduser('~/autoplot/xor_mod_zoom.gif'),
keyword_params=[dict(n=n) for n in range(4, 513)], delay_tenths_sec=5)
The only change required for the GIF-writing code was the call to writeToBufferedImage(), which required an explicit import when used within the library:
from org import autoplot
...
images.append(autoplot.ScriptContext.writeToBufferedImage())


