Xah Programing Blog 2013-02
Ruby Version Release Dates
Ruby's predefined global variables is not documented, but Ruby 2.0, which came out few days ago, fixed that. Ruby: List of Predefined Global Variables
Logitech G710+ Keyboard
This is the best straight form mechanical keyboard for programers. See the review for my reasons why.
updated with photos. HP-28S Advanced Scientific Calculator
updated. List of Keyboards with Mechanical Switches
linux package managers galore
discovered a linux phenomenon.
y'know, linux has package managers, for example, apt-get, yum, pacman.
now, that's heaven. Search, install, done. No compilation and potentially hours reading README INSTALL fsck and gcc make version compatibilities. Universal, systematic.
you realize, when you get slightly deeper into Python, Ruby, etc, they don't recommend using the system's package manager. They recommend compiling yourself, or, use their own system.
Why? because the system ones are often outdated by a year or so. And when you get deep in dev, you need to manage several different setups, lib versions. So, Python has pyPM, york, and others, Perl has whachamafsck and others, ruby has rvm and others. (and ruby rvm is shell script muck on drugs)
you see, from my recent experience, it's not just one simple one per lang. It's several competing ones. You have to research and wikipedia and stackoverflow and feel the pain then settle which to use.
it's rather complex. Not trivial. For example, Ruby: What's RVM, Gem, Rake, Bundler, RDoc, ri, irb?
as another example, let's say emacs. Now, that's where i can claim knowing a thing or two. When you
apt-cache search emacs, you see tens of stuff flying by, many of them elisp packages (For example, major modes). emacs modes from apt-get? LOL. Get outta here! You wanna use the one from emacs 24 instead, call “list-packages”, and use MELPA repository.
[see A Guide on Emacs 24 Package System]
AND, no, there's not just one emacs packages system, there are competing ones, even competing repositories. So, if you didn't spend years wallowing in emacs community, you wouldn't know.
how i learned to stop worrying and love the bomb…
Ducky keyboard and KeyBoardCheer keyboard!
discovered that the Ducky keyboard from Taiwan makes real quality keyboards. Check out their website.
I don't think you can easily buy it in USA though. But you might be able to buy from the company's site via shipping. (KBC is also quality.)
KBC Poker Keyboard, Ducky Keyboard
variable naming style: pot_hole_casing
in your code, do you prefer camelCase or under_score?
then, Christian Herenz alerted me, that this paper calls it “pot_hole_casing”. LOL!
[Best Practices for Scientific Computing By D A Aruliah, …. At http://arxiv.org/abs/1210.0530v1 , accessed on 2013-02-27 ]
thinking about it, that term makes much more sense than under_score. You see, camelCase is named visually. So, “pot_hole_casing” is a nice complement. Without visual clue, the phrase “camel case” can still convey, but “underscore” wouldn't, but “pot_hole_casing” would. Thus, it's a superior term.
see also: Programing Style: Variable Naming: English Words Considered Harmful
Keyboarding: the Effect of Mechanical Key Switches on You
small Python list tip. negative stepper starts from right
when the stepper is negative, it starts from right. For example,
list[::-1] reverses the list. (when the first index is empty, it default to 0, and when second index is empty, it defaults to the index of last item.)
# -*- coding: utf-8 -*- # Python 3 print(["a", "b", "c"][::-1]) # ['c', 'b', 'a']
thx to https://twitter.com/Ryuutei
Programing Challenge: Replace String Pairs
should be fun. This problem started in elisp for me few years ago. Over the years, tried several elisp approaches… but overall i was stung twice. Few weeks ago, found a bug in my code. Rewrote it with a new algorithm thinking it's much better, but bang, another bug. That is, incorrect behavior.
Now i think i have a good solution, but still has certain limitations. So, am posting this as a fun coding problem, pulling on the talent pool.
am posting this as a general programing problem, not specific to emacs lisp. I do have a elisp solution, but can be easily translated to any other lang.
Programing Language Design: Why Lisp Macro Sucks (YMMV very much!)
oldie but goodie. In light of the recent John McAfee incident. ZIP, Open Source, Mother-Son Relationship
Levetron Mech Gaming Keyboard
I don't think this is suitable for programers, but a fun funky keyboard, with mechanical keys (Cherry MX Black).
Python Syntax Voodoo: Complexity of Comment Syntax and Backslash
Optional Function Parameters in Computer Language Docs (the idiocy thereof)
drew the layout diagram of Happy Hacking Keyboard in SVG. The Unhappy State of the Happy Hacking Keyboard
the new lang julia is quite interesting. A order faster than most other langs. So so many langs, which you gonna choose? Proliferation of Computing Languages
found a better way to make mouse wheel accelerate in Firefox. Updated: Firefox: Set Mouse Wheel Scroll Speed
Perl: Difference Between List and Array
Language Design: Should Array Index Start at 0 or 1?
update. added a 3 video reviews. Logitech M570 Wireless Trackball
trackballs are especially nice when you turn on auto-raise. That is, you hover pointer to a window and it automatically comes to the front. You can turn this on in Microsoft Windows or Linux (but not Mac).
auto-raise is nice because it saves you lots of clicking. Once you get used to it, it's so smooth, no clicks or keystrokes.
trackball makes this even better, because when you have auto-raise on, you don't want to move the pointer unnecessarily. Trackball by nature doesn't move pointer, while with mouse, one tends to move it about.
in Ubuntu Unity, they started to have a fancy feature called “auto-click”. That is, whenever the pointer rests on a spot, it automatically do a click. So, with this, you don't even need to click on tabs, or boxes, anymore. I tried it for 5 minutes, but haven't decided i want it, because it's too easy to unintentionally click on something. You have to always find a inactive spot to rest your mouse. (does anyone know how to turn this on in xfce?)
Lisp Logo Latte Art
Ruby Creator Matz on How Emacs Changed My Life
started to read a blog titled Write Yourself a Haskell... in Lisp.
wow, that's interesting. The net really got advanced geeks. I myself have written a Perl package that emulated Mathematica functions ten years ago, but it was not something to write home about, because it doesn't do parsing. It just implement some functions of Mathematica in Perl, all Perl syntax.
[see Perl Module: Tree::Matica (Mathematica Tree Functions in Perl)]
then, the second paragraph, it says:
We're not going to bother with parsing: our input programs will be S-expressions.
if you don't do parsing, you are skipping the hard part. And the title Write Yourself a Haskell... in Lisp becomes deceptive, or, marketing.
wrote this. validate my website Google Analytics code. [https://github.com/xahlee/xahscripts/blob/master/validate_website/check_google_analytics.py3 ] Too bad that github doesn't recognize the “.py3” suffix. It makes things a lot easier.
geeks and repetitive tasks
Emacs: Using Keyboard Macro to Record/Playback Keystrokes
Python: Format String
new. Python 3: Operators
for some reason, Unicode in Mac are in color. Updated with screenshots. Food Emoji 🍺
Python Bitwise Invert Oddity
new. Python 3: Traverse Directory
pedobear is coming to town ᶘ ᵒᴥᵒᶅ Unicode Smilies (¬_¬)
hot from the press. Learn Python 3 in one hour. Python 3 in 1 Hour
updated. aspell sucks: Dismal Vocabulary Size
answer added at Linux: Commands Related to GUI Apps
Keyboard: Control vs Capslock Position
Linux: Move File to Trash by Command
Ergonomic / Vertical Mouse
See also: Famous Programers with Repetitive Strain Injury
Unix/Linux Shell Shebang: Who Gets to Use the First Char?
python3: respect of style??
2to3 converted my use of lambda to list incomprehension.
- return len(filter(lambda x: x == os.sep, os.path.abspath(d))) + return len([x for x in os.path.abspath(d) if x == os.sep])
hey, is there no respect to my style?
git force pull.
git fetch --all # get latest from remote but without merging into local git reset --hard origin/master # rid of all local state
updated. Firefox: Set Mouse Wheel Scroll Speed
Is Linux Desktop Ready for Mom and Pop?
looks like Andrew Auernheimer (aka weev) is going to jail.
He's a grey hat hacker. You can read about him at Wikipedia here Weev
he published a essay on Tech Crunch here: [iPad Hack Statement Of Responsibility By Andrew Auernheimer. At http://techcrunch.com/2013/01/21/ipad-hack-statement-of-responsibility/ , accessed on 2013-02-12 ]
Linux, KDE: wow, Konqueror Sucks Major A.
on its own page. Python Scope Complexity, Shallow Copy, Deep Copy, Circular List, and the Garbage Underneath Computer Languages
new found. Fantastic. Linux: Best Image Viewer for Random Slideshow
i wanted to know the general mechanism in Linux to associate file extension with executable (for when user clicks a icon in GUI), and i wanted to know how to do this asso by command line.
it seems there's no standard way. Here's 2 best links from helps i got.
Arch Linux documentation consistently came up the best when i had some Linux questions. I started to read about Arch Linux a bit. I like their philosophy. I think it'll be my next Linux to try.
while Ubuntu community is like …
Pattern Matching vs Grammar Specification
redraw the parser diagram in Inkscape. ♥ Inkscape.
git Frequently Asked Questions
Linux: How Much Memory is Really Free?
vi tip: find out what a key do
To find out what a key or key-combo does, type
:help then press the key, then Enter.
this would be similar to emacs's
describe-key. [see Tips on Long Term Emacs Productivity]
thx to https://twitter.com/liancheng
the blog i wrote few days ago about TCP/IP is now on its own page. quick random jot-downs, on TCP/IP, on Tech Writing
meanwhile, i discovered a much better book.
is classic, but stinks of academic verbosity, hard to undersand, and the latest edition isn't well written. The Sams book is much more practical.
What's the Ugly Cylinder at the End of Computer USB Cables?
updated. Python: Unicode Tutorial 🐍
Linux: Edit Firefox bookmarks in Text Editor
Linux: Get System Info
How Fast is Running Perl in Cygwin or Using NTFS on Linux? (The Price You Pay for Layers and Emulations)
linux: xfce: show hidden files by Ctrl+h
in Linux, if you are using xfce, then the folder viewer (aka file manager) is Thunar. It doesn't have a option in preference to show hidden files (those starting with a dot). But you can show by 【Ctrl+h】
On its own page. Why Python Lambda is Broken and Can't be Fixed
new. A much better top. Linux: Monitor Processes, htop
quick random jot-downs, on TCP/IP, on Tech Writing
Updated. Best Trackballs, Xah's Pick
new. Python: How to Find Python Interpreter Path, Script Path, from Running Script
If you have a question, put $5 at patreon and message me.