Posts

Showing posts from February 20, 2011

emacs lisp: generate a ID

I want a command to insert random strings, as a ID. So i wrote one: (defuninsert-random-string () "Insert a random alphanumerics string of length 6." (interactive) (let (mycharset (ii 0) ) (setq mycharset ["1""2""3""4""5""6""7""8""9""0""a""b""c""d""e""f""g""h""i""j""k""l""m""n""o""p""q""r""s""t""u""v""w""x""y""z" ] ) (while (< ii 6) (insert (elt mycharset (random (length mycharset)))) (setq ii (1+ ii) ) ) ) ) O emacs! ♥See also: Emacs Lisp Examples (Page 1)

vi, Emacs, Keybinding Design

Perm url with updates: http://xahlee.info/kbd/vi_emacs_keybinding_design.htmlvi, Emacs, Keybinding DesignXah Lee, 2011-02-24fortunatus <daniel.elia...@excite.com> wrote:You must be a Windows user. You must also not be an Emacs power user, because you think it's acceptable to use the arrow keys as cursors. If you don't, please use C-b, C-f, C-p, and C-n in place of the arrow keys. It dramatically improves speed.Rafe Kettler <rafe.kett...@gmail.com> wrote:Don't go down that path: "vi" has a way-better key binding for cursor movement!!it should be noted, that vi's hjkl is not optimal. Better isijklin inverted T shape.also, note that vi's Esc is FAST route to RSI. See: Left Wrist side-to-side Motion Pain; vi Esc key Syndrome.also note, emacs keys and vi keys, are not out of much conscious design. Like unix tool bags, they are piled on over the years without much thinking. It was good enough, at the time. In fact, most things in life are like that.…

What is Al Jazeera? and What's Al Hurra?

Image
Perm url with updates: http://xahlee.org/Periodic_dosage_dir/what_is_Al_Jazeera.htmlWhat is Al Jazeera?Xah Lee, 2011-02-25 Discovered Al Jazeera. Recently on the news due to 2011 Egyptian revolution. Some selected quotes:Al Jazeera is an international news network headquartered in Doha, Qatar. Initially launched as an Arabic news and current affairs satellite TV channel with the same name, Al Jazeera has since expanded into a network with several outlets, including the Internet and specialty TV channels in multiple languages. Al Jazeera is accessible in several world regions and is owned by Qatar Media Corporation.The original Al Jazeera channel's willingness to broadcast dissenting views, for example on call-in shows, created controversies in the Arab states of the Persian Gulf. The station gained worldwide attention following the September 11, 2001 attacks, when it was the only channel to cover the war in Afghanistan live from its office there.Where is Qatar?Qatar is a tiny count…

Emacs Custom Keybinding to Enhance Productivity

Perm url with updates: http://xahlee.org/emacs/emacs_useful_user_keybinding.htmlEmacs Custom Keybinding to Enhance ProductivityXah Lee, 2005, ..., 2011-02-24Here are some practical emacs keybinding suggestions to enhance productivity. If you don't know the basics of how to define keys, see: Emacs: How to Define Keyboard Shortcuts.Insert Special CharactersYou can create a shortcut to insert frequently used unicode characters. You can add few chars, or a systematic character set.;; example of systematic keys to insert math symbols (global-set-key (kbd "<kp-6>") "→") ; numeral keypad 6 (global-set-key (kbd "M-i a") "α") ; Alt+i a (global-set-key (kbd "M-i b") "β") (global-set-key (kbd "M-i t") "θ") ;; some Hyper keys to insert common unicode chars (global-set-key (kbd "H-3") (lambda () (interactive) (insert "•"))) ; bullet (global-set-key (kbd "H-4") (lambda () (interac…

bad advice programers give for keyboarding

Perm url with updates: http://xahlee.org/kbd/programer_keyboarding_advice.htmlBad Programer Keyboarding Advices (Typing, Ergonomics, RSI)Xah Lee, 2011-02-23Here are some points i think most programers are not aware of when discussing keybinding choices or keyboarding practices.Important Variables in Keyboarding• What keyboard you use matters a lot. e.g. full sized keyboard vs laptop keyboard. Even between full sized keyboard, there are major differences that effect good keybinding design or good keyboarding habit. e.g. standard PC keyboard vs split ergonomic ones vs radical ones such as Kinesis. • There's major difference between those who touch type and those who don't. Good typing tips or keybinding design for one is usually not good for the other.• Expected amount of typing per day matters a lot. Good advices for programers are not good for heavy duty data entry clerks (or writers and editors). Among programers, the actual amount of typing varies a lot too. Good advices or …

internet and the future

Perm url with updates: http://xahlee.org/js/old_internetnet_terms.htmlInternet, Future, Old School Net LingoesXah Lee, 2011-02-22NY Times is reporting how South Korea is planning on gigabit internet, and how it, and Japan, and few other countries are way ahead of US.The article is here: 〔http://www.nytimes.com/2011/02/22/technology/22iht-broadband22.html〕 (i despise NY Times that requires you to register. Fuck them & die.)As tech gallops into the future, it is apparent that internet is the primary pillar of communication. In many respects, it's already more important than telephone networks, or radio, TV .See also: Internet Users World Map. Geek Reaction to New MediaFor many of us older geeks, many of the internet phenomena were regarded as gimmicks and fads. I can remember the dot com days, where online stores first started (was called e-store or e-commerce), and it was experimental — nobody knew if they gonna stick. Then there's AOL flood (see: Eternal September), then ther…

emacs rant or a glimpse of xah lee life 2010

my wanton emacs rant, sure to alienate supportors. Source groups.google.com

emacs lisp: vectors & lists

Perm url with updates: http://xahlee.org/emacs/elisp_list_vector.htmlEmacs Lisp Tutorial: List & VectorXah Lee, 2011-02-21This page is a practical tutorial of Emacs Lisp's list and vector datatype. If you don't know elisp, first take a look at Emacs Lisp Basics.Lisp has vector and list datatypes. These are similar to other language's list, vector, array.VectorsTo create a vector, write it like this (vector a b …).If you do not want the elements evaluated, write it like this: [a b …]. Creating a vector:;; creating a vector (setq v (vector 3 4 5)) ; each element will be evaluated (setq v [3 4 5]) ; each element will NOT be evaluated Length: (length (vector 3 4 5)) Getting a Element:use “elt”. (elt (vector 3 4 5) 0) ; ⇒ 3. index starts at 0 Changing a Element:use “aset”. (setq v [3 4 5]) (aset v 0 "b") v ; ⇒ ["b" 4 5] Nested Vector;; nested vector [[1 2] [3 4]] ; 2 by 2 matrix [8 [3 [2 9] c] 7 [4 "b"]] ; random nested vector Looping Thru Vector…

direct vs indirect communication (Steven Pinker Talk)

Image
Perm url with updates: http://xahlee.org/Periodic_dosage_dir/Language_and_Human_Nature.htmlDirect vs Indirect Use of Language (Steven Pinker Talk)Xah Lee, 2011-02-15Language and Human NatureA fantastic video that explains why we often do not talk directly what we mean, to friends, bosses, or peers. The video is just 10 minutes, by Steven Pinker (b1954), a specialist in psycholinguistics, at Harvard University.“RSA Animate - Language as a Window into Human Nature” Here's some kinda personal notes about the video. (won't make good sense if you haven't watched the video.)We use indirect communication all the time. Between friends, on a date, in work place, in meetings... we leave open to others to pick it up and decided its meaning. There are many reasons why we do this. Often, being direct would be impolite, blunt, inappropriate, or even have adverse consequences with respect to our intention when compared to using indirect communication.• language does 2 things. ① convey som…

Chinese revolution à la Egypt?

Perm url with updates: http://xahlee.org/Periodic_dosage_dir/chinese_revolution_a_la_egypt.htmlChinese Revolution à la Egypt?Xah Lee, 2011-02-20It appears, there's some news report about how chinese people is calling for a revolution following the recent 2010–2011 Tunisian uprising and Egyptian Revolution of 2011.After 20 min digging, i find this report most reliable:China police break up ‘protests’ after online appeal (2011-02-20) @ Source www.bbc.co.ukQuote:Calls for people to protest and shout "we want food, we want work, we want housing, we want fairness", were circulated on Chinese microblog sites.The message was first posted on a US-based Chinese-language website.Several rights activists were detained beforehand and three people were arrested in Shanghai, but the call for mass protests was not well answered.So, who started it? The “US-based Chinese-language website”, according from another site, seems to be “Boxun.com” (also boxun.us, peachhall.com). I spent 10 mi…

emacs lisp: all about find & replace

Find & Replace is a central mechanism in text processing, especially in emacs. I took few hours to edit and re-organize several articles i've written that are all related to find & replace. Here's the re-organized index. It gives a much more clear view on what each article is about and how they relate to each other.Using a Elisp Function for Dynamic Replacement StringRegex Replace with a FunctionReplacement String Based on File NameAdding “alt” to HTML Image TagsMulti-Pair String ReplacementFind & Replace Multiple String PairsMulti-Pair String Replacement with ReportElisp Package: Multi-Pair String Replacement: xfrp_find_replace_pairs.elMulti-Pair Find & Replace ApplicationsIf you like them, please support the site. You can support by buying computer stuff from Amazon links here. USB drives, keyboard & mouse, iPad, mobile phones, laptops, DVDs, …. Or, you get get all my emacs and elisp tutorial (~300 articles) for just $5. (See bottom of Xah Emacs Tutorial.) Or, you can s…