2012-04-07

Daily Mail Stealing Images

There are lots of scumbags on the web. Spammers, content farms, and Daily Mail is one of them.

If you don't have time, check out the first 2 articles:

  • Daily Mail Used My Photos Without Permission and Without Payment By Michael At Gakuranman. @ Source gakuranman.com
  • The Daily Mail knowingly and commercially used my photos despite my denying them permission. By Alice Taylor. @ Source www.wonderlandblog.com
  • Daily Mail accused of lifting Flickr image [new update] By Olivier Laurent. @ Source www.bjp-online.com
  • Daily Mail sued for copyright infringement [update 2] By Olivier Laurent. @ Source www.bjp-online.com

Xah Emacs/Elisp Tutorial Update 2012-04-07

New version of my emacs tutorial ready.

If you've bought it before, please just email to xah@xahlee.org with subject “emacs tutorial upgrade”.

If you haven't bought it yet, you can get it for just $10. See: Buy Xah Emacs Tutorial. Currently about 350 html pages, about 1k pages printed.

Also, you can subscribe my emacs blog from g+, facebook, twitter, or Google Reader. See: Xah Lee Feeds. Help spread the word. Thanks.

ErgoEmacs br-native Portuguese efficient keyboard layout

One of the layout supported by ErgoEmacs Keybinding is pt-Nativo for Portuguese. (➲ Supported ErgoEmacs keyboard Layouts) The website for br-native is gone.

Here's a page containing basic info about the pt-Nativo layout, and the installation files for Windows and Linux. pt-Nativo (Portuguese) Efficient Keyboard Layout (Thanks to Xavier Pinho for the archive.)

User Interface Design: Stop Shrinking my Screen!

I have a 20″ screen, but my software force it to 2″ screen.

Twitter direct message screen 2012-04-06
Twitter's interface for direct message, as of 2012-04-07.

more at: http://xahlee.org/comp/ui_design_peepshow_window.html

2012-04-06

Spamlicious: Buy Twitter, Facebook Followers, and YouTube Views

As i wrote a blog about spammer that sell twitter follower, another spammer commented right there peddling their selling of followers. Spamlicious: Buy Twitter, Facebook Followers, and YouTube Views

buy twitter facebook followers 2012-03-27-2
Buy twitter and facebook followers, and YouTube views!

User Interface Design: Internet Explorer 9's Dysfunctional Colorful Tabs

Perm URL with updates: http://xahlee.org/comp/ui_design_colorful_tabs.html

Internet Explorer has colorful tabs. Look:

Internet Explorer 9 UI tabs 2012-04-04
Internet Explorer 9's colorful tabs. 2012-04-04

With a casual glance, can you tell which is the current tab?

Here's Firefox tabs. Better.

Firefox UI tabs 2012-04-04
Firefox's tabs. 2012-04-04

The best is Google Chrome's tabs.

Google Chrome UI tabs 2012-04-04
Google Chrome's tabs. 2012-04-04

Ryan Dahl, on History of Node.js

Perm URL with updates: http://xahlee.org/comp/Ryan_Dahl_-_history_of_node_dot_js.html

Ryan Dahl - History of Node.js

Ryan Dahl, mathematician, inventor of node.js, is funny to watch. Watch it to learn the nature of node.js. Javascript is fantastic.

thanks to meowcat for link.

Aftermath: Population Zero

Aftermath: Population Zero.

Aftermath: Population Zero, Canadian special documentary film, published in 2008 on the National Geographic Channel. See Wikipedia for a textual summery of the film.

2012-04-04

many emacs related updates, 2012-04-04

many emacs related updates

updated: Ask ErgoEmacs.

updated: Problem of Calling Unix grep in Emacs

updated (new page): Inconsistency of Emacs Text-Searching Features

updated (new page): Emacs Lisp: Change Case by Title Convention

when quitting emacs save-buffers-kill-terminalCtrl+x Ctrl+c】, emacs will ask to save unsaved buffer, but doesn't switch it to front to let you see.

Is there a hook or variable to make it so?

Note: save-buffers-kill-terminal eventually calls save-some-buffers. According to its inline doc, it says you can press 【Ctrl+r】 to view the buffers in question. (this doesn't work in ErgoEmacs for some reason, i'll have to look into) In anycase, i want automatic switch.

Ctrl+h s】 calls “describe-syntax”. nice.

other keys i learned in past months and use heavily are:

  • Ctrl+x Ctrl+j】 (dired-jump). Switch to dired and put cursor on current file.
  • Ctrl+x Ctrl+q】 (toggle-read-only). I use it only in dired, which actually calls dired-toggle-read-onlywdired-change-to-wdired-mode. Lets you change file names by edit.

Emacs: man for woman?

got this comment.

«You define man as an alias for woman? woman doesn't work all the time, if it fails, how do you invoke man?»

major lol. ☺ (See: Emacs: Defining Alias to Increase Productivity.)

Btw, why doesn't alias man to woman work? I have this alias: (defalias 'man 'woman) but it still calls man when M-x man.

Here's why, answer given by Stefan Monnier:

The reason is that 〔woman.el〕 begins with (require 'man), so when you call man, it autoloads woman, which loads man, which redefines man thus overwriting your defalias.

So, to get what you want, do this:

(defalias 'man 'woman)
(eval-after-load 'woman '(defalias 'man 'woman))

emacs lisp for text processing and wishes

Elisp is really cool.

been using it to do text processing like perl for several years now. About every day, my script goes over few thousand files. (doing report, or find/replace. Though, the files sizes are each under 100k) No problem. (caveat: always use with-temp-buffer or with-temp-file, never use find-file to open file, else it can be 40 times as slow. (➲ find-file vs with-temp-buffer))

recently ditched my last perl and python scripts i use daily for this purpose. (one perl for validating local links of html files. one python for find/replace)

It's slower than perl/python, but fast enough for interactive use, and more powerful. More powerful is especially true when you need to deal with nested things such as html that's out of regex's reach. (because with emacs's buffer datatype, you just move the cursor about, save positions, grab text, etc. (From my perl and python experience, all you can do there is apply regex to each line or whole file. Anything more complex than that gets complex quickly, and you basically have to start to implement your own text buffer, or use/write a parser.))

(just did a speed comparison of my perl and elisp script that check local links of 5k html files. The script algorithm used are not exactly identical, but do the same thing for my need. Perl runs 20 seconds. Elisp 44 seconds. (the elisp is called interactively in emacs, as opposed to emacs --script ‹script name› in shell.))

2 wishes:

  • Wish elisp would have some heredoc mechanism (perl/php heredoc, or python's triple quote). Because the emacs regex backslash escape is practically unreadable (which leads to major problem in regex find/replace if you slipped a slash).
  • Wish elisp can spawn background process, so that while something is running it doesn't freeze the world over. (i don't actually wish it introduces threads, which i knew little about, but knew it's shit in a programing lang. I hope it to be something more like unix's background process.)

2012-04-03

If You Meet a Designer, Whack His Head

if you meet a guy who's a designer and is going over the fine points of design, whack their heads immediately and walk out.

designers in general are the type of guy that's the charlatan types. Language design, website design, architecture, even movie director (e.g. Quentin Tarantino), and verging into the general wishy-washy arts department.

e.g. Larry Wall fuckhead about language and English. Paul Graham about language design (arc) and “hackers”, and painters! Gazillion website design “lectures” or “guides” all over the web, whose recommendations change with weather. Then UI design hubbub hubbub. Then the writing guilds on style. The entirety of typography idiots who ado about nothing (e.g. Knuth, greatest idiot of this arena among computer scientists who fell for it). Then, art of photography, haute couture, fashion design, …. Then, at the edge of the universe, there comes the real artsy folks who lectured on music composition that doesn't contain a single note, or splash of paint as finest art, in museums all over the world.

Sure, design exists, is necessary, and there's good ones and bad ones, with some science based principles. But, more often than not, designers are just a bunch of losers who have too high a opinion of themselves. The successful ones, sell snake-oil.

Google Blogger Dynamic UI Need Your Cookies!

New discovery. In blogger sites that use dynamic interface, e.g. http://xahlee.blogspot.com/, the site won't load unless you have COOKIES on too. You need javascript on of course. But the surprising thing is that you ALSO need cookies turned on. This is interesting, because cookies are not technically required for dynamic UI.

The Meaning of Lisperati and Emacsen

Lisperati means lispers, lisp coders.

however, i just tried to google it for some definite confirmation. I think i read it in the 1990s from The Jargon File or LISP FAQ in newsgroup.

Strange, didn't find it after 5 min. Not in wikipedia lisp article. Was sure it's in jargon file or Online Free Computing Dictionary. Neither. comp.lang.lisp group search turned out 2 or so results other than lisperati.com (Conrad Barski, the LAND OF LISP book guy and alien lisp logo guy). Tried google group search 1990 to 2000, no result. (am pretty sure it's there, but google group search has been fucked since about 2005)

btw, emacsen is the hacker's jargon for the plural of emacs.

(thanks to Tim Bradshaw and Yuriv Khan for a correction.)

2012-04-02

Google Tech Talk, Lisp at JPL by Ron Garret

Dearly beloved lisperati,

I present you, Ron Garret (aka Erann Gat — aka Naggum hater and enemy of Kenny Tilton), at Google Tech Talk

The Remote Agent Experiment: Debugging Code from 60 Million Miles Away, Google Tech Talk, (2012-02-14) Presented by Ron Garret.

(thx to jcs's blog for the news)

Lisp read-from-minibuffer Propels Deep Questions

Perm URL with updates: http://xahlee.org/comp/lisp_read-from-minibuffer_propels_deep_questions.html

slightly frustrated with emacs lisp “read-from-minibuffer”. Spent now about a hour on this.

what i want is simple, like this:

(read-from-minibuffer
 (format "Directory (default %s):" default-directory) default-directory )

prompt user to enter a dir, with default of current dir.

however, according to inline doc of “read-from-minibuffer”, the second arg for default input is obsolete. Instead, you have to use the 6th arg. (info "(elisp) Text from Minibuffer") Quote:

(read-from-minibuffer PROMPT &optional INITIAL-CONTENTS KEYMAP READ
HIST DEFAULT-VALUE INHERIT-INPUT-METHOD)

the doc is long so i won't paste here. See it by calling “describe-function”.

Now, so i do:

(read-from-minibuffer
 (format "Directory (default %s):" default-directory) nil nil nil nil default-directory)

doesn't work. Read the doc again, it turns out that the 4th arg must be true in order for the default value to work, else you get empty string if the user just press Enter.

So i do:

(read-from-minibuffer
 (format "Directory (default %s):" default-directory) nil nil t nil default-directory)

No go! because if the 4th arg is true, it means the input as a string will be fed to lisp reader, then interpreted as a lisp object. Hot damn. This means, if you want a string, you have to feed it "\"mystring\"". (the outter string makes it a lisp string to be fed to lisp reader, then, the inner string gets you a lisp string object)

So, now i have to do this:

(read-from-minibuffer
 (format "Directory (default %s):" default-directory) nil nil t nil (format "\"%s\"" default-directory) )

But no! Because, now if user actually enter a value, e.g. type mary, lisp reader freaks out. Again, it doesn't undertand what the letter sequence mary is. It wants a string "\"mary\"". So, user will have to actually type "mary" for this to work.

WTF?

This line is supposed to be done in 20 seconds. I think i've spent 40 min on this. Now, my mind wanders to the deep question of humanity….

Xah

Intro to Mathematica Pattern Matching for Lisp Programers

updated

I need to traverse a list of lists, where each sublist is labelled by a number, and collect together the contents of all sublists sharing the same label. So if I have the list -

((0 a b) (1 c d) (2 e f) (3 g h) (1 i j) (2 k l) (4 m n) (2 o p) (4 q r) (5 s t))

where the first element of each sublist is the label, I need to produce -

((a b) (c d i j) (e f k l o p) (g h) (m n q r) (s t))

I do this with the following -

(defun test (list)
  (loop for j in list
          for index = (first j)
          for k = (rest j)
          with indices = nil
          if (not (member index indices))
            do (pushnew index indices)
            and collect k into res
          else
            do (nconc (nth index res) k)
          finally (return res)))

I suspect that there is a more efficient and elegant way of doing this, however. Any suggestions welcome.

Brief background: this is part of a program I've written for reading data from SDIF files, a binary format which stores sound description data. The labelled lists represent partials in spectral analysis data (partial-index, time, frequency).

solution and explanation in Mathematica and Scheme lisp, Qi lisp, at http://xahlee.org/UnixResource_dir/writ/notations_mma.html

2012-04-01

Emacs: Single Key for isearch

one of the key i use the most often is isearch.

if you want a single key to do isearch, you can define it this way.

(global-set-key (kbd "<f8>") 'isearch-backward)
(global-set-key (kbd "<f9>") 'isearch-forward)

(defun xah-isearch-hook ()
  "Hook for `isearch-mode-hook' "
  (define-key isearch-mode-map (kbd "<f8>") 'isearch-repeat-backward)
  (define-key isearch-mode-map (kbd "<f9>") 'isearch-repeat-forward)
  )

(add-hook 'isearch-mode-hook 'xah-isearch-hook)

See: How to Override Keybindings in Emacs.

Unicode use: The Wave Dash 〜

Perm URL with updates: http://xahlee.org/comp/unicode_symbols_use.html

This is the nth episode of Xah's rectification of typographical convention! (➲ The Writing Style on XahLee.orgThe Moronicities of Typography: Hyphen, Dash, Quotation Marks, Apostrophe)

Today, i decided to use the unicode WAVE DASH for date range.

Traditionally, it's done by a EN DASH . However, that has several ambiguity problems. It's impossible to tell it from a minus sign. This is especially important in scientific contexts. Quote from Wikipedia Dash:

The Guide for the Use of the International System of Units (SI) recommends that when a number range might be misconstrued as subtraction, the word “to” should be used instead of an en dash. For example, “a voltage of 50 V to 100 V” is preferable to using “a voltage of 50–100 V”. It is also considered inappropriate to use the en dash in place of the words to or and in phrases that follow the forms from … to … and between … and ….[9][10]

The sources [9] [10] are:

  • Judd, Karen (2001). Copyediting: A Practical Guide. Menlo Park, Calif: Crisp Publications. ISBN 1-56052-608-4.
  • Loberger, Gordon; Kate Shoup Welsh (2001). Webster's new world English grammar handbook. New York: Hungry Minds. ISBN 0-7645-6488-9.

A couple years ago ≈2009, i tested in browsers about displaying the wave dash. At the time, some browser doesn't show the char. But today, all major browsers do. At the time, i decided to use the FIGURE DASH for date range. Now, i replaced all of them on my site to the wave dash. About 480 occurrences.

For examples where date range happens a lot, see:

Use of ALMOST EQUAL TO ≈

Also, i often use the TILDE ~ in front of a year to indicate approximate date, e.g. {“I use Dvorak layout since ~1993”, “Place a ~5 cm thick book in front of the keyboard”}. I've been trying to find a proper symbol for that. The closest is the ALMOST EQUAL TO . But am not sure about that because that symbol should between 2 quantities, as a relation, in some strict sense. Anyhow, today i decided to adopt this symbol in front of a date/number to indicate approximate/in-exact date/quantity. Not completely satisfied, but it's still better than the promiscuous tilde. For files with several use of ≈, see: