Tag Archives: book

For Dummies

Farmville for Dummies Betting on Horse Racing for Dummies

Yes, they’re real books.

Genesis 1 vs Genesis 2

shrubberyGenesis is the first book of the Holy Bible. It is found in every translation of the Old Testament; it is canon in Christianity as well as Judaism. Setting aside external counter arguments (science), let us examine the Scripture itself. Citations are from NIV unless otherwise indicated. The NIV is not God’s literal word, but it is one of the better English translations available. In any case, the structure of Genesis is the same across translations; it would even be scholastically acceptable to use the KJV here.

In Genesis 1, God creates the world:

  1. Heaven and earth (Gen 1:1-2), light, day, and night (Gen 1:3-5)
  2. Sky (Gen 1:6-8)
  3. Land and sea (Gen 1:9-10), plants and trees (Gen 1:11-13)
  4. Sun, moon, and stars (Gen 1:14-19)
  5. Sea creatures and birds (Gen 1:20-23)
  6. Land creatures, both livestock and wild (Gen 1:24-25), then mankind (Gen 1:26-31)

In Genesis 2, God affirms his creation:

Thus the heavens and the earth were completed in all their vast array.

—Gen 2:1

By the seventh day God had finished the work he had been doing; so on the seventh day he rested from all his work. Then God blessed the seventh day and made it holy, because on it he rested from all the work of creating that he had done.

—Gen 2:2-3

After resting for a day, God groggily amends creation:

Now no shrub had yet appeared on the earth and no plant had yet sprung up, for the LORD God had not sent rain on the earth and there was no one to work the ground, but streams came up from the earth and watered the whole surface of the ground. Then the LORD God formed a man from the dust of the ground and breathed into his nostrils the breath of life, and the man became a living being.

—Gen 2:5-7

Was man created before shrubberies or after?

Update: Biblical scholars have arrived at the JPED hypothesis, that the Torah is a compilation of earlier works, known as J, E, P, and D. Much of the earlier material was redacted and transformed before it became the Torah. Thus contradictions were introduced, because different authors supplied different stories.

Review: Heraclitean Pride

book coverMagus Magnus’ Heraclitean Pride is a creative commentary on the recovered fragments of Heraclitus, a Greek philosopher known for an obsession with words (“logos”) and change (“amoibe”).

Magnus offers a refreshingly unique translation of Heraclitus with a variety of strategies for readers to engage the text. Most noticeably, Magnus deliberately articulates his commentary in short, stunted sentences, mimicking the extant Heraclitean quotes. Magnus is extremely playful, weaving philosophical and poetic thought in analytic and conversational rhetoric.

However, the core of Magnus’ commentary is word association, an analytical method more typical of child’s play. Magnus is a passionate lover of Heraclitus, but to some, Heraclitean Pride may read as a mockery of the original sayings. The stop-and-go form was, after all, a by-product of the burning, ripping, and simple loss of Heraclitus’ writings. In playing with text, Magnus invites many outsiders to philosophy, but risks losing fellow Heraclitus lovers, including classic logicians and historians. Heraclitus didn’t write. In. Stilted Greek. Heraclitus wrote in normal, flowing sentences, and what little has survived of his writings should not be toyed with as we see fit. The publisher, Furniture Press Books, may or may not have made a Freudian slip in the book cover of Heraclitean Pride, which reads in the lower-right corner, Magnus Pride.

DRM Strikes Again!

kopimiS. John Ross’ Risus is a really cool role-playing system made by Cumberland Games. They’re cool enough to give away the basic guide for free, and a solo campaign as well (PDF).

Unfortunately, they’re not cool enough to give away “Ring of Thieves” as an unprotected PDF. For the layman, that means PDF software will refuse to copy portions of the document. Modifying metadata isn’t allowed either.

Why is this a problem? Because I like to sort books by last name first on my Kindle. When I put the freely available “Ring of Thieves” on my Kindle, it fails to sort under Ross, John, or even S. As far as Kindle is concerned, the file has no author. Ordinarily, a little tweak by Calibre would fix this problem.

But, the PDF is protected, so no metadata can be edited. I can’t even save to a new PDF and fix that one. I have a couple options:

  • Plead Cumberland Games to provide an unprotected version.
  • Install PDF unlocking software (they’re all crappy shareware).
  • Read the book on something other than my Kindle (why the fuck did I get one then?)
  • Figure out the decryption algorithm, and post it online anonymously.
  • Save to PostScript, then back to PDF.
  • Screencap every single page, then save the images to PDF.
  • Build a time machine and travel to whenever Congress learns that DRM is an aggravating inconvenience for honest users, a mere challenge for hackers.

Update: Someone has posted a Perl crypt script. Very hard to find, that. It does work, but I’m still having trouble editing metadata. Stupid Kindle refuses to sort by PDF author information.

PDFs Suck

A Google Books rendition of Charles Caleb Colton’s “Lacon”:

TEne&E are three difficulties in authorship; to write any thing worth the puhlishing-^to find lionest men to publish it?and to get sensible men to r6adit. Literature has now beconie a game

Apologies to Google and Colton: I doubt I could do any better scraping PDFs for text. ePUBs are better because HTML is better:

  • Always searchable
  • Always reflowable – important for mobile devices
  • Easily transformed into other formats
  • Easier to render
  • Small file size

Reading programming books on the Nook

Programming books are hard enough to read: cryptic jargon, poor phrasing, blatant omission of critical details… the list goes on. But it’s even harder to read technical books on the Nook (or any ereader for that matter), because of some limitations of HTML (ePubs are zipped XHTML files).

HTML was not designed for consideration of really small screens. Coders typically use an 80-character margin for easy viewing on medium and large screens. So when a code snippet is shown on the Web, it also assumes a medium or large screen. Textbooks are also pretty big surfaces for code. That’s why Real World Haskell and Practical Common Lisp don’t chop up their code blocks very much. Both the print versions and the electronic versions rely on a big surface for viewing–about 80 characters or more.

Not surprisingly, when this code is viewed on a Nook, the code is cut off. Here’s an example:

PRE-Normal.epub

#!/usr/bin/env runhaskell

module Magic where

import Text.Printf

magic :: String
magic = unlines $ map magic
        where
                magicN :: Int -> S
                magicN n
                        | n > 0 && n

main :: IO ()
main = putStr magic

This is not valid Haskell code. It’s not even readable Haskell code. What’s the rest of the n > 0 && n condition? What happens after that condition is met?

The solution is to instruct Nook (and any other HTML viewer) to wrap the code and set it to a reasonable size (10pt or less). Add the following to the ePub’s CSS:

pre {
	font-family: Andale Mono, "Courier New", Courier, monospace;
	font-size: 80%;

	overflow-x: auto;
	white-space: -moz-pre-wrap !important;
	white-space: -pre-wrap;
	white-space: -o-pre-wrap;
	white-space: pre-wrap;
	word-wrap: break-word;
}

Now the code is readable. Choppy, at least you can see all of it.

#!/usr/bin/env runhaskell

module Magic where

import Text.Printf

magic :: String
magic = unlines $ map magicN [1..7]
        where
                magicN :: Int -> String
                magicN n
                        | n > 0 && n <
8 && n /= 4 = "09 f9 11 02 9d
74 e3 5b d8 41 56 c5 63 56 88 " ++ printf
"%02x" (0xbc + n)
                        | otherwise                = "
                 [ redacted ]                  "

main :: IO ()
main = putStr magic

Update: I received a Kindle for Christmas (will blog Kindle vs Nook soon). It turns out the Kindle automatically wraps PRE tags, and the above CSS ruins that wrap. To reiterate, Nook books require explicit PRE wrapping, but that same explicit wrapping destroys Kindle’s excellent autowrap.

Syntactic barriers to learning Common Lisp

lisp logoFunctional programming is blessed to have several hardy languages. I have only tried two: Haskell and Common Lisp. From the few tutorials I’ve completed, it seems that Haskell is easy to learn, and Lisp hard to learn.

This difference is, I believe, due to Lisp’s various and sundry dialects, implementations, and macros. In Haskell, there are two major ways to specify local variables: let and where. Common Lisp has at least four: let, let*, flet, and labels. CL has a retarded number of loop constructs. I’m currently reading a sample chapter from Land of Lisp. Here is a code snippet:

(defun find-islands (nodes edge-list)
  (let ((islands nil))
    (labels ((find-island (nodes)
	       (let* ((connected (get-connected (car nodes) edge-list))
		      (unconnected (set-difference nodes connected)))
		 (push connected islands)
		 (when unconnected
		   (find-island unconnected)))))
      (find-island nodes))
    islands))

The defun syntax is intuitive; it’s like any other language’s function creator. And let makes sense: create some local variables and use them in sub-expressions. But labels baffles me. Would let have sufficed? Why or why not? After googling for a while (there is NO useable, complete Common Lisp reference document, and that includes HyperSpec and the Simplified Common Lisp Reference), I stumbled on a half-readable description of labels.

LABELS is special form for local function binding.

I could have told you that.

Bindings can be recursive and can refer to each other.

So labels is just like defun, defvar, and friends?

Each binding contains function name, arguments, and function body.

It seems that labels is just a special way to do defun locally. If Lisp is so powerful, why doesn’t Barkski do this:

(defun find-islands (nodes edge-list)
  (let ((islands nil))
    (defun find-island (nodes)
      (let* ((connected (get-connected (car nodes) edge-list))
	     (unconnected (set-difference nodes connected)))
	(push connected islands)
	(when unconnected
	  (find-island unconnected))))
    (find-island nodes)
    islands))

Nested functions don’t require special syntax in Haskell, Python, or Lua. Why should they in the premier functional language? I think the answer is that CL allows nested defuns, but lispers aren’t happy with that–they want a closure they can use in if, cond, and other non-code-block areas. A combination of let and lambda would do just that, but macro-addiction dictates that a new syntax be created. Now we have labels.

So that’s defun, let, and labels. Then there’s let*. Apparently let* is similiar to flet, which is similiar to labels , which is similar to let, except that I’ve forgotten where the fuck I was going with that. These macros are simply variations of let, some more powerful than others.

Land of Lisp does explain these macros, but if they weren’t used in the code, they wouldn’t have to be explained. Or, Barski could have used a separate example for each macro, but that would have taken more pages. There must be a balance between code simplicity and time to get the game running. I understand his dilemma. But if he errs to often on the side of code obscurity, then readers will simply close the book. I don’t know if I can write an informative and entertaining programming tutorial as well as Barski does, but I know what I like in one, and it’s not a never-ending stream of new syntax. I’m still going to buy the book, and I’m still going to love it. It’s just going to take longer for me to parse than I had expected.