All Your Links Are Belong To Us!
If you came by way of a search engine and did not find exactly what you were looking for, try the
People who may think me ungrateful rather than incompetent
Smart people I ought to read more
Those who have cared to comment
Well-connected
Can’t help myself
Self-linked... creepy, or crappy?



|
|
 |
|
|
Friday 15 November 2002
|
|
| |
Journaling Details. Apple: File System Journaling. Note that Apple does not refer to it as a "journaling file system", but rather as "a robust new journaling feature for the Mac OS Extended (HFS+) file system". Note also that it's clearly only supported for Mac OS X Server. [Daring Fireball]
2:19:47 AM
|
|
[The Creation of a Constraint-based Programming Language]. I had to paraphrase the title to fit the maximum length, it's really:
The Definition and Implementation of a Computer Programming Language Based on Constraints, by Guy L. Steele (thesis)
This is a really wonderful piece of writing. What I got out of it was an introduction to constraint-based programming, a gentle tour of growing a language bit by bit, and an amazing demonstration of Lisp techniques for writing interpreters that fit in neatly with their host environment. (And I only read the first half!)
That said, it is book-length and the electronic copy is a scan. The result is 20 megabytes and challenging to print - but well worth the effort. [Lambda the Ultimate] Steele Jr
2:18:31 AM
|
|
|
|
Monday 4 November 2002
|
|
|
Sunday 3 November 2002
|
|
| |
By the way, today is the one-year anniversary of the TiBook. Er, my TiBook.
I know because I am struggling to register its APP before the end of the one-year cutoff. No go.
:.(
On a brighter note, OmniWeb seems to be picking up the Userland control for text editing, which Navigator does not. On a not-so-bright note, OW is still much slower than Chimera.
8:57:28 PM
|
|
Benchmarking these Smalltalk Luhn implementations:
a _ [ :x | x isValidLuhn] .
b _ [ :x | x isValidLuhn2].
interval _ (50000000000 to: 50000010000).
Time millisecondsToRun: [interval select: a] 18071
Time millisecondsToRun: [interval select: b] 28953
After tinkering around with both algorithms, I realized that keeping a running total is much faster. An even greater speed improvement is achieved by converting the ASCII character to its corresponding integer then subtracting 48, rather than converting to a string then converting the string to a number. So instead of aDigit asString asNumber, doing aDigit asInteger - 48 does better:
Time millisecondsToRun: [interval select: f] 4768
The naive implementation is easier to read, but three to four times less efficient, as it conses up a string from a character. Using (aDigit asInteger - $0 asInteger) might be a slightly more readable compromise. It seems like using a dynamically allocated Collection of any sort seems to be very bad for performance.
Combining the mapped doubled add-the-digits approach with the accumulator approach:
Integer>>isValidLuhn8
| stream accOdd accEven anEven doubleMap |
accOdd _ accEven _ 0.
stream _ ReadStream on: self asString reverse.
doubleMap _ #(0 2 4 6 8 1 3 5 7 9 ).
[stream atEnd]
whileFalse: [accOdd _ accOdd + stream next asInteger - $0 asInteger.
anEven _ stream next.
anEven
ifNotNil: [accEven _ accEven
+ (doubleMap at: anEven asInteger - $0 asInteger + 1)]].
^ accOdd + accEven \ 10 = 0
...seems to yield really good performance (3.5 to 5.5 seconds for 10001 operations) on average, while being only slightly incomprehensible.
11:01:47 AM
|
|
I realized that since credit card numbers are valid Luhn numbers, I could test my algorithm against them. It works for my credit and debit cards, as well as my Waldenbooks Preferred Reader card (from the eighties), but not for my Barnes and Noble card number or the Replay card.
I tested the implementation against those, then another:
Integer>>isValidLuhn2
| str accOdd accEven anEven |
str := ReadStream on: self asString reverse.
accOdd := Bag new.
accEven := Bag new.
[str atEnd]
whileFalse: [accOdd add: str next asString asNumber.
anEven := str next.
anEven
ifNotNil: [accEven add: anEven asString asNumber]].
^ accOdd sum
+ (accEven
inject: 0
into: [:x :y | (#(0 2 4 6 8 1 3 5 7 9 ) at: y + 1)
+ x]) \ 10 = 0
12:41:32 AM
|
|
|
|
Saturday 2 November 2002
|
|
| |
I tried my hand at coding the Luhn algorithm in Smalltalk, as almost every other language seems to have had a shot at it. I am certain that are better implementations than this quick hack, but here it is. It works true for the example case that the accordian guy uses, but having no other test cases, this is what I have. Note that this is in the Squeak dialect, and it attaches to a base class.
Integer>>isValidLuhn
| str accOdd accEven anEven |
accOdd _ accEven _ 0.
str _ ReadStream on: self asString reverse.
[str atEnd]
whileFalse: [accOdd _ accOdd + str next asString asNumber.
anEven _ str next.
anEven
ifNotNil: [anEven _ anEven asString asNumber * 2.
anEven > 9
ifTrue: [anEven _ anEven - 9].
accEven _ accEven + anEven]].
^ accOdd + accEven \ 10 = 0
[update: Whoops. I was using a stripped image (the image I use for my Comanche Swiki), so all the variable names were lost, so I replaced them. The underscore is the keyboard key used for the assignment operator, which in Squeak images renders as a left-pointing arrow. The caret sign is an up arrow and returns from the function.
update: There must be a better implementation, probably using #inject:into:. The implementation above streams through the digits of the integer, accumulating the odd and even digits alternately.
update: I don’t know why the algorithm description insists on adding the digits of the doubled even-positioned digits; it seems to me that the digit-added property holds true even if you add the doubled digits together after, instead of at each step. That is, 35 + 11 and 8 + 2 both ultimately equal one. I don’t remember what this property is called. If that is the case, the implementation above could be simplified to something like, um, oh, wait, never mind. Sequence of actions is important. Never mind.
update: I originally pasted in the file-in version, but I thought if I presented as it is presented in Kent Beck, it would be less scary. Smalltalk really is a pretty language.
update: Whoops, more Smalltalk implementations just popped into my head: here and here.]
10:06:50 PM
|
|
An oldie, but Paul Graham writes for the ages.
Good design...
- ...is simple
- ...is timeless
- ...solves the right problem
- ...is suggestive
- ...is often slightly funny
- ...is hard
- ...looks easy
- ...uses symmetry
- ...resembles nature
- ...is redesign
- ...can copy
- ...is often strange
- ...happens in chunks
- ...is often daring
9:21:47 PM
|
|
|
|
Tuesday 22 October 2002
|
|
|
Monday 14 October 2002
|
|
| |
Another implementation of the SGI GL library, WOGL.
5:20:25 PM
|
|
|
|
Sunday 13 October 2002
|
|
| |
Noodling about.
David Gelernter, the mind behind Linda, has an article at CIO Insight. In the Expert Insight column, an interview with him: Rethinking the GUI for the Big Picture.
Gelernter has been pursuing this vision of a new interface for some time, and has his own company to pursue these ideas. (seen it mentioned Comm of the ACM and Nooface)
He treats lightly with the idea of communities of practice, a term I am only slightly familiar with in its corporate context. I think it may have arisen from postmodernist theory; I think Stanley Fish speaks on the idea of communities of practice, and how an idea of truth arises from these communities by way of a shared understanding. (Remember, postmodernists care little for the idea of an objective truth.)
The idea of streams of information, creating a narrative, has other proponents, such as Ted Nelson and his famous holy grail, the Xanadu project. I believe with ZigZag, Ted Nelson wants to be able to create several streams across the same data, connecting them in different streams to present them in different ways, such as a chronological stream for project history, a criticality stream for project priorities, and, say, several substreams for individuals’ responsibilities in a project.
Scopeware seems to me to be Gelernter’s attempt to unify the lifestreams approach with several other interface ideas he’s presented before.
[by way of MacCentral]
7:44:23 PM
|
|
uptime | cut -d' ' -f3-7 | sed -e 's/.*/say "&"/' | osascript &
Uptime: the Mac OS X killer app (Doc Searls?), but speakable, thanks to Mac OS X Hints.
Going to restart soon, I guess.
[rizal:~] baruz% uptime
11:14AM up 16 days, 13:56, 3 users, load averages: 4.29, 4.37, 4.14
11:15:36 AM
|
|
|
|
© Copyright
2002
Richard Allan Baruz.
Last update:
11/16/02; 5:52:21 PM.
|
|
| November 2002 |
| Sun |
Mon |
Tue |
Wed |
Thu |
Fri |
Sat |
| |
|
|
|
|
1 |
2 |
| 3 |
4 |
5 |
6 |
7 |
8 |
9 |
| 10 |
11 |
12 |
13 |
14 |
15 |
16 |
| 17 |
18 |
19 |
20 |
21 |
22 |
23 |
| 24 |
25 |
26 |
27 |
28 |
29 |
30 |
| Oct Dec |
|
|