Posts

Showing posts from July 17, 2011

Lisp Celebrities and Computing History from Worse Is Better

Perm url with updates: http://xahlee.org/comp/lisp_celebrities_worse_is_better.htmlLisp Celebrities and Computing History from Worse Is BetterXah Lee, 2011-07-24I just discovered the identies of 2 semi-fictional character in lisp lore.There's a infamous article, known as Worse is Better. Very popular in the 1990s, and still so among lisp circles. The article is:The Rise of “Worse is Better” (1991) By Richard P Gabriel. @ dreamsongs.comIn the article, there's this passage:Two famous people, one from MIT and another from Berkeley (but working on Unix) once met to discuss operating system issues. The person from MIT was knowledgeable about ITS (the MIT AI Lab operating system) and had been reading the Unix sources. He was interested in how Unix solved the PC loser-ing problem. The PC loser-ing problem occurs when a user program invokes a system routine to perform a lengthy operation that might have significant state, such as IO buffers. If an interrupt occurs during the operation…

jcs's lisp code for validating matching pairs

jcs wrote 2 versions in elisp for our previous programing challenge on Validate Matching Brackets.Ι'll be going over his code soon. His blog is well annotated, so is a good one if you are learning emacs lisp, from a different style than mine. His article is at: Xah's Challenge (Part 2) (2011-07-21) By jcs. @ Source irreal.org.

Perl & Python: Print Version String from Script

Perm url with updates: http://xahlee.org/perl-python/print_version.htmlPerl & Python: Print Version String from ScriptXah Lee, 2011-07-22In perl or python, you can print the version of the interpreter from the command line. e.g. perl --version, python --version. However, often you have several versions installed, and you wanted to know which version your script is actually running from. On the command line, there are aliases, links, path environment variables, various shell init scripts (.rc, .profile, .profile, .bash_profile), and it is often complex to find out the exact steps which version your script running off.One absolutely accurate way to know is simply have your script print the version string within.Python#-*- coding: utf-8 -*- # python import sys print sys.version # sample output: # 2.6.5 (r265:79063, Jun 12 2010, 17:07:01) # [GCC 4.3.4 20090804 (release) 1] http://docs.python.org/library/sys.htmlPerl#-*- coding: utf-8 -*- # perl print $^V; # prints version string # samp…

Motherboard Specification: MSI MS-7548 (Aspen)

Image
Perm url with updates: http://xahlee.org/mswin/msi_ms-7548_motherboard.htmlMotherboard Specification: MSI MS-7548 (Aspen)Xah Lee, 2011-05-25The following info is from: Source bizsupport1.austin.hp.com HP Support documentFigure 1: The MSI MS-7548 (Aspen) motherboard Motherboard descriptionManufacturer's motherboard name: MSI MS-7548HP/Compaq name: Aspen-GL8EForm FactorMicro-ATX: 24.4 cm (9.6 inches) x 24.4 cm (9.6 inches)ChipsetAMD 780GFront-side bus speedUp to 5200MT/s (5.2 GT/s) when using compatible AM2+ or AM3 processorProcessor upgrade information Socket type: AM2+ TDP: 125 watt Motherboard supports the following processor upgrades: • Athlon X2 BE-2xxx (Brisbane) (AM2) • Athlon 64 X2 up to 6000+ with Dual Core (Brisbane) technology (AM2) • Athlon 64 X2 up to 6000+ with Dual Core (Winsor) technology (AM2) • AMD Phenom Triple-Core (Toliman) up to 8xxx series (AM2+) • AMD Phenom Quad-Core (Agena) up to 9950, (AM2+) Memory upgrade information • Dual channel…

Emacs Lisp: Getting Command Line Arguments

Perm url with updates: http://xahlee.org/emacs/elisp_command_line_argv.htmlEmacs Lisp: Getting Command Line ArgumentsXah Lee, 2011-07-22Remember, that elisp scripts can be run from the OS's command line. Like this: emacs --script process_log.el (For detail, see: Text Processing with Emacs Lisp Batch Style.)Sometimes you want to pass a argument. For example, like this: emacs --script process_log.el ~/weblog.txt In your elisp script, you can get the argument from the builtin variable “argv”. The “argv” is a alias to “command-line-args-left”. Its value is a list. Each element is a unprocessed item from the command line. The complete command line items, including emacs invocation and any option passed to emacs (e.g. your script name) is stored in “command-line-args”.Here's a sample test script:;; -*- coding: utf-8 -*- ;; emacs lisp ;; 2011-07 ;; a test script. getting arguments from command line (message "Index 0: %S" (elt argv 0)) ; %S is for lisp code (aka sexp, s-exp…

English Writing Style: on The Second Objection to Lots of Fun

Perm url with updates: http://xahlee.org/lit/english_style_lots_of_fun.htmlEnglish Writing Style: on The Second Objection to Lots of FunXah Lee, 2011-07-22On the Second Objection to Lots of FunBy Xah Lee
July 21, 2011
Department of Philology
Bovine UniversityAbstractIn the human endeavor of composition with a writing system that is known as English language in most western world today, there is the objection of style known as the First Fundamental Objection to the use of lots in precedence of fun with a preposition of of as to form the clause lots of fun.We present here the Second Fundamental Objection to lots of fun on the grounds of logic, from a application of logical positivism's interpretation of Occam's razor.The First Fundamental Objection is well known in the work A Dialogue Between Men of Letters: “Lots” of “Fun”! [1]. we quote the passage:lots has lots of meanings like a meaning lot, the pedantic lot, almost chosen by lot. When we are in the lot where lots meanings a…

Lisp, Python, Perl, Ruby Code to Validate Matching Brackets

The verdict is out: Preliminary report of a little programing challenge last week: Lisp, Python, Perl, Ruby Code to Validate Matching Brackets.

A Dialog Between Men of Letters: “Lots” of “Fun”!

Perm url with updates: http://xahlee.org/lit/a_dialog_between_men_of_letters.htmlA Dialog Between Men of Letters: “Lots” of “Fun”!Xah Lee, 2011-07-21Xah Lee wrote:a very fun exercise. …Peter Moylan wrote:Since you're cross-posting this to alt.usage.english, it's worth pointing out that we don't say “very fun” here.Xah Lee wrote:very means like “very much”. Fun means fun. You don't say “vary fun”? Like, you mean varing degrees of fun or vagaries of fun but you don't say it? Or, but you write it and speak it?I know not what it means.Stephen wrote:“Fun” is a noun and most English speakers object to it being used as an adjective, and even more to an adjectival intensifier such “so” or “very” being attached to it.Unless you couldn't care less about English usage, as a native speaker you would write “so much fun.” Your example would have to be amended, too, but it's a little harder to find an alternative that does not require more words (maybe this is a reason f…

new blog: Xah's Belles-lettres Blog

Started a new blog: Xah's Belles-lettres Blog @ http://xahlee.org/lit/blog.html.It's on topics of {vocabulary, english writing, literature, languages, linguistics matters}. (go there to read the detail.)If you want to subscribe just those, go there subscribe there. New articles there may or may not be shown here.

Emacs Lisp: Batch Script to Validate Matching Brackets

Perm url with updates: http://xahlee.org/emacs/elisp_validate_matching_brackets.htmlEmacs Lisp: Batch Script to Validate Matching BracketsXah Lee, 2011-07-19This page shows you how to write a elisp script that checks thousands of files for mismatched brackets.The ProblemSummaryI have 5 thousands files containing many matching pairs. I want to to know if any of them contains mismatched brackets.DetailThe matching pairs includes these: () {} [] “” ‹› «» 〈〉 《》 【】 〖〗 「」 『』.The program should be able to check all files in a dir, and report any file that has mismatched bracket, and also indicate the line number or position where a mismatch occurs.For those curious, if you want to know what these brackets are, see:Intro to Chinese Punctuation with Computer Language Syntax PerspectivesSyntax Design: Use of Unicode Matching Brackets as Specialized DelimitersFor conveniences about selecting or navigating brackets in emacs, see:Emacs: Defining Keys to Navigate Brackets“extend-selection” at A Tex…

emacs tip: inserting source code in org-mode

emacs tip: inserting source code in org-modeWhen using org-mode, you can insert a snippet of proraming language code.Type <s then Tab. It will insert this markup: #+begin_src ▮ #+end_src The above is the syntax for literal text. (similar to the concept of perl and PHP'S Heredoc.)Then, type “emacs-lisp” so you have: #+begin_src emacs-lisp #+end_src this tells org-mode this snippet is emacs-lisp code. The “emacs-lisp” there can be any mode. e.g. “html”, “perl”,“haskell”, etc. (technically: the value of the variable “major-mode”, then minus the “-mode” string at the end.) orgmode.org 15.2 Easy TemplatesFor basics of org-mode, see: Emacs: outline-mode and org-mode tutorial.

Emacs Lisp: Processing HTML: Transform Tags from ‹span class=w› to ‹b›

Perm url with updates: http://xahlee.org/emacs/elisp_batch_html_tag_transform_bold.htmlEmacs Lisp: Processing HTML: Transform Tags from ‹span class=w› to ‹b›Xah Lee, 2011-07-18This page shows a simple practical elisp script for HTML tag transformation.The ProblemSummaryI want batch transform the tag <span class="w">xyz</span> to <b>xyz</b>, for over a hundred files, and print a report of the changes so that i can scan to make sure there's no errors. (for example, in the case that the HTML file has a mismatched span tag.)DetailIn my English vocabulary and literature study projects, many interesting words are marked up by this tag: <span class="w">xyz</span>. With CSS, it is rendered in bold. I think that markup is too elaborate, and i want to replace it simply with <b>xyz</b>, for over a few hundred files.SidenoteThe following is a little sidenote on why i had “span.w” in the first place. (you can skip this secti…

Dalai Lama meeting President Obama

Dalai Lama Meeting President ObamaRecently the Dalai Lama went to meet president Obama. See:Obama meets with Dalai Lama: US “does not support independence for Tibet” (2011-07-16) By Xeni Jardin. @ Source www.boingboing.netfolks, truth must be known. Li Ao has pointed out several things about Dalai Lama and Tibet issues: Li Ao on Tibet and Dalai Lama.If you take the time to read it and take it seriously, then it's quite shocking. The question is: are Li Ao's statements actually verifiable facts? That, you'll have to decide yourself.

Test your English vocabulary size

Test your English Vocabulary SizeA very nice vocabulary testing page. Test your vocabulary here: http://testyourvocab.com/.There are 3 pages, but actually just 2 pages of testing. (the 3rd page is optional survey on Age, Gender, etc.) Be sure to take 10 minutes for the test. And, be honest. Don't check if you are not certain about the word's meanings.After you've done the test, it'll give you a score, which is a estimate of how many words you know. My score, turns out to be 24.5k words (second time 26.3k). This score is actually below average english-speaking adults, according to their survey. Quote:Based on over 8,000 participations so far, we've got some initial statistics already. Most adults fall in the range 20,000–35,000, with the exact median score being 27,123 words.I went thru the list carefully. The first page is trivial, the hard ones are in second page. On second page, almost none of the words in the last column i know of. But most others i've seen…

Little Parser Problem Challenge: Matching Pairs Validation

Perm url with updates: http://xahlee.org/comp/validate_matching_brackets.htmlLisp, Python, Perl, Ruby Code to Validate Matching BracketsXah Lee, 2011-07-21This is a preliminary report on scripts of several languages to validate matching brackets.Problem DescriptionLittle Parser Problem Challenge: Matching Pairs ValidationThe problem is to write a script that can check a dir of text files (and all subdirs) and reports if a file has any mismatched matching brackets.The files will be utf-8 encoded (unix style line ending).If a file has mismatched matching-pairs, the script will display the file name, and the line number and column number of the first or last instance where a mismatched bracket occures. (or, just the char position (as in emacs's “point”)) Exactly which position is considered as the “first” or “last” doesn't matter much, as long as it report a char that breaks the nesting matching pair syntax.The matching pairs are all single unicode chars. They are these and noth…