Other dynamically-changing stuff.

Last night I was browsing the newest iTouch apps, and I saw one called LEDBanner. It allowed you to scroll text across your screen as if your screen was a set of LEDs. My only problem with it was that I couldn’t programmatically change the text. Fortunately the source was available, and so, with only minor changes, I now have a version which lets me change the text to whatever I want.

For instance, the following scheme code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#! /usr/bin/gsi
(define (flmod x y) (fl- x (fl* (floor (fl/ x y)) y)))
(define (%100 time) (flmod (floor (time->seconds time))
(fixnum->flonum 100)))
(define (f)
  (begin
    (with-output-to-file
      (list
        path: "~/Library/Preferences/org.akamatsu.LEDBanner.msg"
        truncate: #t)
      (lambda () (display (%100 (current-time)))))
    (thread-sleep! 3)
    (f)))
(f)

changes the text every three seconds to the number of seconds, modulo 100. Which turns out to be a mostly-random number, as shown below.

The number 8.