If you use a computer to take notes a lot (I do), and those notes often involve math expressions (mine do), you become quickly aware that word processing apps are really not designed for this. Inserting any symbol that isn’t on a standard qwerty keyboard requires extended mouse acrobatics and searches through long lists of obscure symbols (MS Office — pages and pages of variants of Arabic script? Seriously? Who uses this stuff?).

symbols

Today’s post, though, is about a different “pain point”: subscripts and superscripts, which are used constantly with math symbols, and require ridiculous contortions to type.  In MS Office products, you have to first select the affected character(s) (requiring either mouse highlighting or shift + arrow keys), then press control and = simultaneously to make it a subscript, or control and shift and = simultaneously for superscript. And at least half the time (I admit I may be unusually uncoordinated), shortly thereafter I will discover that I was still stuck in subscript or superscript mode when I continued typing, so I have to go back and correct whatever I typed before I noticed that it did that.

One useful weapon against these annoyances is: Autohotkey. More »

Most folks who use computers a lot are aware of the difference between word processors and text editors. Text editors represent the data as pure characters — no formatting, no margins, no bold or italic.  The better text editors (Notepad++ is my current favorite) have lots of useful features, and typically can handle Unicode and Asian fonts, but when you save a document, what you’re really saving is a long list of binary numbers, each representing one character, and that’s all.  Word processors are different: in addition to the encoded characters, there are codes to indicate formatting, rendering of non-text elements like images or equations, and lots of other things that you usually can’t decipher because saved documents are compressed using proprietary algorithms. Open a MS Word doc as text, you get gibberish.

It’s often useful to be able to write programs that manipulate text. Python is ideal for applications that only need to read a text file, process it, and write it back out. But if the user needs to be able to interact with the program, it’s usually desirable to have a graphical interface, so Visual Basic.NET is the environment of choice. Among the available GUI controls, VB.NET does provide text boxes, which are adequate for displaying and editing pure text, but what if you need to be able to display more than just plain text? For example, what if you want to be able to highlight words found in a search? There is a solution: VB.NET also provides  a RichTextBox control that displays rtf format, which supports most common formatting and allows images. The downside: the RichTextBox control is  very finicky and hard to use. So I finally wrote a kind of wrapper for it which implements a lot of the functionality that you would think they would have built into RichTextBox but didn’t. I have posted the code on github here, together with a Windows installer for a simple word processing app based on it. In a future post I will describe a useful note-taking app that I built on top of it. More »

Back when I was teaching Java programming, I wrote a demo program that involved balls moving around and colliding with each other in a box. It was designed as a game, inspired by “Maxwell’s demon“; the box was divided into two parts by a barrier, and the barrier had a gate that the player could open or close, the objective being to try to get all the balls into one compartment. The balls would bounce around, and the idea was to operate the gate so as to let balls through in one direction but block them from getting back out. Needless to say, it did not turn out to be the next Angry Birds. It was written as a Java applet, and, as I have grumbled about elsewhere, the fine folks at Oracle have essentially killed applets dead, breaking zillions of web apps in the process, so I can’t post  a working version, at least not in that form. However, I have coded up a modified version, converted to javascript and running in a web page, here. This version is not a game, it’s a simulation of particles of gas in a box, for the purpose of trying to get a feel for some basic principles of thermodynamics.

The motivation for this simulation (apart from a continuing effort to get more comfortable writing javascript apps) relates to another “hobby” of mine, which is trying to fill some gaps in my grasp of basic physics. Meaning, in this case, the Maxwell-Boltzmann distribution, which (to oversimplify a bit) gives the breakdown of speeds of individual particles in a gas. To understand how this works, suppose you measured the speed of each of 1000 cars on the freeway. Then you could count how many are going between 45 and 50 kph, how many between 50 and 55 kph, and so on, and you could plot the results as a histogram. That’s what a Maxwell-Boltzmann distribution gives you — it’s for molecules of gas bouncing around in a box instead of cars on the freeway, but it’s exactly the same idea.

More »

I have become somewhat addicted lately to Go problems. There are apps for Android phones and tablets (and also for iPhone, I’m sure) that display Go problems and let you try various combinations of moves to solve them. Two that I use and like are ElyGo and Tsumego Pro. A more comprehensive list is here.This post is mostly about those apps and a feature that I wish they would add.

Go is a game often described as the Asian equivalent of chess. I won’t try to explain how it is played since there are many web sites that do that far better than I could (I recommend this one) — except to say that it’s played on a 19 x 19 grid of criss-crossing lines on which the players take turns placing a white or black stone. Go is actually similar to chess only in the sense that both belong to the category that game theory calls “partisan combinatorial games” and both have capture moves. 

In terms of strategy and “feel”, I find them completely different, in a way that more or less corresponds to what I perceive as differences between Asian and American or European cultures. More »

There has been a rash of commentary lately about the potential for strong AI — AGI, or artificial general intelligence as it’s often referred to — to turn around and bite the human species that created it. Paypal/Tesla/SpaceX founder Elon Musk and physicist Stephen Hawking have recently opined publicly and apocalyptically on what Musk described as “our greatest existential threat.” Hawking, in a BBC interview, said that “full AI” could “spell the end of the human race.” Naturally, there are equivalently authoritative opposing views; Ray Kurzweil, for example, sees the future of AI in much more optimistic terms, as expounded at length in several books.

Econtalk, a consistently excellent weekly podcast by the always insightful Prof. Russ Roberts, has aired two hour-long audio interviews on the subject in recent weeks, the first with philosophy professor Nick Bostrum of Oxford University (who is perhaps better known for his paper exploring the possibility that what we perceive as reality is actually a simulation), and the second with  Gary Marcus, a cognitive psychologist at NYU. Both are authors of recent books: Superintelligence: Paths, Dangers, Strategies by Bostrum, and The Future of the Brain: Essays by the World’s Leading Neuroscientists, by Marcus.

More »

It may be a Law Of Nature regarding the evolution of software that every popular software tool eventually increases in complexity until it becomes so complicated to use that the only users who can deal with it effectively are those who use it as a full time job. In fairness, that’s in large part because they’ve evolved to do some very complicated things, but it does have the effect of squeezing the amateur out of the game.

I have been a huge fan of Microsoft Visual Basic, once it became a full-fledged language under .NET. I have written many thousands of lines of code in a variety of programming languages, and taught college level CS-1 courses in five of them (C, C++, Java, Visual Basic, and Perl). Of those five, Visual Basic (in my experience at least) is by far the easiest learning curve for students. And for any program requiring a GUI, Visual Basic is by far the quickest of the five for getting a working prototype up and running, and always my first choice (Python would be first choice if all I need is a console program). Microsoft has made things even better by opening up the full, non-crippled version of Visual Studio 2013 for free.

There is, however, one aspect of the Visual Studio experience that hasn’t improved, in my opinion — in fact it’s gotten worse. And it’s a big enough issue that I’m probably going to hold my nose and switch to single page javascript apps as my go-to platform for quick and dirty GUI programs. I’m referring to the problem of deployment.

More »

This post is about a simple children’s math game that I coded, which anyone interested is welcome to download. I’ll get to that momentarily; first a word about why it seemed worth doing.

One of the most glaring failures of public education is its inability to impart even basic math skills. There is a reason why we don’t succeed in teaching math: it’s impossible, the way we try to do it. All the children in a class in school are expected to do the same assignments, in the same book, in the same order, at the same time. When the book moves on to the next topic, every child in the class has to move on, whether he or she has mastered the current topic or not.

That doesn’t work at all with math because math builds on what has already (supposedly) been learned. You can’t successfully teach a math topic to a child who hasn’t already mastered all the basic skills that led up to it. If a child is weak on even one of the previously covered skills, he or she will flounder, most likely from then on. In elementary math, if you want a child to succeed, you do not move on to topic N + 1 until the child can execute topic N, consistently, quickly, with no false moves, and no mistakes. You don’t have to take my word for that — precisely that concept is the foundation of the only truly effective children’s math curriculum I’m aware of — the highly successful (and expensive) Kumon Math after school tutoring program.

Our two nephews who live with us (ages 9 and 14) go to a private (Catholic) school here in Davao (Philippines). Both are bright kids; both struggle with math. They get passing grades, but that’s mainly because schools find ways to let kids get passing grades without actually being able to do math. If they didn’t do that, everyone would be stuck repeating fourth grade forever, since, as already noted, it isn’t possible to learn math this way. More »

As expounded elsewhere in this blog, I built a database of full-text U.S. patents and patent applications and some search tools for doing some data mining in it. As described in this post, I used it to extract a corpus of patents and applications that appear to represent in-house inventions of Intellectual Ventures, and organize them by subject matter.

Intellectual Ventures (“IV”) is the intellectual property powerhouse founded by Nathan Myhrvold after he left his position as Chief Technology Officer of Microsoft. IV receives a lot of criticism in the press and the blogosphere, often being portrayed as the mother of all “patent trolls” (a pejorative term originally popularized by IV co-founder and vice-chairman Peter Detkin, who was in house at Intel at the time). IV owns a lot of patents — according to its own published figures, it has acquired 70,000 patents since its founding, and filed 3,000 patent applications on the inventions of its own team of inventors. (Not everyone thinks this is a good thing.) More »

In the continuing saga of me trying to bludgeon WordPress into doing what I want it to, I took a shot at coding a simple widget. You can see it there on the right — it shows the local time here in Davao, Philippines, and a quote taken at random from a text file.

Widgets, for the uninitiated, are separate programs that “plug in” to (in this case) a WordPress page. There are thousands of WordPress widgets out there, and most of the ones you see on blogs are “canned” widgets — you just download them, drag/drop them onto your page, perhaps specify a setting or two.

Or, you can write your own. It isn’t difficult, but it does require some basic familiarity with at least PHP and preferably also javascript. More »

In a probably futile effort to stave off Alzheimers by torturing my brain, I have been trying for a while now to learn to read Chinese. Chinese is crazy difficult, for a number of reasons that I won’t go into here. I don’t have the time to devote to it that it would take to become actually fluent, which as best I can tell would require dying and being reincarnated as a Chinese person plus about 20 years of full time study. So my goal is more modest, just reasonable reading comprehension, mainly for reading patents and doing patent-related text mining. I try to spend half hour or so a day reviewing vocabulary and reading things, to reassure myself that I’m still dumber than a Chinese ten year old.

Trying to learn to read Chinese might seem like a waste of time — why not just use Google translate? It turns out that for most anything of adult reading level and complexity, the output of Google translate for Chinese to English is essentially incomprensible gibberish. Machine translation between Chinese and English is a seriously non-trivial undertaking because the two languages are so different on so many dimensions. Personally, I’m skeptical that the current statistically based approach to machine translation can be made to work here; More »