Pinned toot

I decided to replace Observer/Observable in my long-standing project today. My first and favourite design pattern 😞 but I had to blitz those warnings:

Observer becomes java.beans.PropertyChangeListener, and for 'update' you get 'propertyChange (PropertyChangeEvent e)'. Easy.

Observable goes - embed an instance of java.beans.PropertyChangeSupport in your class with 'add/remove PropertyChangeListener' wrapper methods.

To update, call 'firePropertyChange (name, oldValue, newValue)'.

In my battle against bitrot I resurrected a 2011 program I had written to display the galaxy information in the game . I wrote this back in 2011, and I remember playing the game a bit then - memories of Elite on the ZX Spectrum!

peterlane.netlify.com/oolite/

This image shows the user exploring star systems along the Maorin Pass in Sector 2, Colesque:

A application using Tk for a GUI can be made into an executable in CLISP and SBCL:

clisp> (ext:saveinitmem "hello" :executable t :init-function #'run)
sbcl> (save-lisp-and-die "hello" :toplevel #'run :executable t)

CLISP's executable is much smaller (x5, at only 9MB) but is a 'shared library', not an 'executable', like SBCL - double-clicking the file does not work.

So CLISP+Tk needs either a .sh launcher script (esp. in ), or a .desktop file to use the application menu (in ).

Reading text files into Vim. As the files were originally stored on a Mac the line endings are marked ^M and are not recognised as line endings.

Make Vim recognise the Mac line endings by setting the file format for the currently edited file:

:e ++ff=mac

The display will update with correct line endings.

Set line endings for unix:

:set ff=unix

And finally save the file.

I now have all my repositories listed in . So, do I change from ?

Pros for gogs:
- Issues are a convenient 'TODO' list
- Releases are created for tags (but this is only needed for public repos, which are on Notabug)

Cons for gogs:
- I had to edit out the 'social' stuff, to clean up the display
- Fancy avatar, several un-needed features

Cons for cgit:
- ... less easy to make a new repository

Pros for cgit:
- it's all about git
- nice compact index
- quicker rendering of files

🤔

I managed to setup under this afternoon, by following the instructions on the webpage: mindchasers.com/dev/build-cgit

Things worked better than I expected, until I had the server producing the cgit pages.

But there was a problem as the cgit.css file was not found.

I solved this with cgit/etc/cgitrc as:
css=/cgit.css
logo=/cgit.png

by copying those two files from cgit/bin to /var/www/html/

I suspect there's a setup variable I'm missing.

NASA's curiosity rover, sat at Gale Crater, , is measuring the atmosphere and its constituents. Seasonal trends in oxygen and methane are currently unexplained, with levels rising from spring to summer and then falling in autumn.

"... three potential abiotic reservoirs of oxygen in the surface/subsurface of Mars
- oxidant, in the form of perchlorates;
- oxidant in the form of hydrogen peroxide; and
- oxidised rocks or hydrated minerals." Prof Atreya

bbc.co.uk/news/science-environ

On 13th November 1312 the future King Edward 'the Third after the Conquest' was born.

About his father (who was later forced to abdicate and murdered): 'Our King Edward has now reigned six full years and up until now he has achieved nothing praiseworthy or memorable, except that he has made a splendid marriage and has produced a handsome son and heir to the kingdom.' Vita Edwardi Secundi

Edward III was to be crowned as King on 1st February 1327, and reigned until his death - 21st June 1377.

Samples from asteroid Ryugu on their way back to Earth.

The Japanese spacecraft Hayabusa-2 launched in 2014. It made two touch-downs, in February and July this year, each time excavating part of the surface to collect a sample. The second one took samples from below the asteroid's surface.

The spacecraft should return its samples to Earth late in 2020.

bbc.co.uk/news/world-asia-5040

In , use Pkg to manage your dependencies - saved in your project's environment: the Project.toml and Manifest.toml files.

e.g. you have a project in "~/code/MyProject"

julia> cd("~/code/MyProject")

Get 'into' the project's environment:
(v1.2) pkg> activate .
(MyProject) pkg> status
Project MyProject v1.0.0
etc

Here you can add/rm/update packages for MyProject.

NB: test has its own environment:

(MyProject) pkg> activate ./test
(test) pkg> add Test

Return home:
(test) pkg> activate

My first project completed.

It's not a complicated project - a rewrite of a neural net model I did in C as a student. But it has been a good exercise for getting to know Julia.

I like the language. Its syntax and structure combine some of the favourite aspects of other languages I like. But I wish it were more responsive: Ruby's better for short-running scripts, e.g. graphing some data.

On balance, I like Julia enough to try a second, larger project.

peterlane.netlify.com/art/

I think I'll be keeping . I like not having to think about the size of windows.

Java swing programs need some help, to avoid showing as a blank window:

export _JAVA_AWT_WM_NONREPARENTING=1

My first project is almost complete. It's a simple neural net style program, built from arrays. I read the Performance Tips in the documentation, to see what I could improve.

At start: 7m32s runtime

Added types to struct variables, which are mostly array types.

New runtime: 3m13s

Added @inbounds to most lines with array access

New runtime: 2m8s

I'm stopping here.

Next I could look into adding @simd to some loops, but ~3x is enough for now.

docs.julialang.org/en/v1/manua

I have been experimenting with the documentation for packages created using Documenter.

I do not need (or like) the "Edit on ..." link that appears on every page, so here's a script to get rid of it:

# This script removes the "Edit on GitHub" message in Julia documentation

for file in `find . -type f -name "*.html"`
do
sed -i -e"s/<a class=\"edit-page\".*Edit on GitHub<\/a>//g" $file
done

Over the last few days I've been watching the JuliaAcademy courses, which are currently free!

The ML courses introduce the Flux and Knet libraries with some basic examples. I'm currently half-way through the last course, on parallel computing, which is more technical and very interesting.

I don't know when the courses were made, or if it's just because I'm using the REPL and version 1.2, but some function calls etc have changed or been deprecated.

juliaacademy.com/

I decided to experiment with DWM, a tiled window manager, instead of XFCE. I'm running XUbuntu, 18.04.

After installing:
> sudo apt install dwm
I could select DWM at log in.

First customisation: to get date/time in corner, create ~/.xsession

while true; do
xsetroot -name "$(date "+%x %I:%M %p")"
sleep 10
done &

exec dwm

To make the login program run .xsession on start up, I changed /usr/share/xsessions/drm.desktop:

Exec=/etc/X11/Xsession

Last week, I learnt something about remotes with . This week, I will start to think more about my 'commit' messages.

chris.beams.io/posts/git-commi

I'll try to keep the "7-rules" in mind. Especially about adding a 'body' to the message, under a 'title'. Explaining the what and why sounds like a useful thing to do.

Peter boosted

Recently I've been "tidying up" and finding new homes for code - trying to keep older software from falling to 'bitrot'.

And today I came across this "Ten Years Reproducibility Challenge" by the ReScience journal:

rescience.github.io/ten-years

Interesting.

I have some code in #lisp from ~2000-10, and lisp is pretty stable - but there might be some minor issues with the version of Lisp. It would be nice to have those case studies working and available.

There's a project in #java, but too young.

I've completed the first 'draft' of my trial project in .

So far, procedural programming has been fairly straightforward, and I've been fighting my algorithms more than the language.

Arrays: there are some nice convenience functions for constructing arrays, like 'zeros', 'fill'.

Multi-dimensional arrays use [i,j] notation, and I need to look again at the difference between "multi-dimensional" and "array of arrays".

Next, I will try out the support for tests and documentation.

Show more