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, 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]

Friday, 13 December 2019

The Joy Programming Language #1

Functional Programming in Joy #1
Just because something is obscure does not make it unworthy of study.


What is Joy?

Joy is a pure, concatenative, functional, scalar programming language.
Joy is pure because it does not contain assignment.
Joy is functional because computation consists of the evaluation of expressions.
Joy is concatenative (and not applicative) because
  • The elementary well-formed expressions of Joy are monadic functions of a nameless data stack.
  • If X and Y are well-formed expressions, then the concatenation of X and Y is well-formed.
  • If Z is the concatenation of X and Y, then the value of Z is the composition of the values of X and Y.
Sadly, the official website is no longer hosted by La Trobe University however there is a reasonably complete mirror hosted by Kevin Albrecht and the Wikipedia page is helpful.

Hello World in Joy?

"Hello, world!\n" putchars .

Quicksort in Joy?

DEFINE qsort ==
  [small]            # termination condition: 0 or 1 element
  []                 # do nothing
  [uncons [>] split] # pivot and two lists
  [enconcat]         # insert the pivot after the recursion
  binrec.            # recursion on the two lists (full-stop ends the define)

Who invented Joy?

Manfred von Thun was the inventor of the Joy programming language.

According to the LaTrobe University Alumni news:

"Alumni and staff will be saddened to hear of the death of Manfred von Thun on 23 October after a long illness. Manfred was a member of the philosophy department from early 1972 until his retirement in 2003, but remained an honorary associate until 2009. Manfred specialized in logic, philosophy of science, philosophy of mind, computer programming and cybernetics. He was also renowned for developing the computer programming language, Joy. He will be sadly missed."


Joy’s inventor, Manfred von Thun