## 2010-05-29

### geometric designs thru crop circle

Perm url with updates: http://xahlee.org/crop_circles/crop_circle_1.html

# Geometric Design thru Crop Circle

Xah Lee, 2010-05-28

Crop circles started as a prank, but now has become a medium for geometric designs. Here are some example of beautiful ones.

Crop circle at Diessenhofen, Thurgau, Switzerland. 2008-07-15. Source

This pattern is based on circles on a triangular grid. Such design is called flower of life. Source soulsofdistortion.nl

2007-08-01. Sugar Hill, Aldbourne, Wiltshire UK. Photo: Steve Alexander. Source

2008-07-27. Photo: Steve Alexander. Source

Tidcome Down, Wiltshire, UK. Photo by Steve Alexander. Source

For high school students, you can learn geometry by trying to duplicate these designs on paper. You can use the computer software GeoGebra to draw them interactively. Most crop circle designs are geometrically simple, so that you should be able to look at it, and figure out exactly the center and radius of each circle or triangle or other key points. You'll learn a lot trigonometry and planar geometry.

Once you became familiar with the software, you can make your design such that there are several parameters, so when you drag a point, the design changes. In effect, creating a template that creates many variations of the same style of design.

For example, many design features circles touching circles. Suppose you have a circle of radius 1 centered at (0,0), and a circle or radius 0.66 centered the (0.33,0). So, this circle touches the larger circle. You have now a moon shape (called crescent or lune). Now, create more circles between these circles, all touching the two circles and each other. Your job is to find the center and radius of these circles.

Now, once you have done this, you can create in your GeoGebra software so that you can drag the smaller circle around, and instantaneously see all the touching circles change accordingly. For some math of this, see: Problem of Apollonius.

For info about GeoGebra, see: Great Software for Plane Geometry.

Goto Page: 1, 2, 3, 4, 5, 6

### emacs isearch of current word

Perm url with updates: http://xahlee.org/emacs/modernization_isearch.html

# Emacs Incremental Search Suggestions

Xah Lee, 2010-05-29

This page document a problem with emacs's incremental search feature, with suggested solution.

Emacs's isearch has some problems. Suppose you have this line:

```the delete-current-file is quite useful to me.
```

and your cursor is on the second dash. You want to search the next occurance of the word “delete-current-file”. You have to first move your cursor to the beginning of the word, then press a key for isearch, then another key to select “delete”, another to extend selection to “current”, another to “file”, then press isearch again to find the next occurrence. That's 7 operations. In GNU emacs, it's “M-b M-b C-s C-w C-w C-w C-s”. In vim, it's just a single key press.

## highlight-symbol minor mode

Today i found several solutinos to this. I think one of the best is the package highlight-symbol by Nikolaj Schumacher, at: nschum.de highlight-symbol.

Note that Nikolaj Schumacher has contributed to the extend-selection command in ErgoEmacs, and has wrote several other elisp packages. His code i trust.

To install, place the package at your emacs library load path, for example:

```C:/Users/xah/.emacs.d/highlight-symbol.el
```

Create the “.emacs.d” dir if it doesn't exist already.

Then, put the following in your emacs init file then restart emacs.

```(require 'highlight-symbol)
(global-set-key (kbd "<f10>") 'highlight-symbol-at-point)
(global-set-key (kbd "<f11>") 'highlight-symbol-next)
(global-set-key (kbd "<f12>") 'highlight-symbol-prev)
```

Then, F10 will highlight all occurrences of the current word. F11 again removes the highlights. F12 will move cursor to the next occurrence, and F11 for previous.

(If you want other hotkeys, see: How to Define Keyboard Shortcuts in Emacs)

## isearch-forward-at-point

Another solution is a command isearch-forward-at-point. from platypope.org blog.

When you want to start isearch on the current work, just call isearch-forward-at-point. You can give it a hotkey too.

```;; I-search with initial contents.
;; original source: http://platypope.org/blog/2007/8/5/a-compendium-of-awesomeness
(defvar isearch-initial-string nil)

(defun isearch-set-initial-string ()
(remove-hook 'isearch-mode-hook 'isearch-set-initial-string)
(setq isearch-string isearch-initial-string)
(isearch-search-and-update))

(defun isearch-forward-at-point (&optional regexp-p no-recursive-edit)
"Interactive search forward for the symbol at point."
(interactive "P\np")
(if regexp-p (isearch-forward regexp-p no-recursive-edit)
(let* ((end (progn (skip-syntax-forward "w_") (point)))
(begin (progn (skip-syntax-backward "w_") (point))))
(if (eq begin end)
(isearch-forward regexp-p no-recursive-edit)
(setq isearch-initial-string (buffer-substring begin end))
(add-hook 'isearch-mode-hook 'isearch-set-initial-string)
(isearch-forward regexp-p no-recursive-edit)))))
```

## 2010-05-28

### math decorative patterns on a sphere

Perm url with updates: http://xahlee.org/math/decorative_pattern_on_sphere.html

# Decorative Pattern on Sphere

Xah Lee, 2010-05-26

Sphere with two-point pattern. “A two-point spherical Islamic star pattern with nine-pointed and ten-pointed stars. Created using custom-designed software, with a tiny bit of postprocessing in Rhino.” photo source

This is created by Craig S Kaplan, a expert of mathematical decorative patterns.

You can actually buy this, as a real object. \$13 USD. Place it on your desk or coffee table, sure to attract admirers. Buy it at shapeways.com.

For some interesting read, see: Islamic Star Patterns in Absolute Geometry (2004-04) By Craig S Kaplan, David H Salesin. ACM Transactions on Graphics 23(2):97-119, April 2004. Source

### spiral in nature; violin scroll

The neck of a unfinished violin. Source.

For more, see: Spirals in Nature.

## 2010-05-27

### new version of ErgoEmacs keybinding

A new version of ErgoEmacs Keybindings is out. Version 5.3.3, released on 2010-05-27. Major new features are:

• Ctrl+p now asks for confirmation before printing
• Copy and Cut to will copy/cut current line if there's no text selection.
• Support for UK layout.
• Support for UK Dvorak layout.
• You can now change keybindings, e.g. if it conflict with other minor modes.

Full detail is in the version history file in the package.

Download at: ErgoEmacs Keybinding.

## 2010-05-25

### Emacs Spell Checker Problems

Perm url with updates: http://xahlee.org/emacs/emacs_spell_checker_problems.html

# Emacs Spell Checker Problems

Xah Lee, 2010-05-25

This page discuss emacs's spell checking feature, its problems, and some practical tips.

## flyspell-mode Problems

Emacs has a spell checking feature (flyspell-mode), that check spelling errors while you type, much like all other modern editors, word processors, email programs, or text box in browsers. However, emacs's spell checking feature is much worse than the spell checker in browsers or any commercial editor.

When you have flyspell-mode on, it slows down your editing noticeably. Normally, when you hold down “Ctrl+” (forward-word), the cursor moves fast across lines to the place you want. But with flyspell on, the cursor freezes, and when you release the key, the cursor shows in some other place. Essentially, the screen is not updated so often. This is just not workable.

Another problem is that if you open a document, with flyspell-mode on, it does not automatically check the spelling of all existing text. I think it only checks word at your cursor positions. (which explains why you can't move cursor fast across words.)

### speck-mode

There is a alternative, called speck-mode, which i've been using since ~2007. Like other spell checking feature in commercial editors, it does its work in the background quietly when you are not doing anything. However, getting speck-mode setup isn't trivial, especially on Windows, because you have to install the spell checking engine. (one of ispell, aspell, hunspell) Basically, you need to be a emacs expert to get it to work.

Also, in most commercial software, the spell checker will eventually check the whole document, but speck-mode only checks texts that's visible portion of the window. I haven't looked into if it is possible to change this.

## speck-mode, Great Code, Bad Everything Else

speck-mode's author is Martin Rudalics, who seems to have published a paper on Common Lisp in ACM back in 1989. (See: Distributed copying garbage collection (1986) by Martin Rudalics, at Source) So, apparently the guy seems to be a old lisper who knows what he's doing as far as the code goes. However, speck-mode is one of those mode that only few emacs people know or use. It lacks much documentation (it has none!). Me and David Capello have made the whole spelling system work with speck-mode in our ErgoEmacs distribution, out of the box. It worked, better than flyspell, but isn't perfect. And i haven't really put that much time into fixing issues. (See: issue 51, issue 56, issue 74. )

Today, doing some work on ErgoEmacs, i thought why not send a email to Martin and see if there's a new version. Indeed, there is, and he send it to me.

However, he told me that there even isn't a public location for the mode. The one that appears on emacswiki at emacswiki SpeckMode is from 2008-07-26. Gah!

Here's the latest version speck.el 2010-05-25.

I tried to incorporate this version into ErgoEmacs, but run into problems... gah. Will need to work on it, probably half a day. Here's the error:

```Debugger entered--Lisp error: (wrong-type-argument stringp nil)
intern(nil)
(cond ((eq speck-engine ...) (intern speck-aspell-default-dictionary-name)) ((eq speck-engine ...) (intern speck-hunspell-default-dictionary-name)) ((eq speck-engine ...) (intern speck-ispell-default-dictionary-name)))
(or speck-saved-dictionary (cond (... ...) (... ...) (... ...)))
(setq speck-dictionary (or speck-saved-dictionary (cond ... ... ...)))
(if (and (local-variable-p ...) speck-dictionary) nil (setq speck-dictionary (or speck-saved-dictionary ...)))
(unless (and (local-variable-p ...) speck-dictionary) (setq speck-dictionary (or speck-saved-dictionary ...)))
speck-activate()
(if speck-mode (speck-activate) (speck-deactivate))
(let ((last-message ...)) (setq speck-mode (cond ... ... ...)) (if speck-mode (speck-activate) (speck-deactivate)) (run-hooks (quote speck-mode-hook) (if speck-mode ... ...)) (if (called-interactively-p) (progn nil ...)))
speck-mode(toggle)
call-interactively(speck-mode t nil)
execute-extended-command(nil)
call-interactively(execute-extended-command nil nil)
```

## OpenSource Spell-Checking Engines

Besides the bad quality of the spell checking feature, the open source spell checking engine ispell and aspell are also much inferior than commercial ones, lacking much words and commonly accepted spelling variations, with the exception of Hunspell.

See Wikipedia: Hunspell. It is based on MySpell, which is based on Ispell, and probably with input from Aspell. So, the Open Source spell checking engines roughly goes from Ispell→Aspell→Hunspell. Note that Hunspel is used by Firefox, Opera, Google Chrome, Apple Mac OS X.

See also: Problems of Open Source Dictionaries.

## How to Always Have Spell Checker On

A little practical tip. By default, spell checker isn't even on. However, if you want it always on, you can put this code in your emacs init file:

```(defun turn-spell-checking-on ()
"Turn speck-mode or flyspell-mode on."
;; (speck-mode 1)
(flyspell-mode 1)
)

(add-hook 'text-mode-hook 'turn-spell-checking-on)
```

Also, there's the command flyspell-buffer that checks the whole file, but alas, it is slow. While it works, your emacs is frozen.

This article is written with respect to Emacs version 23.1.1 (2009-07-29)

Thanks to Martin Rudalics for speck-mode, for sending me the latest version and allowing me to post it, and answer some of my questions. David Capello did the work for getting hunspell engine to work in ErgoEmacs on Windows. Of course, thanks to flyspell author (Manuel Serrano), emacs developers, and the open source spell engine authors.

### Unicode BOM Byte Order Mark

Perm url with updates: http://xahlee.org/comp/unicode_BOM_byte_orde_mark.html

# Unicode BOM Byte Order Mark

Xah Lee, 2008-12-18, 2010-05-25

Some notes on unicode's Byte Order Mark. Quote from Wikipedia:

The byte order mark (BOM) is a Unicode character used to signal the endianness (byte order) of a text file or stream. Its code point is U+FEFF. BOM use is optional, and, if used, should appear at the start of the text stream. Beyond its specific use as a byte-order indicator, the BOM character may also indicate which of the several Unicode representations the text is encoded in.[1]

Because Unicode can be encoded as 16-bit or 32-bit integers, a computer receiving Unicode text from arbitrary sources needs to know which byte order the integers are encoded in. The BOM gives the producer of the text a way to describe the text stream's endianness to the consumer of the text without requiring some contract or metadata outside of the text stream itself. Once the receiving computer has consumed the text stream, it presumably processes the characters in its own native byte order and no longer needs the BOM. Hence the need for a BOM arises in the context of text interchange, rather than in normal text processing within a closed environment.

Some points of personal interest:

• The BOM char is “U+FEFF” (zero-width no-break space).
• The BOM char's use as a zero-width no-breaking space is deprecated since unicode 3.2 (published in 2002). That char's semantic is now for BOM only. “U+2060” (WORD JOINER) is now used for non-breaking space.
• The primary purpose of BOM is to indicate byte-order (big endian vs little endian) in systems or situations that need this info in the file.
• It is not needed in UTF-8, since UTF-8 encoding unit is a byte, so doesn't have the byte-order issue.
• When used in UTF-8, it just give a indication that it is unicode.
• In unix-like OSes, BOM for utf-8 may cause problems due to the Shebang (Unix) hack. However, many Window software add BOM to utf-8 files, e.g. Notepad.

See also: http://www.unicode.org/faq/utf_bom.html.

Also note, the page “http://www.unicode.org/faq/utf_bom.html” by the unicode standard creation organization, is invalid HTML (as of 2008-12-18). Pretty ridiculous. See validation result here: validator.w3.org. (it is valid as of 2010-05-25)

See also: HTML Correctness and Validators.

## 2010-05-24

### Second Life XstreetSL Item Disappears

Perm url with updates: http://xahlee.org/sl/xstreetsl_item_disappears.html

# XstreetSL Item Disappears

Get your Xah Particle Maker today!

There's a really bad bug in XstreetSL. If you item has multiple languages, and when you edit the page or add a language, the item will disappear, for about 2 to 3 days.

This is now a known issue, as jira bug 114.

Here's some detail of my story.

This happen to me too. I make slightly over \$100 usd per month, and the primary product that made this happen is a particle making machine.

My item is this xstreetsl.com ItemID 1387599.

It does have multiple languages which i added long ago.

On 2010-05-20, i tried to update the description for a new manual, and bang, the item disappeared. I went into panic. Spend 2 hours eventually found a place to post to Linden Labs support, and also posted to xstreet market place forum. Just got a notice from support today (2010-05-24) that points me to this jira bug page.

It'd very bad for me particularly because i have hundreds of note cards in all manuals and advertisements, already distributed in-world, that points to the xstreet url. As well all my documents and advertisement on my website pointing to this url. I also have ratings and user comments on the item. The item is also a featured item i paid for about a year now.

Glad that the item came back though. (4 days)

Hope Lindens will fix this asap.

Now i'm afraid to edit the page.

Want to dash through walls?
Try Xah Tele-Dasher!

## 2010-05-23

### Martin Gardner (1914-2010)

Perm url with updates: http://xahlee.org/math/Martin_Gardner.html

# Martin Gardner (1914-2010)

Xah Lee, 2010-05-23

Martin Gardner died yesterday, at age 95 (1914-2010). He is the one who started me on the path of math. From about 1990 to 1995, i read pretty much all of his recreational math books (collection of his Scientific American column), as well as several of his pseudo-science debunking books. It is him, that made me decided that math is my career. (which turned into programing)

## Conway's Game of Life

Of his recreational math articles, the one subject i think that taught me the most is his intro to Conway's Game of Life (GoL). It introduced to me, back then a shocking idea, that deterministic behavior does not imply predictability. (in the 1990s, chaos theory, and computer drawing of fractals, run rampant as pop science. It was even highlighted in Hollywood movies such as Jurassic Park.)

I've spent months playing the Game Of Life in 1990s, and every few years i'd re-visit and checkout what's the latest software of it or any theoretical advances. The last i checked, few years ago, GoL has been advanced quite far, to the point that people are starting to construct animated messages like those Dot Matrix Displays. (See the logo of the software Golly as a example. You can find Golly at Great Software for Cellular Automata.)

GoL has been proven to be Turing complete in i think late 1990s. Seems trivial now, but wasn't so at the time. Also, Rule 110 has been proven to be Turing Complete, arguably the “most simple” cellular automata to be proven so. Also note, that there are quite a few models of Universal Turing machines, and in 2007, Wolfram proposed a problem with \$25k USD award for anyone to prove that a 2-state 3-symbol CA is Turing equivalent. Alex Smith came forward and got the prize, though not without some dispute from a accomplished computer scientist. For detail, see: Wolfram's 2-state 3-symbol Turing machine.

GoL started me a life long interest in Cellular Automata, and have read about it much since. (See: Notes on A New Kind of Science)

## Tiling

Another math area i learned much from Martin is Penrose tiling. Its discovery and popularization sent a shock wave in science community. Namely, the concept of aperiodic tiling and quasicrystals, and aperiodic tiling of just 2 prototiles exists.

Tiling and symmetry has also become a life long interest for me. I've spend few years studying it in late 1990s. See:

Martin's writings introduced me into so many math subjects. Math board games, puzzles, fractals, regular polyhedrons, geometric dissections, probability, game theory, number theory, cryptanalysis... See Great Math Programs for many software i collected mostly in late 1990s related to these topics.

(i despise professional mathematician's sneering attitude toward these recreational math subjects, or discrete math subjects like combinatorics, with their cryptic jargons of topology and analysis fuck.)

## Other Books

Other books by Martin Gardner that i remember well are his Annotated Alice In Wonderland, his book The Ambidextrous Universe: Mirror Asymmetry and Time-Reversed Worlds, and pseudo science debunking book Science: Good, Bad and Bogus.

The Alice book has become my favorite book of all times, if i can just name one book without any qualifications. I read his annotated version, twice, in separate years, once in ~1988 and once in early 1990s. I made a website of this book with full text and image galleries: Alice in Wonderland & Through the Looking-Glass.

The central attraction of Alice to me, besides the math and logic allusions, is that Alice the character, to me represents the epitome of logical positivism attitude and personality. Logical positivism is my philosophy, introduced to me and influenced me by my favorite author Bertrand Russell.

In my teen years and much of early 20s, i have strong interest in paranormal stuff, like ghosts, ufos, bigfoot, psychics etc. My un-informed but studious mind explored these topics thru reading many books, beginning foolishly by reading books of these proponents cranked out, teaching you things such as how crystals emit energy, sitting inside the center of pyramid can heal wounds, how to focus to bend spoons, alien abductions, etc. This beginner reading eventually lead to science readings such as pseudo-science debunking books, astronomy text books, as i went thru college at the time. Martin's science debunking book in particular had a impact with my affairs in Scientology. (See: Scientology and Falun Gong )

### AjaxLife, a web browser based Second Life viewer

Perm url with updates: http://xahlee.org/sl/blog.html

The emerald guys are announcing AjaxLife, a web browser based, text-only, Second Life viewer. So, if you are on a lousy computer with no graphics card and just want to login to chat with your friends or get your IMs, that seems a good solution. Start using here: http://ajaxlife-0.modularsystems.sl/.

It works. Pretty neat.