Xah Programing Blog Archive 2012-11
slightly updated: Concepts and Confusions of Prefix, Infix, Postfix and Lisp Notations. Also see comment at bottom of that page by David A Wheeler, who seems to have some success in introducing a alternative syntax to several Scheme Lisp implementations.
Ruby's Whitespace Issue
also, Ruby's whitespace issue is not so good. For example, this is valid:
# -*- coding: utf-8 -*- # ruby def ff ; 4 end p ff
How to explain that?
so far, what i see is just ad hoc. That is, there is no simple systemic rule. The key seems to be, that something (expression?) needs to end in semicolon, and semicolon can (often?) be omitted?
if so, but then if you look at the case def f; 4; end
, then that syntax design doesn't seem to make sense, as “def f” isn't a complete clause.
see previous article: What Does it Mean When a Programing Language Claims “Whitespace is Insignificant”?
new today.
Intro to Lisp's Symbol concept. Emacs Lisp Symbol .
a piece of history. Perl: Sort Unstable
New for Ruby, updated for Python and Perl:
Added Ruby: Ruby: Map Function to Array
see also Python: Map, Filter, List • Perl: Map Function to List
Keyboard Shortcut Design: Repeatable vs Non-Repeatable Commands and Keys
updated: git Tutorial
been using git for several months now. Before was svn. (and cvs before)
can't say i find git better (except being one of the distributed RCS). Git's man pages are totally incomprehensible. The MD5 for commit id is a pain. You have to type much more, using more than one command, to do routine commit. Then the concept of staging/cache/index is confusing. (why can't they stick with one term? or is there actual technical difference?)
git being perhaps most popular has a lot to do with tie to Linus celebrity.
was mentioning git on Google Plus, then [James Salsman https://plus.google.com/+jsalsman/posts] mentioned Bazaar.
Bazaar (software). Apparently, a few big companies are using Bazaar, including Launchpad, Ubuntu, MySQL, GNU Emacs.
[Why Switch to Bazaar? By Canonical. At http://doc.bazaar.canonical.com/migration/en/why-switch-to-bazaar.html , accessed on 2012-12-22 ]
What Does it Mean When a Programing Language Claims “Whitespace is Insignificant”?
Added Ruby: Ruby: Loop thru Array
see also Python: Loop Thru List • Perl: Loop thru List
Updated: Unicode Support in Programing Language Function Name and Operator
from this, you can see which language is better:
Perl Folks Try to Erase History!
updated: W3C Proposed Icons for Internet before Unicode
New today: Python: List
in past 3 hours, added Ruby to my Perl+Python tutorial. Completed the following pages.
Comparative Study
- Python: Print Version String from Script
- Python: Quote String
- Python: if then else
- Python: for, while, Loops
- Python: True, False (boolean)
Invisible Character from Twitter
Functional Programing: Make Dependent Functions Explicit
In functional programing, a function's behavior should depend only on its arguments. However, there's another issue that's been bugging me for over a decade. That is, there is no list of what other functions this function depends on. In the past i've tried to pass all functions it calls as parameters in the function definition, but that's crazy. I haven't heard this issue mentioned anywhere.
Haskell people, any thoughts?
Ubuntu Bug: 「pydoc modules」 Core Dump
updated: Ergonomic Keyboard Layouts
updated. A efficient keyboard layout for Portuguese. pt-Nativo (Portuguese) Efficient Keyboard Layout .
Question to Readers: {Perl, Python, Ruby}, Together on One Page, or Separate?
I have a Python Tutorial There, each page, has both languages for comparative study.
My question is, should i also put my new Ruby Tutorial there for comparative study? Or, should Ruby by itself?
I can actually also put {Emacs Lisp, PHP} there for comparative study too. But then each page will be long. Alternatively, if each language is on separate page, with inter-links, then people could page between any two languages.
Which way do you prefer?
updated a bit. Added tuple and explanation of Python sequence types. Python in One Day
when you start to learn a new tech, often there's a sea of info. All the confusing terminologies, tools, structures, and tens of tutorials compete to confuse you.
been reading Ruby+Rails for the past 10 days. Now i finally have a pretty good grasp.
lots updates to my tutorial in parallel. In pretty good shape for a start. Ruby Tutorial
separated into new page: Linux: Sort Lines
minor update: git: Setting up GitHub, GitCafe, Google Code
software jargons and tech 2012: blackbox/whitebox testing, Jenkins, Puppet, Selenium
XML Syntax is Inferior Lisp Syntax?
updated: LISP Logo
alias l='ls -AlF --color --time-style=long-iso'
See also: Linux: Set Bash Shell Prompt to Color .
i think i start to dislike the rvm ruby installer. Because:
- None-standard install methods. For example,
\curl -L https://get.rvm.io | bash -s stable --ruby
. This directly download and run a script on your machine. Also, it uses curl instead of the more standard wget. You have to install curl on Ubuntu first. This directly running a script is a questionable practice. - After you install it, you see that it's a massive number of bash shell scripts. Today, bash scripts should never be written. Even if you have to, use perl. Even python is standard in linuxes and Mac OS X.
- Doesn't respect linux system standard ways.
- Doesn't work out of the box. After install, it asks you confusingly and questionably to run a shell script, and ask you to run it in a separate terminal.
- It add lines to your shell init file to load a massive shell script. Not simply append to your $PATH. This is questionable practice again. It slows down your shell startup.
- But when you restart, it doesn't work. Because it adds to “.bash_profile” but not to “.bashrc”
rvm
isn't a normal tool. It's not a script or binary. Instead, “rvm” is a bash function.- After install, when you
type gem
, it's also a shell function. Very annoying. It seems to have lots wrappers, and faakup standard ways of doing things. For example, when youtype rvm
to see what/where it is, pages scrolls thru.
the whole shebang smells bad.
It appears to me, the whole rvm is a one-man's project, and somehow got very popular. Doesn't respect standard ways. Written in 30 years old tech.
Addendum: thanks to ruby rvm dev [ Michal Papis ] https://twitter.com/mpapis who helped me solve a problem. When installing rvm, be sure to read rvm requirements
.
updated: Linux: Show Directory Size: du
updated: Unicode: Full-Width Characters
A collection of software engineering pain. Complexity and Tedium of Software Engineering
Linux Problem: wmctrl, Documentation
worth reading again: Guy Steele Says: Don't Iterate, Recurse, and Get rid of lisp cons!
a old site that quotes me:
The Contempt Page ~ By Mr. Schnada. At http://www.schnada.de/quotes/contempt.html
See also:
Learned Ruby in 2 days. Here's a draft version of tutorial. Ruby Language Basics
The next few days i'll be getting onto Ruby on Rails.
Ruby experts, please hit me with comment and suggestion.
Bad Keyboard Advice from Programers
Symbol for the Menu Key
Unicode joy. Found a appropriate symbol to represent the menu key. For example, ▤ Menu.
So, now i have: Shift, ⌘ command, ❖ Window, ▤ Menu, Return, Enter, ⌥ option, Backspace ⌫, Delete ⌦, Tab.
Examples:
- Keyboard Modifier Keys, Short Survey
- Keyboard Enter/Return Key Symbol
- Emacs's Keybinding Layout Diagram
- Short Survey of Keyboard Shortcut Notations
- Windows: Keyboard Shortcuts
- Second Life Keyboard Shortcuts Cheatsheet
- Picasa and Picasa Picture Viewer Keyboard Shortcut Keys
I can never remember what “xor” do. But now i got a easy way to remember it. xor returns true if the values of two sides differ.
See also: Logical Operators, Truth Table, Unicode
updated: How to Secure Delete Files, Shred Files, Wipe Drive
If you haven't signed up with dropbox yet, you can use this link: http://db.tt/13yKyKB. I get more free space if you from my link. Dropbox lets you store your stuff online. Default is 2.5 GB.
How to Write grep in Emacs Lisp
Windows: Single-click Open File
major update: Keyboard Shortcut vs Launch Buttons
updated: Apple Keyboard Problems
much redesign of the keyboard home page. All you need to know about keyboard. If you have questions, feel free to ask me. Comment, or any of the social network. Thanks. Keyboard: Layouts, Hotkeys, Macros, RSI ⌨
photo. Ruby Creator Cooks Python; Matz and GitCafe
I love Unicode. Here's many articles about Unicode. I just redesigned the page's appearance a bit. Check it out and let me know your thoughts! Unicode Gallery and Tutorial ∑ λ ∞ π © ™ § ¶ ☺ ♀ ♂ ♥
Intro to text processing using linux tools. Slightly Updated. Linux: Text Processing: grep, cat, awk, uniq
A design issue: What should be used for source code section marker. See: Emacs Form Feed (^L) Display Suggestion and Tips
The workman layout now has a dedicated website. See: Computer Keyboard Layouts: Dvorak vs Colemak vs Workman
Linux: Directory Size: du Command
Discovered this keyboard “ThinkPad USB Keyboard with TrackPoint” ThinkPad keyboard
It's a external USB keyboard, with embedded Pointing Stick (a red button between G and H). Compact, laptop style shallow keys.
I don't recommend it. Because laptop style keyboard is the fastest way to get RSI. If you are going to get a external keyboard, get a full-sized one.
My recommendations are:
- If you want split keyboard, see: Best Ergonomic Keyboards, Xah Pick
- If you want straight keyboard, try Mechanical Keyboard Reviews ⌨
All these have mechanical keys. (but check the page for detail).
Some people like the ThinkPad's Pointing Stick. I didn't like it. Too slow.
thx to [Aenon Sun (孙锡麟) https://plus.google.com/101115235679473513568/about].
New: Git Synctax Examples for GitHub, Google Code, GitCafe
What is the difference between git clone and git checkout? See: Git: Frequently Asked Questions
Emacs Lisp Problems: Trim String, Regex Match Data, Lacking Namespace
learn JavaScript in a day! JavaScript Basics Tutorial by Examples
Programer Simple Living Shanty Town Squatter
For those of you having RSI issues with mouse, here's a highly recommended mouse:
Or, you can try a trackball: Best Trackballs, Xah Pick , or touchpad Input Device: Trackball, Touchpad, Pen Tablet, Joystick, Jog Wheel
pem url Ergonomic / Vertical Mouse