Video: How WeChat and Alipay Dominates Chinese Life

I’ve written several times (1, 2, 3, 4) about how China has embraced the digital life and use their smartphones for everything from paying for lunch to interacting with the government. This is made possible largely by the WeChat and Alipay apps. These apps provide a portal into every possible service and since they’re linked to the user’s bank account, it’s easy to pay for just about anything with a smartphone.

You can check out my previous posts to see how it works but there’s a nice video from the Wall Street Journal’s Moving Upstream YouTube video collection that looks at the phenomenon and talks with Naomi Wu, a well-known maker and tech person living in Shenzhen. Wu says that she does still carry some cash but only for emergencies. Duncan Turner, a westerner living and working in Shenzhen says he never carries cash and can’t remember the last time he did. He pays for everything with WeChat.

The video also explores the privacy issue. WeChat and Alipay collect a huge amount of information and know basically everything about everybody. The Chinese, though, have a different reaction to privacy concerns: they don’t really care. When one of the WSJ reporters remarks to Wu that WeChat can tell the government everything about her, she shrugs it off saying, “They already know everything about me. If I’m not committing a crime, they don’t give a shit.”

We here at Irreal are not nearly so sanguine about privacy, of course, and that attitude is probably shared by a majority of those in the West. That’s why I think it unlikely that we’ll end up with something like WeChat but I do expect to see services like Apple Pay expand and for Uber-like applications to proliferate. The difference is that there won’t be a single portal as there is in China. That will doubtless be less convenient but at least no single entity will know everything about us. Except the government. But as Wu says, they probably already know everything about us anyway.

Posted in General | Tagged | Leave a comment

A Thesaurus for Emacs

If you do your writing with Emacs rather than a “word processor,” you may have found yourself wanting an easy-to-use thesaurus that is integrated with Emacs. Even if you subscribe to John McPhee’s Draft #4 advice and mostly use a dictionary for finding just the right word, sometimes a thesaurus can be really handy.

Today, I saw an announcement by Valeriy Savchenko about his new Emacs package that provides an interface to the Power Thesaurus Website. The Power Thesaurus site is a crowd sourced thesaurus that appears to be pretty comprehensive. If you give it a word, it returns a list of synonyms. Savchenko’s package provides an easy way to query the site from within Emacs. If there is an active region, the package will use that word. If there is no region, it asks you for the word. In either case, it inserts the word at point, replacing the region if there is one. Savchenko has an animated gif that demonstrates its use.

Some of the comments to Savchenko’s announcement complained that the package depends on a third party site but that also has some advantages such as not requiring storage on your system and, being crowd sourced, always undergoing improvement. In any event, the situation is the same as with abo-abo’s define-word, which depends on Wordnik and which I use many times a day without any problems.

I’ve installed it and bound it to Hyper+p. Obviously, I don’t have much experience with it yet but it seems work as advertised.

Posted in General | Tagged | Leave a comment

Emacs 26, Threads, and Generators

One of the things that a lot of people are exited about in Emacs 26 is the introduction of basic threading. Another, less mentioned, feature is generators. The excellent Chris Wellons has a must-read post that talks about both of these innovations.

He first considers generators, which he describes as mostly modeled after Python generators and, to a lesser extent, JavaScript generators. Generators return an iterator object that performs a calculation but can stop in middle of the operation to return a value. When it’s called again, it produces the next value and stops again. Python users will be familiar with the idea.

In Elisp, the generators are implemented as closures. Wellons describes how they work and some of the gotchas involved but if you’ve ever implemented a counter function that return the next sequential integer each time it’s called, you’ll be familiar with the concept.

Next Wellons talks about the threading implementation. He says that they’re basically pthreads and that they should be considered a first step in bringing threads to Emacs. Again, he discusses some of the things that can go wrong.

Finally, being Wellons, he wrote an implementation of generators using threads. It was just a proof-of-concept implementation meant to give him some experience in using the new facilities. You can take a look at the code on GitHub if you’re interested.

As always with Wellons’ posts, I learned some new things by reading it. If you do any Elisp at all, you should take a look.

Posted in Programming | Tagged | Leave a comment

Recursion

Mike Zamansky has an interesting post on recursion. The question at hand is whether it makes sense to teach recursion to beginning programming students. Zamansky was a high school CS teacher for many years and now he’s involved—at least in part—with teaching those who might want to become high school CS teachers themselves. It’s no surprise, then, that the beginners he’s concerned with are high school students.

Like most of you, I have no experience teaching high school students so I’m not competent to offer an informed opinion on the question. Nonetheless, I was struck by some of the comments to the post. Most were from HS CS teachers who also had an industry background before going into teaching. What these commenters all said was that they seldom, if ever, had had occasion to use recursion as developers. One even felt that it was a code smell.

Most of you know that these days I’m mostly interested in Lisp and that I’ve put in a bunch of time with Scheme. It’s no surprise, therefore, that recursion is one of the main tools in my kit. But before I ever wrote a single line of Lisp I was still a recursion user. I can’t tell you how many depth-first searches I’ve written in C using recursion. Sure, if you’re writing accounting software you probably won’t find a good reason to use it but I’ve always found it an irreplaceable tool.

My problem is not with finding opportunities to use recursion but with forcing myself to consider seriously whether it’s the best solution for the problem at hand. Depth-first search? I don’t know how you can do it without recursion (simulating recursion with your own stack is just making a simple problem harder). A less clear cut example is the factorial function. I was trained as a mathematician so to me a natural way of thinking of the factorial is:

\begin{equation*} fact(n) = \begin{cases} n, &\text{if $n<3$;}\\ n × fact(n-1), &\text{otherwise.} \end{cases} \end{equation*}

That just screams for recursion, of course—the definition all but writes the code—but a loop may be a better solution in this case. The canonical example of that problem is the Fibonacci sequence:

\begin{equation*} fib(n)= \begin{cases} n, &\text{if $n<2$;}\\ fib(n-1)+fib(n-2), &\text{otherwise.} \end{cases} \end{equation*}

Again, this screams for recursion but disaster results if it’s implemented that way.

My point is that recursion itself is natural for anyone with even a minimal mathematical background. The real problem is knowing when it’s a good idea and when it’s not. Once you’ve got that under control, you can start considering things like tail recursion.

As to the larger point, I’m interested in how many of you use recursion without thinking of it as a special event. Leave a comment if you’d like to share your experience.

Posted in Programming | Tagged | Leave a comment

Introduction to EWW

I’ve been making a point of trying to use the Emacs Web Wowser (eww) when it makes sense. As much as I’d love to move browsing into Emacs—and thus realize my goal of virtually never leaving it—sadly eww can’t replace a full fledged browser such as Safari, Chrome, or Firefox.

There are places, though, where it’s use does make sense. My most frequent use is with mu4e to display HTML emails that miscreants insist on sending me. Even there, it’s not always adequate: emails from Amazon, for example, really need to be displayed in Safari to see the content correctly. Still, for most HTML emails eww is fine.

The other place where eww makes sense is to look at things like on-line manuals. I don’t always remember to use eww for that but I’m trying to train myself. Another place I find it useful is to find the correct spelling for a word I don’t remember how to spell. Sometimes flyspell can help with that but when it doesn’t, I usually just go to the browser and look up the word with an approximate spelling. Almost always, DuckDuckGo will tell me the correct spelling. This is an ideal use for eww because I don’t have to leave Emacs to find that spelling.

Over at Emacs Notes, Emacks has a nice post on using eww. It’s just the basics but it’s good to get you started. The thing I liked best about the post is that Emacks says the proper way to think of eww is “as a handy HTML-to-text converter that extracts content from your favourite web-pages to your personal notebooks.” Looked at that way, you no-longer care as much about its limitations because you’re not trying to use it to replace your browser

Posted in General | Tagged | Leave a comment

Eshell and Emacs Everywhere

Seven or eight months ago, I wrote about a couple of posts from Pierre Neidhardt (Ambrevar) concerning Eshell and the utility of doing as much as possible in Emacs (1, 2). Since then, he’s revised them a bit from the original reddit postings and made them available on his site at Eshell as a main shell and Emacs Everywhere.

I rediscovered them when @hideo_is tweeted links to them. These are really interesting posts and well worth reading again. Ambrevar states his belief that although eshell is not a standard Unix shell, it is better suited for use with Emacs—not being tied to ancient terminals in the way traditional shells are—and that its differences should therefore be celebrated rather than looked upon as shortcomings. He makes, I think, a convincing case for that belief.

In the Emacs Everywhere post he describes the joy of doing almost everything from within Emacs and pleads the case that Emacs is not a violation of the Unix philosophy of a program doing one thing well. He says, essentially, that the one thing Emacs does and does well is to provide a standard and powerful interface to other programs and packages. In that way, it is no different from Qt, GTK, Tk, or even curses.

I enjoyed reading the posts again and you probably will too. If you haven’t already read them, be sure to take a look. They’re definitely worth your time.

Posted in General | Tagged | Leave a comment

The Cost of Adtech

As a result of the GDPR going into effect, USA Today is—presumably temporarily—running a special version of their site for those in the European Union. This version has all the ads and tracking scripts disabled. Marcel Freinbichler shows us the shocking—if not really surprising—results:

If you click on the tweet, you can see the rest of the thread, which includes these statistics:

  • Load time went from more than 45 to 3 seconds.
  • Javascript files loaded went from 124 to 0.
  • HTML requests went from more than 500 to 34.

As I’ve said many times in the past, I understand and accept the need for content providers such as USA Today to serve advertisements. They have to pay for running their business some way after all. But when you get 10% content and 90% tracking and ads, it seems to me that they’re abusing their readers’ goodwill and understanding.

Posted in General | Tagged | Leave a comment

Emacs 26.1 Is Out

Nico Petton tweets the good news:

I’ve already downloaded, compiled, and installed it and am writing this with the new version.

If you’re on macOS, here’s my recipe for the compilation and installation:

configure --with-ns CFLAGS="-g3 -O2 -I /usr/local/include/libxml2"
make
make install
make install-info
sudo mv nextstep/Emacs.app/ /Applications/Emacs.app

The last time I installed Emacs, the last step in the recipe was

sudo cp -R nextstep/Emacs.app/ /Applications/

but this time macOS complained so I used the mv instead.

If you’ve got macOS set to not run “unknown applications” and get an error message when you try to run it, follow these directions.

Posted in General | Tagged | Leave a comment

f-strings in Elisp

John Kitchin, as you probably know, is a fan of Python as well as of Emacs. One of the things he really likes in Python 3 is f-strings. They allow you to do things like

import datetime
today=datetime.datetime.today()
name="J. Random User"
print (f'{name:14s} signed up for Bozoid Services on {today}')

You may or may not like the idea but if you do and you’re an Elisp programmer, Kitchen has a simple implementation in Elisp. They’re not quite as powerful as Python’s but Kitchin says they do what he usually needs them to do.

Unless you’re in the camp that eschews the loop macro and format strings on the grounds that they’re “unlisp-like” you may want to try it out.

Posted in General | Tagged | Leave a comment

The Irreal Privacy Policy

As far as I can tell, the GDPR does not apply to Irreal. Nevertheless, Irreal is trivially in compliance because we don’t collect or store any information about our readers. Even if we did collect such information, we would never sell or share it with anyone.

If you post a comment to Irreal, you are using the Disqus Commenting system and they do collect some minimal information needed to run their commenting network1. That data is under Disqus’ control and Irreal has no say in its use or disposition. If you’re concerned about the information Disqus maintains, log in to the Disqus Data Sharing Page to adjust your settings.

These policies apply to everyone, everywhere, not just readers in the European Union. We’re an equal opportunity non-abuser.

Footnotes:

1

Before Disqus, Irreal used the built-in WordPress commenting system. All logins and associated information to that system have been deleted.

Posted in Administrivia | Tagged | Leave a comment