2010-11-20

Logitech Trackball Mouse Reviews

Perm url with updates: http://xahlee.org/Periodic_dosage_dir/logitech_trackball.html

Logitech Trackball Mouse Reviews

Xah Lee, 2009-12-24, 2010-11-02, 2010-11-21

Logitech Wireless Trackball M570

Logitech Wireless Trackball M570 2-s

“Logitech Wireless Trackball” amazon

This is their latest product. Just came out in 2010-09.

This is a improvement over the classic “Logitech Trackman Wheel” (the red ball). Here's major improvements:

  • A scroll wheel! Excellent.
  • 2 extra programable buttons. (used for example for next/previous page history for browser) This is extremely convenient.
  • Laser tracking tech. (as opposed to “optical” using LED. Laser offers more precision.)
  • Wireless.
  • Tiny USB receiver.

Overall, it got positive reviews. However, compared to the classic “Logitech Trackman Wheel” (red ball), the ball is smaller and is a little more stiff to spin. This is also twice as expensive.

Review of “Logitech Wireless Trackball M570” by jared0x90.

Logitech Trackman Wheel

Logitech Trackman Wheel tmw440

“Logitech Trackman Wheel Optical”. amazon

The “Logitech Trackman Wheel Optical” is the most popular. The great thing is that it is well designed for right hand, and has standard scroll wheel for middle finger. However, the ball is small, and for the thumb. For general use, it's ok, but it lost one major advantage of trackball's ability to control the speed of the pointer position between slow and fast in a way that doesn't requires you to change dpi settings.

Thumb Operated vs Long Finger

A veteran trackball user ( nsrpgmiv ), who has owned many different models of trackballs, made a comment that i think is very insightful and i agree with much. He pointed out that trackballs designed for the long fingers is much easier to operate than the thumb. This you can easily test yourself. With thumb operated ball, it assumes your palm sits still, thus your thumb movement are limited. In particular, going up and down is of limited range. With index finger operated ball, you can spin it easily, side ways, or up down. Your hand can easily hover over the ball freely. For him, he preferred the Logitech Marble than the Trackman Wheel.

Review: “Battle of the Logitech TrackMans”, by “BrickSh0t7”. In this review, he compares the 2 Logitech mouses, in particular their use in First Person Shooter gaming.

Logitech Trackman Marble

Logitech Trackman Marble

“Logitech Trackman Marble Mouse” amazon

The “Logitech Trackman Marble Mouse” is probably the best trackball on the market now. The ball is not the largest, but largish, and it spins well. It got 4 buttons. Got excellent reviews, and pretty cheap. (can get for $20) Missing a scroll wheel would probably be the only flaw, but for this symmetric design, it's hard to place a scroll wheel.

I'm not sure how flexible is the software for this trackball. From a physical operative mechanism point of view, the concept of trackball pretty much includes the functionality of scroll wheel. Some trackball has a button or re-programable button, so that when it is pressed, the ball functions as a scroll wheel.

Review of Logitech Trackman Marble Mouse, by “BrickSh0t7”.

Logitech Cordless Optical Trackman

Logitech Cordless Optical Trackman

“Logitech Cordless Optical Trackman”. amazon

At first, you'd think that “Logitech Cordless Optical Trackman” is the best one on the market now. Big ball, 5 buttons, cordless, plus a scroll wheel! However, after reading reviews, this mouse has several problems. The ball doesn't spin as compared to the Logitech Marble, the buttons are hard to use, the scroll wheel is not much usable.

Review of Logitech Cordless Optical Trackman, by “BrickSh0t7”.

For reviews of other brand trackballs, see: Best Trackball Mouse.

2010-11-19

Using iframe to Embed Youtube Videos

Perm url with updates: http://xahlee.org/js/youtube_iframe_embed_video_code.html

Using iframe to Embed Youtube Videos

Xah Lee, 2010-11-19

In 2010-07, Google introduced a new html format for embedding youtube videos.

This is the original:

<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/h7XjOK_DSmo?fs=1&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/h7XjOK_DSmo?fs=1&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>

The following is manually crafted code using valid html with “object” tag:

<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/h7XjOK_DSmo" width="480" height="385"><param name="movie" value="http://www.youtube.com/v/h7XjOK_DSmo"></object>

The following is the new iframe format they are offering:

<iframe title="YouTube video player" class="youtube-player" type="text/html" width="480" height="390" src="http://www.youtube.com/embed/h7XjOK_DSmo?rel=0"></iframe>

Here's how it looks in browser:

The new format using iframe is much better, because, according to Google's youtube blog at Source:

If you use the new embed code style, your viewers will be able to view your embedded video in one of our Flash or HTML5 players, depending on their viewing environment and preferences. [...]

An additional benefit of the new embed style is that it will eventually allow embeds to work on mobile devices, which typically use a built-in player instead of Flash or HTML5.

The iframe is also better because:

  • The actual video html code is fetched dynamically, so you don't have to worry about keeping up-to-date of all your embedded video codes on your site, in case any youtube format changes or feature changes in the future.
  • You don't have to worry about browser compatibility of your embeded video code now. Google takes care of that.
  • The iframe tag is shorter and simpler.
  • If you are a html validity worrywart like me, with iframe you have less to worry about. Technically, there's no 「type="text/html"」 attribute for “iframe” tag, so Google's new html is still incorrect, but it's far better than the extremely complex “embed” tag, or manually crafting and maintaining the not-widely-supported “object” tag.

Best Mouse For Programers

Perm url with updates: http://xahlee.org/kbd/razer_naga_mouse.html

Best Mouse for Programers and AutoHotkey Keyboard Macros

Xah Lee, 2009-12-18, 2010-11-19

While shopping for a gaming mouse, a interesting one i noticed is the “Razer Naga MMOG Laser Gaming Mouse”. This mouse has 17 buttons!

Razer Naga Mouse

“Razer Naga MMOG Laser Gaming Mouse” amazon

Razer Naga Mouse Razer Naga Mouse

At first i thought this would be the most stupid mouse. I thought that, some geek thought more button is better, so idiotically jam'd the mouse with cellphone number keys. The result would be very painful to use. However, from reading amazon.com's reviews, apparently it is usable.

Thinking about it for a while, i think this could be actually a very good mouse. The buttons probably can be operated by touch without sight easily for at least half of the number buttons.

Razer Naga Review

Why You Need 17 Programable Keys?

When this mouse first came out in 2009, the number keys are not programable. But with version 2 of driver, they are programable now! So, a mouse with truely 17 programable buttons. That's fantastic. If the numbers are not programable, i'd rate this mouse a avarege 5/10, but with programable buttons, i'd rate it 10/10.

Lots of buttons are good for gamers. But if you are a programer or power user, you'll love this mouse too. A normal mouse with 5 button is not enough. For example, in a web browser, right click is for contextual menu, to get links, or access many Firefox add-on's menu. There's no alternative to replace it (Ctrl + left-click does not work). The middle button is good for opening a link in a new tab, or free-scroll of a long page or wide page, or closing a tab without aiming for that tiny ⌧. The 4th and 5th buttons are good for backward and forward of page history. All used up. It'd be nice to have 2 more buttons for switching to next/prev tab, and another couple for next/prev app window. Also, it'd be nice to have 2 buttons for copy/paste too, because it's so often used.

Actually, for keyboard macro lovers, i'd recommend a gaming keyboard, except that none of them are features ergonomic split keys. But there's Logitech G13 Advanced Gameboard (Review) that's fantastic.

What's Mouse DPI and Does It Matter in Real-Time Combat Gaming?

Perm url with updates: http://xahlee.org/kbd/mouse_dpi.html

What's Mouse DPI; Does Mouse DPI Matter in Gaming?

Xah Lee, 2010-11-19, 2011-01, 2011-04-22

Spent about 6 hours tech geeking on mouse again. Watched quite a few youtube videos on reviews of various gaming mouses.

About mouse, there's something i never understood completely. That's DPI (dot per inch). If a mouse has 800 DPI, supposedly it means: if you move your mouse one inch (2.54 cm), the mouse will be able to send 800 signals. However, it's much more complicated than that.

There are these issues involved:

  • There's USB poll rate (aka USB Report rate) Doesn't matter what's your DPI, if the mouse is using USB interface, the USB will get input from the mouse at a fixed rate. (Windows default is at 125 Hz) (actually, it's more complicated than that. It seems that USB has different protocol. One of them does not rely on regular poll, but i read that nobody uses that because it's more expensive.)
  • There's mouse laser scan frame rate. (Microsoft SideWinder X8 amazon says it's at 13k Hz)
  • There's “max acceleration”. The SideWinder X8 says it has “Max Acceleration: 75 G”. Don't know what the heck that really means.
  • There's also the software layer changes sensitivity. That is, how many pixels to move per signal.
  • There's also software acceleration. That is, pixels per signal over time. The faster you move, the more distance covered.
  • The application may over-ride or ignore your driver's settings. For example, in Second Life, your mouse wheel accelation is ignored.
Microsoft sidewinder x8 mouse 2

“Microsoft Sidewinder X8 mouse”, and a recharger with magnetic connector. amazon

Some gaming mouse software automatically sets your USB poll rate to a higher frequency. Some game also have its own software layer for adjusting your mouse sensitivity. The bottom line is, it's really hard to figure out what is your real settings.

I play real-time combat games (aka “first-person shooter”) in Second Life, and never in my life i find the high DPI useful. I have a Microsoft SideWinder X3 Mouse, with DPI at 2k. But that rate is just not usable. I set it to 800 DPI. LOL. I always doubted whether the DPI matters.

Here's a example of a spec, from the Sidewinder X8:

  • Resolution: 250–4000 dpi (BlueTrack™ Technology)
  • Image Processing: 13000 frames per second
  • Max Acceleration: 75 G
  • Max Speed: 120 inches per second
  • USB Reporting: Full-speed, 500 Hz
  • Wireless Play: Up to 30 hours

Does DPI Matter in Gaming Mouse?

Here's a article from arstechnica that confirms my own experience:

Does DPI matter in gaming mice? One mouse-maker says no (2010-02-10) By Ben Kuchera. @ arstechnica.com

Quote:

"Technology has progressed to a level where you can move your mouse, say, one inch on your desk, and your cursor will move 2 or 3 times your screen length. That sounds impressive for sure, but where is the real value in that?" Rom asked. "That doesn't make you more precise or accurate; I would argue that it does exactly the opposite. A higher DPI in a mouse doesn't offer a lot of value, and it is not a benchmark for how precise or awesome the mouse is. It's simply a measure of sensitivity."

Also, if you dig into hardcore combat game articles online, some'll tell you to set your mouse's DPI to the highest, and turn off any software adjustment of mouse sensitivity. So that you have the highest hardware based precision. This makes sense logically. But in practice, 2k DPI is too fast to be usable.

Also, some site i've read even tells you to even turn off the “acceleration” (aka “enhanced pointer precision”). So that, you have a linear correspondence of your mouse movement and movement of the screen, which supposedly makes you aim/combat better. This sounds logical, but i'm not so sure about it in pracitce.

Because, today, mouse technology, the laser tracking, the DPI, and the mouse software layer, sensitivity adjustment etc, all things considered, are quite robust. It's questionable a little “precision” gained from DPI or some training with linear-mouse-screen training would make any difference. The point is, adjust whatever, and as soon as you feel comfortable and habituated with that setting, it should be fine.

Here's some articles from hardcore gamers, especially the first one is fantastic. It also shows that 800 DPI is plenty for vast majority of hardcore gamers (unless you have several monitors connected).

I still don't understand the DPI in complete technical detail, but in any case, i have learned a few things from my readings.

Over the past year, i've tried to un-installed my Microsoft IntelliPoint mouse software and use Windows default basic mouse driver software. In general, i don't find it much of a advantage. Currently, i use do have IntelliPoint installed, because it provides mouse wheel acceleration setup.

The “acceleration” — changing the pointer movement rate depending on speed you move the mouse — is very useful. For example, when working in photoshop or 3D Modeling Software, when i need precision to adjust a pixel, i can move the mouse slowly, and when i need to fly cross to the screen's corner to press a button, i give the mouse a quick push.

Note, if you uninstalled your mouse driver, you can still use AutoHotkey to remap buttons and be app-specific, but you need to have some programing experience to write AutoHotkey files. See: AutoHotkey Basics.

What's the Difference Between Optical vs Laser Mouse?

Both optical and laser mouse use light technology. Optical mouse uses LED, while laser uses laser. Laser tech can track on more surfaces, at higher frequency.

2010-11-18

Emacs Keyboard Macro Example: Adding HTML Attribute

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

Emacs Keyboard Macro Example: Adding HTML Attribute

Xah Lee, 2010-11-18

This page shows a real world example of emacs keyboard macro use. If you are not familiar with keyboard macro, see: Emacs Keyboard Macro and Examples.

Problem

I have a html page of Printed References On Plane Curves. In that page, there are a list of 34 books with this html format:

<span class="title">Geometry: Euclid and Beyond</span>
<a class="amz" href="http://www.amazon.com/dp/0387986502/?tag=abc-20">amazon</a>

I need the amazon link to contain a “title” attribute. Like this:

<span class="title">Geometry: Euclid and Beyond</span>
<a class="amz" href="http://www.amazon.com/dp/0387986502/?tag=abc-20" title="Geometry: Euclid and Beyond">amazon</a>

To manually fix this, i use isearch to find a amazon link, then search backward looking for the 「class="title">」 to find the title of the book. Move cursor into the markup to copy the title. Search forward to the amazon link again, type 「title="」 then paste, then type 「"」. But i need to do this 34 times?

Solution

Emacs keyboard macro came to rescue me!

Here are exact steps of the keyboard macro:

  • Go to the top of the page. 【Ctrl+Home
  • Type 【Ctrl+x (】 to start recording.
  • Type 【Ctrl+s】 to start isearch.
  • Type 「abc-20">」 to find a amazon link.
  • Type to exit the isearch and leave the cursor there.
  • Type 【Ctrl+r】 to start backward isearch.
  • Type 「class="title">」 to find the title markup.
  • Type 【Ctrl+】 3 times to move the cursor into the text content of the title markup.
  • Type 【Alt+Shift+8】 (select-text-in-quote) to select all the text between the 「>」 and 「<」 (select-text-in-quote is a command available in ErgoEmacs Keybinding package.)
  • Type 【Ctrl+c】 key to copy the title text.
  • Type 【Ctrl+s】 to start isearch then search for 「abc-20"」 again and place cursor there.
  • Type 「title="」.
  • Type 【Ctrl+v】 to paste.
  • Type 「"」.
  • Type 【Ctrl+x )】 to end macro recording.

Then, i move cursor to the top of page, then press 【Ctrl+x e】 to run my kmacro. Each time i do this, one link is fixed. About 30 keystrokes is reduced to just 2 key strokes. I can run my kmacro once for every link to fix, a total of 34 times, or, i can just press 【Ctrl+u 34】 then 【Ctrl+x e】, fixing all links in one shot.

In this case, i actually did it one by one, instead of one-shot, because, often i do not know that the page necessarily have a uniform format. So, doing it one at a time lets me to eyeball change.

This is the beauty of emacs, where everything is interactive. When you work with computer language source code, or sys admin scripts, the texts are almost never in some uniform format. With emacs, you edit the text as usual, but as soon as you see a pattern, you can start a keyboard macro, or even write a simple elisp command, that lets you automate all possibly mechanical steps. When you find the format changes, you can manually fix some irregularity, or just start a new keyboard macro when you see a new pattern. See: Why Emacs is Still so Useful Today and Emacs Lisp Power: Text-Soup Automation.

2010-11-17

Criticisms on Criticisms on a New Kind of Science

Perm url with updates: http://xahlee.org/cmaci/ca/criticisms.html

Criticisms on Criticisms on a New Kind of Science

Xah Lee, 2007

This page is a criticisms on criticisms on the book 《A New Kind of Science》.

Words Wolfram Likes to Use

Some words Wolfram likes to use in his writings: fundamental, quite, rather, “it turns out”, “kind”. Usually used in a manner to qualify his sentence so that it is still true in a broader, general context, but often just makes his statements hazy.

Here's a typical example from p170: “... adding more dimensions does not ultimately seem to have much effect on the occurrence of behavior of any significant complexity.”.

Non-Standard Terminology and Notation

The following are from: 〈Critical Review of “A New Kind of Science”〉 (2002-07-12), by David Drysdale.

Part of the problem is Wolfram's insistance on using his own terminology for concepts and ideas that have perfectly good names in regular mathematics and science. Examples: he always referring to fractals as "nested" (and never makes clear whether the term includes less structured fractals or not), he doesn't refer to well-known pictures by their common name in the main text (such as the Sierpinski gasket or the Koch curve), he calls refers to lossy compression as "irreversible", he insists on using Mathematica notation rather than standard mathematical notation (there may indeed be a million Mathematica users, but there are considerably more who understand normal notation and don't have access to this expensive tool).

There are good justification on the way Wolfram uses his own terms, at least some of them. Usually, Wolfram terms, in my opinion, are better technical terminologies, judged from the point of view on the quality of scientific terminologies. For example, “Sierpinski gasket” or the “Koch curve” conveys nothing about what they are. (one class of scientific jargons that are bad quality is those after a person's name.) Most scientific terms arose and got adopted are due to circumstantial happenings (much like natural languages such as English), not due to design or thought. Thus, a significant portion of scientific terminologies, are rather misleading or blank label, and in general contribute to confusion of the field, in particular in education and for students. (“student” here are anyone learning the field, including expert in other fields) (See: Math Terminology and Naming of Things.)

The term “lossy compression” vs “irreversible compression” are somewhat a tie with regards to the term's quality. They just emphasize 2 different aspects.

Wolfram's use of Mathematica notation instead of traditional math notation, in my opinion, is a good move. First of all, there are selfish motive since after all his company sells Mathematica. But, traditional math notation, as a evolutionary product like languages and terminologies, has a lot ambiguities. Mathematica's notation, is in a sense a actual formal system since it runs as a computer program. In practice, when math notation is used in the book, it doesn't matter whether traditional math notation is used or Mathematica. If the notation is about math, there's little difference other than a few Capitalization or parenthesis (e.g. Sin[x] vs sin(x)). If the notation is a computing code, one has to chose a language anyway. (See: The Problems of Traditional Math Notation.)

Writing Style

It is true that the book is full of aggrandizing bloat. I think, the texts in the book can be made to be 3/4 of its size without losing any info, including how Wolfram thinks of himself and his discovery, and maintaining a readability at the generally intelligent. The bloat and repetition really makes the book hard to read and fuzzy. It is difficult to discern what is exactly claimed.

The justification for his writing style, given on p849., are not that convincing. It basically just further aggrandize himself more.

Particularly annoying to me is that paragraphs are just 1 to 3 short sentences, the tireless repetition that simple program generates complex behavior, insistence of his genius. This adds a lot burden to extracting the technical info in the text.

However, i do support certain aspect of the writing style being non-conformal to standard styles as seen in math journals. Here's few elements that i despise in standard style:

Abuse of Jargons

Publications done by most academics, including text books, tend to use jargons unnecessarily. The reason is precisely to make the text sound more sophisticated. This in fact has become the norm, especially in academic community. Wolfram's NKOS went to the the other extreme by avoiding any jargons entirely, and traditionally recognized lingoes are used only in the Notes section. Regarding this point, this is a excellent exposition principle.

Academicians, as human animals, use jargons covertly or subconsciously to aggrandize themselves. Wolfram overtly and consciously aggrandize himself, but avoid opaque jargons. (See: World Multiconference on Systemics, Cybernetics and Informatics???)

Bibliography As Long List of Titles

The purpose of bibliography is for citing results of the text, or acknowledgment, or to give readers further reference. However, typical academic bibliography tends to be just a huge list of incomprehensible titles, as if to show how erudite the author is. The reader, including other researchers, often have no idea which book sections is significant or worth reading in relation what part of text.

This problem is especially important today, when there are crazy amount of publications in any field. It would be much better, if standard publication force authors to use annotated bibliography. Wolfram's General Notes section, at least do away with such inane list of titles. In fact, he takes the approach of comprehensive survey, with copious commentary. (albeit with possibly many other flaws such as aggrandizing himself or belittle forerunners.)

Useless modesty

When publishing a book, honesty of what one perceives to be important is more important than being modest. A fundamental aspect of modesty, is a social behavior to advance himself (much like politeness). So, in many publications, the author would use “We” as opposed to “I” (which is a historical, social development), even in cases where the author alone worked on it.

It would be better, if publication adopt more emphasis on truth, i.e. the raw thoughts of the author, as opposed to inducing the author to introduce elements of modesty. Perhaps Stephen Wolfram's over doing the honesty bit, or perhaps he truely thought himself as the greatest genius. But at least, we can attack him as he is (which is exactly what happened), as opposed to having a politeness that meddles criticisms (many reviews of books in fact are hampered with politness or the social relation of the persons involved).

Of course, modesty, politeness, are both critical elements of influence and marketing. Easy way to see this is to look at politicians.

Pedantic English grammar

If you have fair amount study of writing, linguistic, logic, you'd know that there are many illogicality and intricacies of natural languages especially English. Conventional English grammar or writing style, often is not completely compatible with clarity and precision. I do find Wolfram writing style hampers reading (all things considered), but not for breaking conventional English writing style at the grammar or syntax level, per se. For example, i think starting a sentences with words like “And”, “But”, “So” is not a problem by itself.

In relation to the above ideas, see:

The Significance of the Book

Many reviewers, in particular some mathematicians and scientists, completely dismiss the book as crank. (e.g. 〈A Rare Blend of Monster Raving Egomania and Utter Batshit Insanity〉 (2005-10), by Cosma Shalizi.) Perhaps the falsity of these reviews are obvious, or that they really just wanted to attack Stephen Wolfram. (it is well known that Wolfram is cocky and has offended many notable mathematicians and scientists. But also, fighting and power struggle in the field of math or science is common and well documented in history) However, here i like to list some less commonly cited reasons why the book is considerable. (the commonly cited reasons include the proof of 110 CA by Matthew Cook and Wolfram's shortest axioms for logic. (p808.)

A Survey of Simple Systems

The book exams thousands of CA or other simple systems and made a report of it. (especially chapters 1 to 6) These explorations, are not trivial. From this aspect, the book can be considered significant at least as a average scientific publication at the research level.

A Recreational Math Text

The General Notes section (p849 to p1197), of 348 pages in small print, can be considered significant at the level of text book, of a person's survey of the sciences and mathematics in relation to CA.

For example, there are lots of books published aimed at the general public, including science popularizing books, recreational math books, computer programing books, and many received great accolades and awards. (e.g. • Douglas R Hofstadter's 《Gödel, Escher, Bach》 amazon. • Martin Gardner's creational math collections. amazonWilliam Poundstone's 《Labyrinths of Reason》 amazon. • Tristan Needham's 《Visual Complex Analysis》 amazon.) These books are not scientific publication or news breaking discovery, but nevertheless are valuable for at least education. Considering the actual info content of Wolfram's book especially the General Notes, it has value at least as significant as these books.

Exemplary Exhibition of Scientific Visualization

Edward Tufte has written books on Scientific Visualization amazon that are widely acclaimed. In my opinion, it is rather trivial to exposit on this matter, as i believe any intelligent person who has put thoughts into creating her illustrations should arrive at the same conclusions or practices. Nevertheless, Edward's book is widely acclaimed in the scientific community. Also, there are awards and seminars in the scientific community for visualization. Wikipedia goes as far to have a article on Information design with citations of journals, organizations, and books published by MIT press. So, these facts tells us that scientific visualization are highly valued by the scientific community.

Wolfram's book, in its literally over a thousand illustrations, are examples of the finest quality of scientific visualization. Mathematica is a powerful tool in creating illustrations, but even for a expert Mathematica programer, a significant percentage of illustrations contained in Wolfram's book are not trivial to create. Some types of the illustrations, e.g. involving networks, Ant CA, 3D CA, complex graph of replacement systems with arrows, etc, will take a expert programer days to create, for each. (or months each, to actually create a robust program as seen in many Java applets on the web created by programers) Perhaps most of these are coded by Wolfram's employees, but nevertheless, the book itself is significant at least for its exemplary exhibition of highest quality and quantity of scientific visualization. If Wolfram wrote and published his ideas in a normal way, it would no doubt win awards.

As Social Movement

Entrepreneurs, even though have contributed nothing to science, but are highly valued by society. In fact, science would make little progress without entrepreneurs. This is a basic understanding for anyone aquainted with sociology. Likewise are great figures in history remembered as educators, reformers. Stephen, due to his wealth, his success with Mathematica, and at least his recognization as a genius for his past contribution to physics, has made his book a relative major impact in the science community. He also, subsequently started a series of websites, lectures, and school for the type of research he is interested in (i.e. what he calls the New Kind of Science). Unless the study of cellular automata is completely worthless for anything whatsoever in science (which is not true), one must then give credit to Stephen at least as a educator or science popularizer, who made the general public aware of a particular math subject, or made a movement in scientific community, or the programing community, on CA. In short, he made a significant influence.

Arguably, popularizing science is only a side effect of his book, where he actually intented to popularize himself. But nevertheless, the end result of his book and websites and investiments into simple programs research, has made non-trivial contribution to science. For example, in 2007 Wolfram offered $25k US dollars for proving or disproving whether Wolfram's 2-state 3-symbol Turing machine is universal. This award is won by Alex Smith, but the proof is however disputed by a well-known computer scientist Vaughan Pratt. If the proof is correct, then this is a significant contribution to science instigated by money (e.g. the Millennium Prize ). If this proof is incorrect, arguably, it contributed to science of more precise understanding of what is meant by universal turing machine.

Other Sites

Collection of books Wolfram owns: http://www.wolframscience.com/reference/books/.

〈Notes on “A New Kind of Science”〉 (2002-2004), by David Drysdale. Detailed notes on each chapter. http://www.lurklurk.org/wolfram/notes.html

Collection of reviews by Edwin Clark: http://shell.cas.usf.edu/~eclark/ANKOS_reviews.html

2010-11-16

Emacs Keyboard Macro and Examples

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

This page shows you how to use emacs keyboard macro feature, with several examples of real world use.

How to Record a Sequence of Keystrokes?

The keyboard macro (kmacro) feature that lets you record and playback keystrokes. The key strokes can include calling emacs commands or commands that execute any emacs lisp functions.

To record keystrokes, press 【Ctrl+x (】 (“kmacro-start-macro”), then start typing your keystrokes. When done, press 【Ctrl+x )】 (“kmacro-end-macro”). This records your keystrokes. If you made a mistake, you can cancel 【Ctrl+g】 (“keyboard-quit”) and start over.

To run the keystrokes you've just recorded, press 【Ctrl+x e】 (“kmacro-end-and-call-macro”) or call “call-last-kbd-macro” or “apply-macro-to-region-lines”.

Command NameKey
“start-kbd-macro”Ctrl+x (
“end-kbd-macro”Ctrl+x )
“kmacro-end-and-call-macro”Ctrl+x e
“call-last-kbd-macro”
“apply-macro-to-region-lines”

Saving Your Keyboard Macro for Future Use

If you want to use your keyboard macro for future use, you can save it. To save the macro:

  • ① Call “name-last-kbd-macro” and give it a name.
  • ② Call “insert-kbd-macro”. This will insert the kmacro lisp code at the cursor position.
  • ③ Copy and Paste the code into your emacs init file.
  • ④ In any future emacs session, you can call your kmacro by name (with 【Alt+x ‹yourMacroName›】).

Once you've saved your macro with a name, you can also give it a keyboard shortcut, such as F8.

Turn Off line-move-visual

When you record keystrokes, it is better that the arrow up/down keys move the cursor by a logical line, as opposed to visual line. (Emacs 23's default is visual line.) To set to logical line, call “set-variable”, then give “line-move-visual”, with value “nil”. (“t” for true; “nil” for false).

When you play back macro, be sure the “line-move-visual” is the same as when you recorded it.

Kmacro Example: Add Title of URL

Here's a example of keyboard macro use. I use macro about few times a month. When you need it, it is extremely convenient.

Today, i have about 60 lines, each line is a URL, like this:

http://xahlee.org/3d/3D_inputs.html

I need it to be like this:

• 〈Mathematical Models of 3D Inputs Control〉
http://xahlee.org/3d/3D_inputs.html

Where the first line is the title of that page.

Here are some of my lines:

http://xahlee.org/Periodic_dosage_dir/Logitech_G13_Gameboard.html
http://xahlee.org/Periodic_dosage_dir/bangu/pinyin_frequency.html
http://xahlee.org/Periodic_dosage_dir/logitech_trackball.html
http://xahlee.org/Periodic_dosage_dir/mouses.html
http://xahlee.org/Periodic_dosage_dir/trackball.html
…

Here's what i do to record this as keyboard macro.

  1. First, replace all http://xahlee.org/ by a web root ~/web/xahlee_org/ (See: Find & Replace with Emacs.)
  2. Move cursor to the first line.
  3. Start kmacro.
  4. Use “ffap” (“find-file-at-point”) to open the file.
  5. Move cursor to top.
  6. Grab the HTML title between <title>…</title> tag, by using “isearch-forward” for <title>, set-mark, then search for <, move cursor 1 position back, then copy it.
  7. Close the file.
  8. Type [], move cursor in, paste the title. (you can later use “query-replace” to replace the […] by • 〈…〉. (or you can insert the bullet and angle brackets directly. (See: Emacs and Unicode Tips.))
  9. Move cursor 2 position down to the next line.
  10. End the kmacro.

Now, each time you call “call-last-kbd-macro”, a line will be processed, with its title inserted at the top.

You can also select all lines that has not yet been processed, then call “apply-macro-to-region-lines”. Then, in about 1 second, all 60 lines become this:

• 〈Logitech G13 Advanced Gameboard (Review)〉
http://xahlee.org/Periodic_dosage_dir/Logitech_G13_Gameboard.html

• 〈Chinese Pinyin Letter Frequency and Dvorak Layout〉
http://xahlee.org/Periodic_dosage_dir/bangu/pinyin_frequency.html

• 〈Logitech Trackball Mouse Reviews〉
http://xahlee.org/Periodic_dosage_dir/logitech_trackball.html

• 〈Review Of Microsoft SideWinder Gaming Mouses〉
http://xahlee.org/Periodic_dosage_dir/mouses.html

• 〈Trackball Mouse Reviews〉
http://xahlee.org/Periodic_dosage_dir/trackball.html

…

In keyboard macro, you can call any emacs command, or even more than one command. Emacs's kmacro feature simply play back the keystrokes.

In general, kmacro is extremely useful whenever you need to do something repeatitive. It is a great time-saver. You do not need to know elisp to use it. Even if you are a elisp expert, many repeatives jobs are still best done with a kmacro. With kmacro, i can finish this job in 30 seconds. But if i were to write a elisp for it, it easly can take 20 min and drains a lot brain juice.

Example: Modify Atom Entries

Here's another example of kmacro use.

I have a webfeed file 〔blog.xml〕 in Atom Webfeed format. There are many entries like this:

<entry>
  <title>…</title>
  <id>…</id>
  <updated>…</updated>
  <summary>…</summary>
  <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>see <a href="http://xahlee.blogspot.com/2011/11/emacs-lisp-exercise-insert-random-uuid.html">http://xahlee.blogspot.com/2011/11/emacs-lisp-exercise-insert-random-uuid.html</a></p>
</div>
  </content>
 <link rel="alternate" href="http://xahlee.org/emacs/blog.html"/>
</entry>

I need to remove the “content” part and simply put the URL in the alternate link, like this:

<entry>
  <title>…</title>
  <id>…</id>
  <updated>…</updated>
  <summary>…</summary>
 <link rel="alternate" href="http://xahlee.blogspot.com/2011/11/emacs-lisp-exercise-insert-random-uuid.html"/>
</entry>

So, kmacro is excellent solution, with these steps.

  1. “isearch-forward” for http://xahlee.blogspot.
  2. “isearch-backward” for ", move cursor forward 1 position, set mark.
  3. “isearch-forward” for ", do a copy. Now the blog URL is in clipboard
  4. “isearch-backward” for <content , set mark.
  5. “isearch-forward” for </content>.
  6. Press delete to delete the content section.
  7. “isearch-forward” for href=.
  8. Do steps to delete the url and paste the new one.

Once i recorded these steps, then i press 【Alt+x】, then 【 Enter】 to execute “call-last-kbd-macro”. This way, every 3 keystrokes makes one entry change. This allows me to visually verify what i've done is correct. I could also press 【Ctrl+u】, then a number, then “call-last-kbd-macro” to repeat it automatically n times.

For another example of keyboard macro use, see: Emacs Keyboard Macro Example: Adding HTML Attribute.

Mathematica 8 is released

Mathematica 8 is released.

I got Mathematica 7 this month, as a gift from Wolfram Research. (before they released 8) (Thanks Wolfram) I haven't actively been coding Mathematica since about 2000. In the coming months, i'll update my tens of Mathematica packages on my site to Mathematica 7.

Mathematica started in 1988 as a so-called computer algebra system. Namely, it lets you do things like solve equations, factor polynomials, do integration, derivative, etc. But, due to Stephen's design, it is also a full featured general programing language, much based on lisp. (he probably would not admit it) But since about late 1990s, Mathematica is more marketed as a technical computing platfrom — a system for doing any technical computation. The reason is simple: because as a math system, the market is very limited, but as a system for any technical computation, it widens its potential audience by some 10 fold or 100. Since mid 2000s, it became increasingly more broad. Although i haven't actively been coding Mathematica, but some quick look at Mathematica 7, it is really fantastic. Dynamic visualization, data center of all technical info, and this year Wolfram Alpha.

Here's things i've done with Mathematica, all or almost all graphics in the following projects are generated by Mathematica version 3 (~1998) or 4 (~2002):

2010-11-15

ErgoEmacs keybinding new version released! At v5.3.7.

A new version of ErgoEmacs keybinding is out! At v5.3.7. Feature highlight:

  • Added open-in-desktop command with key 【Ctrl+Shift+O】.
  • Added Danish layout. Thanks to Michael Budde
  • Added ergoemacs-layout-pt-nativo.el. Thanks to Xavier Pinho

Download: ErgoEmacs keybindings v5.3.7 (Released on 2010-11-15, tested with emacs 23.2.1.)

Visit home page for detailed info: ErgoEmacs Keybinding.