Posts

Showing posts from April 8, 2012

Emacs Lisp vs Perl: Validate Local File Links

This page shows 2 scripts to validate html local file links (i.e. check file existence of local links). One written in perl, one in elisp.The 2 script's algorithms are not artificially made to be the same, but follow the natural style/idiom for each lang. They do the same job for my need.lots code. See here instead: http://xahlee.org/emacs/elisp_vs_perl_validate_links.html

Ruby Creator Matz on How Emacs Changed My Life

Image
Perm URL with updates: http://xahlee.org/emacs/Matz_Ruby_how_emacs_changed_my_life.html2012-03-26Yukihiro Matsumoto (aka Matz), creator of Ruby, giving a talk: “How Emacs changed my life”. Slide at www.slideshare.net. (photo by Corey Goldberg, used with permission.) This is at LibrePlanet 2012 conference at the University of Massachusetts, Boston, around 2012-03-26. Also, Matz is given FSF's “Award for the Advancement of Free Software” for 2011. Matz and RMS. 1893×2430Source www.fsf.orgText Processing: Emacs Lisp vs PerlLisp Celebrities and Computing History from Worse Is BetterGeek Latte Art: GNU, Beastie, GolangDeath of a Troll — My Memory of Erik Naggum

emacs lisp: Getting User Input with Completion and Input History

Perm URL with updates: http://xahlee.org/emacs/elisp_idioms.htmlSome commands provide input history, so that user can use ↑ key to enter previous input. (e.g. shell-command 【Alt+!】) Also, some commands provide name completion (e.g. “dired” 【Ctrl+xd】)The most useful are: read-string, read-file-name, read-regexp. Examples: (defuntest-fun (arg) "Prompt user to enter a string, with input history support." (interactive (list (read-string "Your name is:")) ) (message "String is 「%s」." arg) ) (defuntest-fun (arg) "Prompt user to enter a file path, with file name completion and input history support." (interactive (list (read-file-name "Open directory:")) ) (message "Path is 「%s」." arg) ) (defuntest-fun (arg) "Prompt user to enter a elisp regex and input history support." (interactive (list (read-regexp "Type a regex:")) ) (message "Regex is 「%s」." arg) ) The most general command is r…

The Bug-Reporting Attitude

Image
In 2005, Microsoft Windows XP will pop-up a dialogue box when a program crashed, and will ask the user about whether she wants to report to Microsoft, with detail about data collection policy. More screenshots at Microsoft XP Bug Report PanelsBug-reporting solicitation panel from Adium, a multi-protocol chat client (on OS X). (screenshot captured 2006-06)for ten more, see http://xahlee.org/UnixResource_dir/writ/bug_report_attitude.htmlIT Industry PredicamentResponsible Software LicenseWhat Languages to HateOn Microsoft Hatred

Google Search Now Requires Javascript?

Image
Perm URL with updates: http://xahlee.org/w/Google_search_requires_javascript.htmlGoogle search no longer works if you have Javascript off.Google Search result when Javascript is turned off, 2012-04-12. (on Windows 7, Firefox 11.0) Because i do Google search with javascript off everyday, so this probably means today (2012-04-12) is the day they made this change.2012-04-13 Update: it does works now without javascript. Strange. Few hours ago, i tested with both Firefox and Opera and Chrome on Windows, with and without Javascript.Google: “Don't Be Evil” vs “Don't Do Evil” HTML, CSS, javascript, Web Tech and Browser TimelineCookies, Super Cookies, Your PrivacyGoogle Chrome, SPDY Protocol, Browser War IIAdvantages of FeedBurner and Some Web Feed HistoryMicropayment On The Web

idiomatic find/replace script in python

Bjoern Paschen wrote a improved, idiomatic, version of python multi find/replace code we did before.# -*- coding: utf-8 -*- # Python # find & replace strings in a dir # by Bjoern Paschen, 2012-04-08 import os, re # if this this is not empty, then only these files will be processed my_files = [] input_dir = "c:/Users/h3/web/xahlee_org/"min_level = 4 # files and dirs inside input_dir are level 1 max_level = 4 # inclusive find_replace_list = [ (u'<iframe style="width:100%;border:none" src="http://xahlee.org/footer.html"></iframe>', u'<iframe style="width:100%;border:none" src="http://xahlee.org/footer.html"></iframe>', ), (u'testing', u'done', ), (u'utf8-test', u'ƿƺ' ), ] defreplace_string_in_file(f): content = u'' temp = u'' writeout = Falsewithopen(os.path.normpath(f), 'rb') as…

Google's New Ad: “Google+: There's more to explore”

Image
Google+: There's more to exploreIt's all women! What do we men do?

Human Operated Twitter Spam: Beg a Question to Make Real Interaction

Perm URL with updates: http://xahlee.org/w/twitter_spam_ask_nice_questions.htmlgot a twitter spam.@xah_lee Can you tell me why the symmetry groups are labelled p1, p4m, p31m, p3m1 etc? I just can not work it out Thank you in advancefrom “@delahunty91”i actually answered quickly. Then, went to check his tweets, several «I made $350 today ‹cryptic link›». check out this article! I made $350 today! ow.ly/5LwT9?voru check out this article! I made $370 today! goo.gl/7Zu1F?gijor check out this article! I made $350 today! ow.ly/5Lypm?syhi Clearly spam. Went to one of the site with Firefox javascript off and got a spam/malware site warning.this is a human operated scam. The guy's question came from reading this page Wallpaper groups: The 17 Wallpaper Groups.He may not be a professional spammer. Might signed up with one of the spam programs to make a few bucks. See: Where Do Spammers Came From? (A Xah Story of Human Animals).Why's he asking me question? Of course, ask in a nice way, …

Twitter Humor: Chrome vs Emacs, Version Numbering Pressure

Got this tweet today:bamanzi: «Emacs压力好大 RT @riku: 我擦, Chrome 的版本都已经到 20 了。»Translation:riku: «OMG! Chrome's version reached 20.»bamanzi: «pressure is on Emacs»

ErgoEmacs Keybinding is now in MELPA

ErgoEmacs Keybinding is now in the MELPA repository. (thanks to Steve Purcell for adding it)I've also added instructions for check out using svn. For how to use melpa/svn to install, see: ErgoEmacs Keybinding

Large Scale Software Development with Elisp

Scheme Lisp is Coming to Emacs!(meeting - Tue Apr 10 19:00 - Rocky Bernstein: Large Scale Software Development with Elisp)He lives in relative obscurity yet his software is used daily by millions. Rocky Bernstein, former IBM Researcher, Chaitin co-author and 30 year developer walks us through a mosaic of development techniques focusing on personal software scalability.The long time Free Software developer is best known for his decade of debugger development using Emacs Grand Unified Debugger as a front-end for his other works:Ruby Debugger (ruby-debug)Python Debugger (pydb)Perl DebuggerPOSIX Shell Debuggers for bash, Korn Shell, zsh and GNU MakeAdditionally, Rocky is the author of libcdio: the GNU CD I/O and ControlLibrary. Allowing multimedia assessing of CD-images (includingISO-9660) in an OS and device-independent way, it is used in FreeBSD, NetBSD and nearly every Linux distribution. Location: Meetup HQ, 9th Floor (maps.google.com) 632 Broadway Official announcement: www.lispnyc.o…

Fuck Python: Strings Methods, Functions, Slashes and Backslashes

Perm URL with updates: http://xahlee.org/comp/fuck_python.htmlfuck Python.just fucking spend 2 hours and still going.here's the short story.so recently i switched to a Windows version of python. Now, Windows version takes path using win backslash, instead of cygwin slash. This fucking broke my find/replace scripts that takes a dir level as input. Because i was counting slashes.Ok no problem. My sloppiness. After all, my implementation wasn't portable. So, let's fix it. After a while, discovered there's the os.sep. Ok, replace "/" to os.sep, done. Then, bang, all hell went lose. Because, the backslash is used as escape in string, so any regex that manipulate path got fucked majorly. So, now you need to find a quoting mechanism. Then, fuck python doc incomprehensible scattered comp-sci-r-us BNF shit. Then, fuck python for “os.path” and “os” modules then string object and string functions inconsistent ball. And FUCK Guido who wants to fuck change python for his …