Xah Programing Blog
Syntactic obsession, imperative despisal, unicode ♥, hacker hate
Xah Programing Blog Archive
Optional Function Parameters in Computer Language Docs (the idiocy thereof) (added a new example)
just noticed, unicode does not have the classic Soviet flag with Hammer and Sickle ☭.
Unicode Flags 🏁
gonna be offline for 2 days.
brave browser just crashed for me for the first time. and i lost 10 old existing tabs. They are my todos, but now i don't know what they are.
maybe that's god's way of telling me, if you don't do now, it's never gonna be done. forget your old todos.
Google Do Evil (new item added)
Firefox removed the Shift+F2 to get to a command line. Removed that feature entirely. Truly annoying. since ~2010, user interface changes unpredictably. The trend began with Google.
Full Page Screenshot in Browser
todo to read http://slade.jnanam.net/
Golang: String, Byte Slice, Rune Slice (more update)
Russ Cox (a dev of golang) wrote a article “generics dilemma” in 2009 https://research.swtch.com/generic Does that fairly capture the situation? and, are there updates?
Why Tiling Window Manager Sucks (xmonad, ratpoison, dwm, etc)
linux. this article, gracing hackernews, reddit, 4chan again.
Golang: Function (updated)
Google Plus is officially closed down today
here's some old articles about it
- The Google Plus Song (humor)
- Nymwars: Google Plus Account Real Name Policy Debate
- Women in Tech: Today's Google Plus Recommendation?
- What Your Google Plus Strategy Should Be?
- Humor: Google Logo Boobs
- Google: “Don't Be Evil” vs “Don't Do Evil”
- The story of Fat Francis
- Are Googlers the Minions of Google Marketing?
- Why I'm Removing Tech Blogger Celebrities and Googler on G+
- What Your Google Plus Strategy Should Be?
- All About Google
- Web Tech Gossip
- The Demise of orkut.com
with Google Plus gone, a chunk of web history is practically erased. here's a famous article by Steve Yegge, year 2011 Steve Yegge's Google Platforms Rant by the way, he quit Google
Golang: String (minor update)
The TeX Pestilence (Why TeX/LaTeX Sucks) video added.
i won't be adding xah talk show videos here. For additions, see Xah Talk Show
more python 3 update:
Python: Copy Nested List, Shallow/Deep Copy (updated to python 3)
Unicode Cyrillic Ж
Python: Compress/Decompress Gzip Files (updated to python 3)
more python updates
Python: Convert File Encoding (python 2 and 3)
Python: Count Word Frequency
more python 2 to 3 update. 70% complete.
[Open Source Doesn't Make Money Because It Isn't Designed To Make Money By Ian Bicking. At http://www.ianbicking.org/blog/2019/03/open-source-doesnt-make-money-by-design.html ]
What's Disjoint Union, Sum Type?
more python 2 to 3 updates:
Python: File Path Manipulation (updated to python 3)
Xah Talk Show
a new index page. starting to collect all the videos i've done.
converting my #python tutorial from 2 to 3. going well. 50% complete. here's one article. Python Understanding Sort Python: Sort
todo. old rant. dated 2006 or so. not sure where to put it yet.
Python's “sort” method's optional parameters: “key” and “reverse”
Most of the time, sorting is done for a list of atomic element such
as [3,2,4]. This is simply done by myList.sort() without any argument.
Other than simple list, sort is frequently used on matrixes (For example,
[[2,6],[1,3],[5,4]]). For matrixes, almost always a particular column is
used for the basis of ordering. For example, if we want to sort by second
column, we do:
li.sort(lambda x, y: cmp(x,y)). Since
this is frequently used, Python provides a somewhat shorter syntax for
it, by specifying the column used as the ordering “key”.
li=[[2,6],[1,3],[5,4]] li.sort(key=lambda x:x ) # is equivalent to the following #li.sort(lambda x, y: cmp(x,y)) print li; # prints [[1, 3], [5, 4], [2, 6]]
Because the Python compiler is not very refined, this specialized syntax is algorithmically a order of magnitude faster than the general form
lambda x, y: cmp(x,y).
That is to say, the programer must now learn 2 syntaxes for the ordering function, one general and one specialized, and he must choose the right one otherwise he will be penalized by a magnitude of slow down. This also means that, in order to make the right choice of the syntax, the programer must known in advance of the nature of the list to be sorted.
Another idiosyncratic provision is the optional “reverse” argument. This
parameter is necessary when using the “key” parameter. Normally, when using the
order comparison function
lambda(x,y), the ascending/descending
nature can be changed by simply switching the parameters x and y. But now a
key=lambda(x) can't provide that, thus another optional
parameter “reverse” is provided.
The following are equivalent:
li.sort(key=lambda x:x, reverse=True )
li.sort(lambda x, y: cmp(x,y), reverse=True)
li.sort(lambda x, y: cmp(y,x))
Of course, one can reverse a list by the
reverse() method for lists. But
li.sort(…).reverse() is algorithmically another order of magnitude slower since Python compiler is not smart.
The official doc on Python's sort method is at (bottom):
Don Hopkins has put up his famous article The X-Windows Disaster on his blog now. https://medium.com/@donhopkins/the-x-windows-disaster-128d398ebd47
todo. remove reference links in js pages, example: JS: Prototype and Inheritance
G H Hardy, a Mathematician's Apology is a old mathematician's rant. here's some info https://en.wikipedia.org/wiki/A_Mathematician's_Apology Hardy is a elite, pompous type of guy. (remind me my youth) He wrote the book when he felt he's done for. It reeks negativity, discouragement, and his pompousness.
The “Patterns Of Software” by Richard P Gabriel guy is a programer (lisp language) and entrepreneur of his rather failed company. It's also kinda a negative, apologetic, tale, and i find bad advertise and no insight. i wrote a review in 1998 http://xahlee.info/comp/bookReviewRichardGabriel.html
come to think of it, these 2 books i dislike for the same reason.
god, truly despise python. every time i work with python, lots of pain. Guido is such square that he always tried to be formal but result is very lousy.
and python doc is truly the worst. unreadable, unsearchable, it tries to be formal, but is pure shit.
TypeError: unsupported format string passed to list.__format__
this is ok in python 2
but in python 3 it's error. you need:
i'll have to do xah talk show on python and guido. Guido the character i can diss for 1 hour. He's a square, but not too bright. He like formality (eg PEP), but always come up with semi crass. He thinks his lang is easy, but compare to others it's complex, rigid, and inflexible.
the python 2 to 3 incompatible switch also reflects his personality. He thinks he's god of elegance and want to pursue perfection, that's why. and he's got this passive-aggressive personality. Polite, but between the lines in his writings, reeks haughtiness.
TypeError: unsupported format string passed to list.__format__ to understand the error, u have to know object method and its relation to function. Entire Python lang n doc is like this opaque. cuz the guy thinks he's building a tower. To him, it's clear, not anyone else.
The change actually happened with python 3.x
This works in python 3.2.3
but not in 3.7
here's another python lang problem. It got this list of builtin functions. A hodgepodge of inconsistency with its object model. Note that lots langs has such problems, but Guido and gang, has an attitude problem. They tend to expressly insist it's all right.
i was looking why #python range(1,10,0.5) no work. Note the wording in the doc began with “Rather than being a function”. That's typical of Guido's writing. passive-aggressive. Always trying to color it, and with holy jargons. And note it shows 3 links. Which to click 1st?
brave browser has a new bug. when you open a new tab and type fast, the first letter you typed got wiped out.
blogger. history. how many dead links are there?
and by next month, there will be another billion link corpses, Google Plus.
the #python community is blowing up with things like jupiter spyder numpy scipy numba pandas etc things for machine learning/data science. is there similar for #ruby?
- jupiter → a notebook interface
- numpy → lib for doing math matrixes.
- scipy → lib for doing scientific computation. example: optimization, linear algebra, integration, interpolation, special functions, FFT, signal and image processing, Ordinary Differential Equations.
- numba → python compiler creating fast code.
- pandas → data manipulation and analysis. example: numerical tables, time series. (like the lang R)
- Spyder → IDE for scientific programming.
- IPython → interactive python interface. (better than python's builtin)
- SymPy → symbolic math
Python 2 and Python 3 Difference (updated)
todo. from Aaron Hall @aaronchall
Even in batteries-included-Python world, there are external libs you'll be expected to use. requests is one. others include:
- numpy and scipy
- flask or django
Rule of thumb: If Anaconda gives it to you by default, trust it's worth coding with.
installing python anaconda. what a stupid name.
whopping 2.6 gigabytes.
i heard, from friends, this is good python distro. It includes everything. especially for machine learning, math packages, etc. seems good.
after you install anaconda, then you have /Users/xah/anaconda3/bin/python then you can just use that python. ignore everything else. lol this is for those of you dinosaurs like me.
Unicode Braille ⠮
SGI Logo Visual Illusion
Unicode Japanese の
Unicode Chinese 中文
new, on their own pages
Linux: Convert File Encoding with iconv (minor update)
Unicode Linear B 𐂂
Designing Data-Intensive Applications
came across this book
[Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems By Martin Kleppmann. At Buy at amazon ]
Xah Programing Blog Archive
If you have a question, put $5 at patreon and message me.