Technological Burblings

Just another weblog

A Happy Graph for Happy Numbers

I just read about Happy Numbers on Math = Love, the blog of Sarah Hagan. She used it as an activity in her class, and I like it a lot! It reminds me of hailstone numbers. Hailstone numbers, claims Lothar Collatz, always resolve to a cycle 1->4->2->1.  The rule for hailstone numbers is piecewise-defined based on whether a given number is even or odd: if it’s even, divide by two; otherwise, multiply by 3 and add 1. The rule for happy numbers is nice because it’s the same for any whole number: square each digit, and add the results.

My first reaction was to make a graph of the numbers, but I quickly got tired of doing the arithmetic, so I wrote a program for my HP48 calculator. Here it is! If you are not familiar with the HP48, it uses a stack-based programming environment. I won’t explain that, here.

« DUP 10 MOD 2 ^ SWAP
  REPEAT 10 / IP DUP 10 MOD 2 ^ ROT + SWAP

It has been a long time since I last wrote a program for that calculator; it was a fun exercise. Once the calculations were easier, it was not too hard to create the graph. I made the graph using the Graphviz programming language. The code looks like this:

digraph G {
 graph [layout=dot rankdir=UD]

 * Graph showing Happy Numbers and Sad Numbers.
 * Procedure: for any integer, add the squares of the digits.
 * Repeat. If the chain of numbers eventually falls to 1, the
 * original number is called a Happy Number.

1[label="1 :)"];
{78 87}->113->11->2->4->16->37->58->89->145->42->20->4;
{32 23}->13->10;
{19 91}->82->68->100->1;
{38 83}->73->58;
{39 93}->90->81;
{48 84}->80->64;

{59 95}->106->37;
{67 76 92}->85

…and the finished graph looks like this:


Persistent Voicemail Notification on Android Lollipop

Screenshot_2015-04-15-03-17-18~01I just switched phone numbers on a Nexus 5.  Before my old number evaporated, there was a voicemail to which I did not bother to listen. The number is gone. The mailbox is gone. The notification remains.

On Android 5.0.1, here is how I ditched the notification (which cannot be dismissed with a swipe, like most): Open Settings > Apps. Switch to the ALL tab. Apps are listed in alphabetical order.Scroll down to “Phone”.  On my device, there are two of them (??!?). By tapping on the second one (1.40MB, in this screenshot), pressing Clear Data will make the notification go away.

I don’t know what other data it might clear, but contacts and call history are still intact (for instance).

Kiosks for fun and profit

A friend has a cafe with complimentary Internet access for patrons. In addition to WiFi, he has two computers which function as Web kiosks, for those who don’t bring a laptop of their own. I have been maintaining these computers, running Linux, for over a year. I have decided to update them, so here I will document what I’ve done.

Operating System
The operating system I am installing is Linux Mint 12. After torrenting the ISO from, I use unetbootin to create a bootable USB stick. Booting into this drive, I do a standard install, preserving the /home partitions from before.

This computer will have two partitions, one for / and one for /home. I am going to try out xfs for the root partition. The home partition is currently ext4.

5.3GB – /home
6.0GB – old /
6.5GB – current /

After automatically updating the package list and upgrading all the default packages, I install the following packages just because I like to have them around:
awesome awesome-extra zsh git vim xfce4
Google Chrome

There’s a corporate log walpaper that I copy into /usr/share/backgrounds.

I create two accounts, kiosk and kiosk-skel. In my home directory, I have scripts, and I make all changes to kiosk-skel, to get it set up just the way I want. Then, I log out of kiosk-skel and into my own account. I run the script update-skel as root, which creates an archive of kiosk-skel’s home directory. Upon login,

College Placement Tests

College placement tests are in common use at the community college level. How effective are they?

I am about to start working as a mathematics instructor at a university. I do not know their system for placing students in appropriate math classes, although I have heard that they start the students at the beginning, offering placement tests to those who would like to skip ahead to more advanced subjects. Currently I tutor at a community college. The students here are automatically put through a placement test when they arrive, and the first classes they take are selected according to their scores.

I think that creating effective placement tests must be a fairly difficult problem. I would like to see how placement tests perform. Do students usually feel that they have been placed at a suitable level? Do their teachers? To their grades show that the placement is fitting?

One of the difficulties with placing students is that they come from a patchwork of backgrounds. Non-traditional students, particularly, who have been out of school for years, will only recall certain things from high school and college.  The things they do recall will directly relate to their post-school experience, since only those things which are used will be actively retained.

What are non-traditional students likely to retain?

So, if a student somehow recalls much of the material from, say, intermediate algebra, but has completely lapsed on a few specific concepts which are covered in that course – or even more basic things like arithmetic – should the student sit through the material again?  I have little idea of how this works in practice.

As a tutor, I have rarely met students who are bored with their classes.  Those students do not need my help, so they don’t seek tutoring.  I spend most of my time with students who are struggling.  Students who are discouraged and defeated, or frustrated with their teachers.  I see those students a lot.

If these students are mis-placed, it is because they were placed in too advanced a course.  I never see the students who are placed in too low a course.  They don’t spend their time with tutors.  They spend their time having fun, or working on other classes, or blowing off steam about how lame their math class is.  (But not to tutors.  Probably to classmates who are similarly under-placed.)

This sounds like an interesting thing to research.

A Better Way to Index Cited Authors

In my dissertation, I have two indices after my bibligraphy: Index of Subjects and Authors of Referenced Work.  In LaTeX, I had been using the index package for my purposes; this page provides a decent overview of the alternatives. The system works fairly well. Every time you find a place in the text which should be referenced by the index, you type \index{subject} for the ‘default’ index or \index[topic]{subject} for the special topic’s index. Then it ensures that there is a line subject in the index, and that the line has a page number at the end corresponding to where you inserted the \index command. Okay so far. You have to run makeindex during the document build sequence. Works as well as can be expected.

Trouble is, I am creating this list of authors, and basically I have to:

  • type an \index command for every author referred to by a \cite
  • make sure they are consistent
  • type or copy these names that are already in my BibTeX database
  • reformat them so they are properly alphabetized.

So painful. Why would I do this to myself?

A cursory look at the file formats indicates that doing this ad hoc in a script is going to be hard. Enter authorindex, the package that gives me what I want. It pores over document.aux for bibliography information, then processes it so you get a list of authors and page numbers, and formats this as something which looks like an index. Pretty tight. It will save your back. Check it out.

Recording One’s Thoughts

I have just finished reading Lion Kimbro‘s book about How to Make a Complete Map of Every Thought you Think.  Interesting ideas, there.  The main concept is to capture all meaningful thoughts that you have, and process them in such a way that you end up with a map of your thoughts and how they relate to one another.  He is an avid computer programmer who advocates using pen and paper, which is a provocative stance to take.  (He spends an entire chapter defending it, in fact.)  He argues that there is no computerized note-taking system in existence which can catch the ideas and relationships in the way he seeks to do.  More pertinently, there is no computer system that currently depicts maps of ideas in the way he does.

The book leaves me with the feeling that I desperately want to take notes.  That I wish I had developed note-taking skills years ago (or at least, that I had taken up the habit during my PhD).  The book he wrote describes what is needed to replicate his system, and describes the consequences of using it.  There are a few trade-offs.

Pros and Cons

First, the primary advantage he describes is clarity.  The process of writing out your thoughts and seeing them crystallize into maps makes the ideas incredibly lucid.  The trouble with crystals is that they are solid, which is the issue in the next point.

Secondly, rigorous use of the system does immobilize the user.  It does this in two ways.  On the surface, if you are spending all your time writing your ideas down, poring over them, arranging them in maps, and refining them, you will have time for little else.  But on a deeper level, it restricts your thought patterns.   This, in turn, has pros and cons: your thoughts on the topics you touch will be more thorough, and will have a richer structure; but when you dwell on a topic deeply, it is harder to make quantum leaps.

Thirdly, it makes you want to act.  Deep thought on new topics will naturally give rise to strategies for action in these areas, and the richer the strategy, the stronger the urge to execute it.  This is one of the reasons that Lion cautions against using this system in earnest for more than a few months.  Perhaps it is unsustainable.  It is definitely undesirable to carry on indefinitely.  (Unless, as Lion notes, you are a monk.)

What this Gets You

The goal of the system is to create a map.  This map should provide a meaningful representation of the thinker’s thoughts, particularly their interconnections.  The thinker should be able to recreate whole concepts and lines of reasoning, simply from studying the map.  All work in the notebook is towards this end.  The utility of the map lies not only in its ability to jog the thinker’s memory about past thoughts, but also in serving as a foundation for developing new lines of thought.

Maps are also, naturally, useful as references and illustrations in conversations with others.  The notebook provides a tool that can be used in discussions.  Rather than saying, “This is what I think,” the notebook-carrier says, “Come look at what I thought.”  It provides a layer of transparency for sharing ideas.  In addition to sharing ideas in conversation, the map can provide great aid in serializing ideas on a subject when it becomes mature.  That is essentially the manner in which he wrote the book in this subject.

Software Issues

As a programmer, he does have some specific ideas on necessary architecture for the elusive notebook computer system.  As I was reading his book, I could not help but ponder this question, myself.  Alas, I was not taking detailed notes during the reading, so I have no hard record of the ideas.  I will try and chronicle them here.

The most important features of his notebook system are references and topics.  References indicate how one thought uses or is related to another, and topics collect thoughts in various forms.  Any computer system for note taking must make it easy to make these links and tag ideas with topics.  HTML and friends provide a data structure for this, but typing and viewing XML is so distracting and tedious.  We want something that will offer us a list of available topics automatically, and create the links for us.  This calls for a special data structure, I think.  Data structures are not my specialty; I do not know what it should look like, really.

Links and topics should be easy to create.  The software should be intelligent about sorting the options so the most obvious choices can be used with almost no thought.  Careful consideration needs to go into the scheme for keybindings and other UI issues.

The maps are the ultimate product of this system, and I would like to think that they can be generated automatically based on the references between ideas.  Automatically-generated maps should be editable as visual maps so that when the automatic system does not get something quite right (perhaps an idea is shown too close to some topic, or needs to be shown more prominently), it is stored in a way that is persistent.  Maybe the system learns and makes new rules?  I don’t know; I want to stick to behaviour, not implementation right now.

There should be a way to spit this out on paper.  If you keep a hard-copy notebook that you carry around with you, the system should know what pages have changed since you last printed it, so you only get replacement pages.  Page numbering might be an issue here, but I suspect it is not so bad.

Lion has good ideas about browsing the map when on a computer.  I would not know where to begin in implementing that sort of thing.

Closing thoughts

Lion has said that he no longer uses loose-leaf binders anymore; his system has changed a fair bit.  I suspect that this is because the notebook system he describes in his book is the one he used during the catch-every-thought period, and it has changed as the notekeeping has become less-thorough.  I do not know if this is why, though; he has only said how it changed, not the reasons for the changes.

Currently, I am in the throes of writing up my PhD. thesis.  It is not the sort of time that I can afford to attempt this kind of paradigm shift.  I hope to try exhaustive note-taking when my dissertation is done, and I am back in Florida, next year.

Making LaTeX A4 Paper Size MEAN A4

While working on my dissertation, I made some changes to the page layout. The unthinkable happened when I started to use the geometry package: what had been a document on A4-size paper was A4 no longer, and it was cutting off my headers (with page numbers). I have not taken the time to figure out what geometry has to do with it (specifically), but quick queries on the web will betray that I am not alone. The hallmark of the issue is this: DVI files are displayed with the intended A4 size. PS files produced by dvips may or may not be A4. But ps2pdf spits out a document with letter-size pages. Thanks to the LaTeX wikibook, the code to add is:


And while you’re at it, pass -t a4 to dvips and -sPAPERSIZE=a4 to ps2pdf. If, like me, you use latex-rubber to build your documents, you can add the following line to your document, and it will pass that option to dvips, which seems to be enough to get me where I need to be (on this current workstation). They claim that this should be sufficient to rectify these problems with any version of ghostscript. Let us hope that it is true.

Rooting the Droid: a comedy of errors

This evening a friend asked for help rooting his Motorola Droid. It was running Anddroid 2.1, and we wanted to be running 2.2. Using the instructions found here, we got it working. These are the problems we ran into and how we solved them.

One of the overarching interests in the experiment was to tether computers (and an XBox) to his phone. Additionally, he was interested in overclocking and running flash.

Our first attempt at the instructions was to use Option 2, since my favored operating system is Linux. We attempted to follow the instructions, but found them unclear; the typography of the site does not help, as the link colors blend in to the text. The main problem with this portion of the instructions, however, was the direction to another set of instructions on DroidLife which were somewhat ambiguous. It made mention of something called “ROM Manager.” ROM Manager, however, requires that your phone is rooted, which is a state that we were aiming to achieve through these instructions. Skipping the steps related to this app resulted in an “Installation Aborted” error message. We were not impressed.

We then fell back on the Windows Users instructions (Option 1), which were significantly more fruitful. The (illuminated) steps are as follows:

  1. Install RSDLite 4.6. This is software for communicating with and controlling your phone when it is connected via USB.
  2. Install the Motorola USB drivers. These are available for 32-bit and 64-bit versions of Windows. It was not clear to my friend that this distinction was for Windows versions; this is why he got me involved in the first place. (We used the ones for 32-bit Windows.) This software tells your computer how to communicate with the phone at a more fundamental level, while RSLite provides fancy functionality.
  3. Download the SP Recovery image. Your phone has, in essence, two operating systems. When you press the power button, the first one runs, then bootstraps the second one. The second one is Android, which is the only one you usually see. This first operating system is tiny, stealthy, and specialized at system recovery and bootstrapping. SP Recovery is a replacement for the one that came with your phone, and provides additional features for backup and whatnot.
  4. Open RSDLite and click the ‘…’ button to browse for the SP Recovery file that we downloaded.
  5. Once your phone is off, connect it to the computer via USB. While holding the ‘up’ button on the directional pad of the phone’s physical keyboard, press the power button. Before long, the phone should be on and displaying a text-only screen which is the bootloader. Your phone should appear in the RSDLite window.
  6. Press the ‘start’ button in RSDLite. This will initiate the process of flashing, or reinstalling, that basic operating system with SP Recovery. When it is finished, the phone will have been booted back up into normal Android.
  7. The instructions say that RSDLite can behave ‘confusingly’. This just means, in our experience, that once the phone has booted up, RSDLite may still indicate progress of some sort. We let it run its course before going any further, but it is likely that this progress indication may be disregarded once the phone’s boot sequence is complete.

Sharing a Dial-up network connection over an Ad-hoc network

Recently we decided that, since we have decent broadband access in other places and cable broadband is too expensive, we will do our best with dial-up Internet access.

Ubuntu defaults

To change settings in Ubuntu, like for your time zone or default editor or web browser, use the command update-alternatives --config [option].