Reading List

The Selfish Gene
The Psychopath Test: A Journey Through the Madness Industry
Bad Science
The Feynman Lectures on Physics
The Theory of Everything: The Origin and Fate of the Universe


ifknot's favorite books »

Saturday 17 October 2020

Reading dumb data into the C++ heterogeneous data_frame

 

Ingest some CSV

Last month I presented an R-ish data_frame class as a small side project, this month I present a C++ equivalent of the R read.csv()function to import data into a data_frame class.

Ongoing development is at the github repo: https://github.com/ifknot/rpp

To recap the motivation for the C++ heterogenous  data_frame class was two-fold:
  1. Runtime handling of dumb data whose format, types, and fields are unknown.
  2. Enable data science skill transfer from the R functional programming environment into C++.
The motivation for the read_csv()function remains the same as that for heterogenous the  data_frame class:

"I want to be able to do the same sort of thing that I do R, but in C++".

Which, this time around, means that I want to be able to use one of the easiest and most reliable ways of getting data in - text files.

In particular CSV (comma-separated values) files. The CSV file format uses commas to separate the different elements in a line, and each line of data is in its own line in the text file, which makes CSV files ideal for representing tabular data - i.e. the  data_frame class.

Saturday 5 September 2020

A heterogeneous data frame in C++

 

Organise your data the R way

NEW! - more stuff and in a github repo - https://github.com/ifknot/data_frame

I like R for statistics. The variables in R are lexically scoped and dynamically typed. 

I like C++ for just about everything else. C++ is a strongly typed language and it is also statically-typed; every object has a type and that type never changes.

I want to do some simple statistics in C++ but I can't imagine doing that without a heterogenous Data Frame.

I want to be able to do what I do in R - desiderata:


But in C++ - ipsa:


It does this (unlike R in C++, indexing begins from 0)


Here's how...

Wednesday 15 July 2020

PiDP11 211BSD Jove cursor key bindings




JOVE - How do you keymap VT100 arrow keys?

I found the answer in a 1991 comp.editors Google Group or rather 3 answers courtesy of  Alan Coopersmith (Open Computing Facility, Berkley) quote...

There are 3 basic solutions (all of which are commands put in your
.joverc file):
1. Upgrade to version 4.14 (I was told 4.9 really means 4.09) and use:
>       make-keymap vt100-map
>       bind-keymap-to-key vt100-map ^[[

>       bind-to-key next-line ^[[B
>       bind-to-key previous-line ^[[A
>       bind-to-key forward-character ^[[C
>       bind-to-key backward-character ^[[D
2. Use this (not sure which version):
             bind-to-key prefix-3 ^[[

             bind-to-key next-line ^[[B
             bind-to-key previous-line ^[[A
             bind-to-key forward-character ^[[C
        bind-to-key backward-character ^[[D
3. Stay with version 4.9 and use:
        bind-to-key ansi-codes ^[[
        bind-to-key ansi-codes ^[O
I will use #3 since it doesn't require bothering the overworked/unpaid
OCF staff to install a new version.  It is also the simplest, but only
works with vt100/ANSI term types.  If you want to do assign keys on a
vt220 or a Sun or anything else that doesn't use the vt100 key codes, you
need a version past 4.9.  (To find out what version you have type M-X
version).
I used solution 3. and that worked just fine.


PiDP11 211BSD upgrade to patch level 469 (Chase Covello 2019)


Upgrade 2.11BSD to patch level 469 - Chase Covello (2019) github

Chase Covello's 2.11BSD patch 469 adds a number of features not least of which is the EMAC-like editor jove as a more humane editor than vi.

Display high-resolution graphics with the Tektronix 4010 terminal emulator

Log in as user tektronix. The directories under /home/tektronix/ contain example programs and plot files for use with Rene Richarz’ Tektronix 4010 graphics terminal emulator. [manual]

Saturday 11 July 2020

PiDP 11 ~/php.sh returns 0 Version GLIBC_2.28 not found



The latest version of smh for the PiDP11 requires glibc 2.8 unfortunately Raspbian stretch has version 2.4 and so your updated install of smh wil not work.

However, it is possible to update stretch to buster and this will solve the problem.

How to do this is a straight cut & paste from DDuck at
 https://www.domoticz.com/forum/viewtopic.php?t=30219

Let’s first update all the currently installed packages by running the following command.
CODE: SELECT ALL
sudo apt update
sudo apt dist-upgrade -y
Next, let’s go ahead and also update the Raspberry Pi’s firmware.
We can do that by running the command below on our Raspbian installation.
CODE: SELECT ALL
sudo rpi-update
Now that we have prepared our Raspbian Stretch installation, we can now start the process of moving to Buster.

Friday 22 May 2020

Windows 10: Clean out unused COM ports


Do your COM ports look like this?

Then you've probably just discovered Windows is rubbish at handling USB COM port devices if you plug and unplug them willy-nilly.

How to clean out your COM port cruft:


  1. Run Command prompt with the elevated privileges.
  2. To enable device manager show absent device(s) enter devmgr_show_nonpresent_devices=1 
  3. Restart computer & Run Command prompt with the elevated privileges.
  4. Enter cd c:\Windows\system32 

  5. Enter devmgmt.msc
    (device manager is now running elevated and showing 'nonpresent' devices)
  6. In device manager activate the display of hidden devices from the top menu by clicking View > Show hidden devices.
    (This will list all devices including those that are no longerconnected)
  7. Expand the Ports (Com&LPT) section, all the COM ports that have ever been created will be displayed (the hidden and unused ones being in grey).
  8. Uninstall to your heart's content (right click, select Uninstall).


Tuesday 28 April 2020

Undefined reference to operator delete(void*) C++ AVR pure virtual and __cxa_pure_virtual()

 __cxa_pure_virtual()
&
Undefined reference to operator delete(void*)


C++ Programming for MCUs such as the Atmel AVR family can be both very productive and also very frustrating as one learns to work without libstdc++ when using certain MCU toolchains e.g.
  • C++ AVR Studio 
  • C++ avr-gcc 
  • C++ Arduino 
Whilst it is generally well known that the MCU programmer must provide their own versions of new and delete[1] it is less well known that the C++ programmer using pure virtual member functions must provide an implementation for __cxa_purevirtual() or face some very confusing errors!

Depeding on toolchain the programmer may be lucky and be notified:

undefined reference to `__cxa_pure_virtual'

What is __cxa_purevirtual()?[2]