Monday, October 15, 2018

DOS for kids

Find out why my kid is learning DOS in 2018...

There are many great options to learn how to use computers. You could get any excellent Linux distribution, and install it on a spare machine. You could teach a child Python or Basic256. My kids use Linux laptops, and that works out well for most of their needs.

Recently, my son took an interest in other operating systems. His hard disk is going bad after years of use, and we started experimenting with alternate operating systems on USB sticks. He saw me reading about Haiku; we booted it up and played with it. We already used Dosbox to play a game that I really enjoyed as a child, so we installed Freedos on an SD card to play with it.

He loved FreeDOS better than I had expected. It is a very simple system: single user, no access control, no hidden or magic directories. Everything is right there in front of you. We installed QuickBasic and a typing tutor, and he loves the system. He even loves the spartan look of the default editor, which looks like edit.com.

Today, he practiced typing on a typing tutor from 1992.  Then we wrote a simple Basic program together, and compiled it to an EXE file. He loved every minute.


That made me reconsider tech's love of the new. The computing world is a slave to hot trends: Artificial Intelligence, Machine Learning, Virtual Reality, Augmented Reality, Internet of Things, Blockchain, ... Everyone wants to learn about new technologies, the old is an embarrassing relic.

But are new systems always the best to learn?


There are scores of videos showing how old systems booted up faster, and got the job done just as well. There's a hint of truth to that.
FreeDOS boots on a decade-old computer in less than a second. Quickbasic probably takes a second to start up. Compilation is quick. Everything is instant. Fast. No clutter. No notifications, no icons, no buttons, bars. The whole interface has been run through an optimizing compiler.

The system cannot connect to a network, so everything is child-safe. And there is no chance of my kid goofing off and playing a game, or being distracted by some pictures. My son said that FreeDOS was "an Xterm that became your full computer."

And to top it up, my son can modify whatever he likes and experiment to his heart's content. When he ends up messing up the system, we can reinstall FreeDOS in a minute by wiping the SDcard clean, and copying again. I have a stack of old SD cards.

All the knowledge gained is valuable in today's world: hierarchical file systems, writing source files, compiling, touch-typing. It is a simple system and a person can truly understand the fundamentals. Learning DOS might be easier than learning a very complicated architecture like Linux, where there is a kernel, but also userland utilities, X-Windows, browsers, multiple users, access control...

In the past few days of playing with FreeDOS my son has asked insightful questions, which make this experiment very satisfying for me.




Image: Courtesy Wikipedia.

Saturday, September 22, 2018

Autobiographies ...

I haven't read a lot of autobiographies, but here are a few that I've read in the last couple of years that made an impression.

Books about high-altitude mountaineering are exciting by definition.  But there's more to this one than just that.  It's the story of a woman who wants to climb high mountains in a time when it's mostly men who do that sort of a thing.

2. Tender at the Bone by Ruth Reichl
Ruth Reichl is a restaurant critic / cookbook author.  This is the story of her unusual childhood (dysfunctional family included), and her love of cooking.  It's peppered with recipes that I didn't really want, but I loved the story.

3. God's Hotel by Victoria Sweet
The author writes about her years working at San Francisco's Laguna Honda Hospital, which is one of the last few almshouses (a free hospital for poor and often chronically ill people) in the country. Dr. Sweet also talks about her research of pre-modern medicine (and be warned - those sections are not as interesting).  But overall, I found this book to be very insightful and very fun to read.

The three books above were all surprise finds.  I picked them up at the library and brought them home because I liked what it said on the back cover.  Didn't have them recommended to me by a friend.  Didn't look up the Amazon reviews.  What joy to run into a good book accidentally like that!

Tuesday, May 22, 2018

An ordinary life

tl:dr; You are interesting. Your life is interesting.


When I first arrived in America, I was amused by the American obsession for biographies. Bookstores had shelves full of biographical accounts by actors, sportspersons, rich people, celebrities, crooks, ...

Biographies can teach: you can learn from others' lives and temper your own expectations. Looking through other people's lives gives a sense of perspective on your own.

But on the flip-side, biographies can lead to discontent. When writing a biography, the speaker has to spin a story. The author has the benefit of seeing a life with perfect hindsight. This allows them to create a narrative showing how the person was destined to greatness. Or how their effort (and effort alone) led to great success. Or you see a criminal's life in hind-sight and you can spin a tale for why the person was destined for a life of crime. You don't fully see the contribution of circumstances or chance. You don't get to probe. You don't see the choices the person faced.

All this leads to a lopsided view of someone's life. A successful person's life starts to show hints of success at an early age. A crook's life starts to show shady behavior at an early age. Individual effort gets amplified, and the effect of their surroundings get diminished.

After reading such a book, you evaluate your own life and find your life devoid of the same purpose or clarity. After all, the person with the biography reached somewhere, either a position of power  or a the jail. That final destination made the story worthwhile.

And then you wonder yourself: Where am I now?


Most biographies are written with a purpose: to aggrandize, or to spread a message, or to sell a story-book. It is a rare biopic that is truly honest and objective. After all, the narrator is talking about a single person, and it is difficult to get any meaningful distance when the book revolves around one person.

Since these stories are spun around extremes of human achievement, we find it difficult to relate to these stories. We aren't rich, we aren't prominent. The opportunities presented to us are different. Could a kid in Sudan who worked as hard as Bill Gates achieve the same wealth?

But doesn't a kid in Sudan have an equally meaningful life?
After all, we're all equally human. And in their own way, all of our lives are equally interesting.


Over the past week I have been reading an online journal by a person I've never met, and their life (going back to 2005) is fascinating. We share some common interest, and we are similar in age. But our backgrounds differ vastly. I suspect our current lives also differ vastly.

And yet I have learned more about myself by reading this person's account than I did from any biography. Lessons about mid-life, lessons about loneliness, lessons about grief and hopelessness. I have seen the world through this person's eyes. I appreciate my own surroundings in richer color.


See photographs of the best dressed, most gorgeous people and you are disgusted at yourself in the mirror.  Read about the richest, most successful, and you'll never be satisfied by yourself.


All of us have meaningful lives. I live in obscurity and yet my story is as rich as yours.

Tuesday, February 13, 2018

Game Review: TIS-100

TIS is a new game by Zachtronics. tl:dr; Geek? Buy it.

Earlier, I had written about the lack of diversity in games. The world doesn't need another action adventure first person shooter. What it needs is creative games, games that make you evaluate, to think new thoughts. I loved a game that made you burn stuff, and a gem by Zachtronics called Space Chem. I have been interested in Zachtronics' catalog since SpaceChem. For background, SpaceChem was about splitting and combining atoms to make new molecules.

TIS-100 is about parallel programming. But that's as vacuous as saying Chess is about moving wooden pieces on a board. TIS is about writing good code, about making magic with very little, about learning how best to utilize a small instruction set.

It is about reliving 80s computing: complete with a ratty manual, an uncertainty about what to make. Walk away with an appreciation that you can do a lot. Learn the system, and you can bend it to your will.

You write assembly language programs for a computer that has multiple stream processors, where multi-processor communication is a one-cycle primitive, and you choose how to achieve the objective.

You don't need to know assembly, you don't need to know programming. You don't need knowledge of Chemistry for SpaceChem, you don't need to know programming for TIS-100.

But at the end of it, you appreciate programming and you learn how much fun programming can be.

TIS is an absolutely amazing game. A game that I will be recommending to many friends, and their young kids.


Here's a video showing the different processors (little square boxes). The highlights are on executing lines, and the left side shows inputs and expected outputs.


Video courtesy: me.

Friday, January 26, 2018

Matrix Voice: Hardware review

Many years ago, my Math professor and I chanced upon a 3D cube maze puzzle where a metal ball had to be extracted from the transparent maze.  We tried our best to solve it, but neither of us could.  So we did the next best thing: we proved that it was unsolvable...

I bought a Matrix Voice on IndieGogo last year. The tagline was, "Open-Source Voice Platform for all". It shipped eight months late, and does very little. Read on for cautionary tale on crowdfunded ideas where the promises surpass expectations. And promises that surpass a shipped product.

Matrix Voice looked enticing: a device that captured from multiple microphones and allowed you to process it on a Raspberry PI. Seven microphones, some expansion capability with GPIO, and a development platform built upon Raspberry Pi, Linux, and standard tools. Sounds promising, so I signed up, and put $115 for a Matrix Voice board, a Raspberry PI, and May 2017 availability.

March to May is a long time, I forgot all about it. I was waiting for it to ship, I would read the quickstart guide, and much like other single board computers, I would tinker with it and make a useful gadget.

Around July last year, as I was ordering other equipment, I vaguely remembered having funded a project on Indiegogo.  So I dug up the receipt, and went over to the project page to be greeted by irate users all expecting some shipping details.  May 2017 had come and gone, and delivery dates were moving to August, which had also past.



Projects get delayed. Software can still ship with a reduced feature-set and be improved upon, hardware projects can't. In addition, building hardware is difficult and messy. At this stage, I half-expected the project to be an elaborate scam. Looking through their pitch at IndieGogo, I was surprised I fell for it. The team list didn't include any people's names, and instead had lofty titles for the team, "Senior Advisor", "Country Manager Brazil", "Innovation Manager", and "Director of Operations". Everyone gets fooled, right?

So imagine my surprise when the board finally shipped! I got a notification that a package was headed my way, and I was eager to play with a real device. The quickstart guide, while slim, mentioned the URL https://voice.matrix.one/boards and https://matrix-io.github.io/matrix-documentation.

The first link redirects to this one (https://www.matrix.one/products/voice#compatibility) instead, and is surprisingly mum on code you can use. It points to a Documentation page which talks about MATRIX Core, Matrix OS, and Matrix HAL. No reference to Matrix Voice, or how it relates to these other words. Worse, they all talk about a product called Matrix Creator, which is a different board, with a different controller, different mic array and LED setup, and completely different sensors.  The most detailed information I could find was this Matrix Voice architecture page which has gray boxes connected trivially to an FPGA.

Voice Diagram

None of the Matrix Creator projects worked on Matrix Voice. The matrix-creator-hal demo programs on this question, for instance, gave SPI errors on the Matrix Voice. Neither the microphone nor the LEDs work on the Voice. My lofty ambitions had sunk so low that I was thrilled when the code compiled.

The only project I could find that uses the Matrix Voice is this Alexa demo project. It requires two packages: matrixio-malos (a binary file run as a service) and libmatrixio-creator-hal-dev (header files that don't refer to the binary or the service).  It refers to a github project: https://github.com/matrix-io/alexa-avs-sample-app.git. The Debian packages are interesting in how little they contain.

$ dpkg-deb -R matrixio-malos_raspbian-stretch-0.2.2_armhf.deb matrixio
$ find matrixio

matrixio/usr/bin/malos
matrixio/usr/share/doc/matrixio-malos/README.Debian
matrixio/usr/share/doc/matrixio-malos/changelog.gz
matrixio/usr/share/doc/matrixio-malos/copyright
matrixio/DEBIAN/md5sums
matrixio/DEBIAN/control
matrixio/DEBIAN/postinst
matrixio/DEBIAN/prerm
matrixio/lib/systemd/system/matrixio-malos.service


$ dpkg-deb -R libmatrixio-creator-hal-dev_raspbian-jessie-0.1.4-main_armhf.deb creaor-hal-dev
$ find creaor-hal-dev

creaor-hal-dev/usr/include/matrix_hal/humidity_sensor.h
creaor-hal-dev/usr/include/matrix_hal/uart_control.h
creaor-hal-dev/usr/include/matrix_hal/everloop.h
creaor-hal-dev/usr/include/matrix_hal/everloop_image.h
creaor-hal-dev/usr/include/matrix_hal/dummy_sensor.h
creaor-hal-dev/usr/include/matrix_hal/microphone_array_location.h
creaor-hal-dev/usr/include/matrix_hal/dummy_data.h
creaor-hal-dev/usr/include/matrix_hal/fw_data.h
creaor-hal-dev/usr/include/matrix_hal/direction_of_arrival.h
creaor-hal-dev/usr/include/matrix_hal/cross_correlation.h
creaor-hal-dev/usr/include/matrix_hal/circular_queue.h
creaor-hal-dev/usr/include/matrix_hal/gpio_control.h
creaor-hal-dev/usr/include/matrix_hal/creator_memory_map.h
creaor-hal-dev/usr/include/matrix_hal/uv_data.h
creaor-hal-dev/usr/include/matrix_hal/imu_sensor.h
creaor-hal-dev/usr/include/matrix_hal/microphone_array.h
creaor-hal-dev/usr/include/matrix_hal/pressure_data.h
creaor-hal-dev/usr/include/matrix_hal/uv_sensor.h
creaor-hal-dev/usr/include/matrix_hal/wishbone_bus.h
creaor-hal-dev/usr/include/matrix_hal/mcu_firmware.h
creaor-hal-dev/usr/include/matrix_hal/matrix_driver.h
creaor-hal-dev/usr/include/matrix_hal/imu_data.h
creaor-hal-dev/usr/include/matrix_hal/pressure_sensor.h
creaor-hal-dev/usr/include/matrix_hal/humidity_data.h
creaor-hal-dev/usr/share/doc/libmatrixio-creator-hal-dev/changelog.gz
creaor-hal-dev/usr/share/doc/libmatrixio-creator-hal-dev/copyright
creaor-hal-dev/DEBIAN/md5sums
creaor-hal-dev/DEBIAN/control


The payload is bolded.  Everything else is metadata or superfluous. The instructions ask you to reboot the machine after install malos: even though it is a single binary run as a service. You could just run /usr/bin/malos as root. Looking at the source, malos writes to FIFOs in /tmp/matrix_micarray_channel_* and those are expected to be set up as audio streams in Linux.  But you'd need to know a lot about Linux and audio to get past this information. Finally, this package might work with a Matrix Creator but does not work for Matrix Voice. Since all the samples for matrixio-creator-hal fail on the Matrix Voice, the malos binary gets SPI errors. Both malos and the demo program call matrix_hal::MicrophoneArray.Read(). Both get failures.

It's no surprise many backers are having trouble getting the Alexa demo working on Matrix Voice.  One backer even said that they were just guessing what code was used in the demo video.

Finally, the Alexa Sample Github repository has a lot of setup: it installs Node, VLC, Maven, WiringPi, OpenSSL.  But the only code that ever reads a microphone is the Java sample from AVS: samples/javaclient/src/main/java/com/amazon/alexa/avs/MicrophoneLineFactory.java which reads the default mixer and the default microphone. The microphone on the Raspberry PI. This will only work if you have set up Alsa to read from the pipe in /tmp, and if you have a Matrix Creator. If you have a Matrix Voice, you'll read from the default microphone on your Raspberry Pi. Nothing calls the MicrophoneArray code from libmatrix_creator_hal.a. (which isn't even in the installation instructions). I suspect you could go through the entire Alexa Sample Github code without needing the static library. Or the header files.

The github link and the Debian packages hide the fact that none of these packages are hooked together. And as mentioned earlier, creator-hal-dev is for the Matrix Creator, not the Matrix Voice. The demo programs from creator-hal-dev all fail on the Matrix Voice. Someone copy-pasted instructions from the Alexa Matrix Creator project instructions to the Alexa Matrix Voice project and didn't notice that the instructions are wrong.

If anyone wants a Matrix Voice, rummage through my electronic trash next week. It looks like a circular board, covered in shattered promises.


There are many wonderful crowd-sourced projects and ideas. Be cautious, be realistic. Above all, be patient. Game-changing ideas and products stick around for years.

Update (29 Jan): Matrix_Alfred posted a reply on the Matrix Community forum and disabled my account from posting feedback. They are eager to hear from their backers, apparently. This is my feedback for them which I had to create another account for.  See it online before they silence that account too.