Lego wishlist

  • 30694 Space Science Mech £4
  • 60390 Park Tracktor £8
  • 60362 Car Wash £13
  • 60385 Construction Digger £13
  • 60450 Wheel Loader £13
  • 60461 Tractor with Trailer £18
  • 60439 Space Science Lab £35
  • 7992 Container Stacker £40
  • 60365 Apartment Building £55
  • 60446 Modular Galactic Spaceship £70
  • 60422 Seaside Harbour with Cargo Ship £95
  • 60434 Space Bace and Rocket Launchpad £125

Duplicate entire in edit are/were caused by the owner changing, although thinking about it, Im not sure I have found the cause since the save method was setting the owner, so it should have been set for the first save?



Thinking about a web terminal again as somewhere to code during work. Quite tempted to write the server side stuff in C since there's not going to be much of it.

The HTTP side will need to parse requests enough to send static files, but that's only the request line.

Need a select/poll loop for sockets, might as well use sendfile for static files.


I'm thinking about email to blog again, although as a follow up to dealing with a food diary. It's a neat idea in theory, I can send emails from work, my phone, or my desktop/laptop, but the amount of work needed to setup a collation system is similar to (or, probably, more than) that needed to stick up a web form with a database, or add tags to the blog.

The problem I'm trying to solve here is that, as part of a diet, I want to track to food I've eaten. I've got the old calorie count spreadsheet, but it's annoying to add new foods to that, and I'm not actually counting calories this time.

I wrote down yesterday's food in a note on my phone, but I'm not as interested in keeping my phone on me at all times as I was previously.

I'm coming round to the idea that using the blog to log foods isn't a bad idea, although I'll need to collect entries every week for the cult.

I should push the update that fixes edits, move to a database backend, and start thinking about tags.



Important caddy configuration tip, make sure you quote values that contain spaces when setting headers, otherwise you get a silent fail.


Tip of the day - you can have HTML button and input widgets outside of a form, so long as you tag the widget with a form attribute with the right id.

(Been waiting a few days to post this, took a little time to get the fix posted).



Nope, posting was fine, but I'd setup the cache wrong. Fixed that now (I think!) so all the dynamic pages are no-store, static pages with a query string (from asp-append-version) get a long (256 days) expiry, and static pages without a query string (which are mostly JavaScript modules loaded through other modules) get a must-revaliate.

I'm not happy about the growing number of headers, it's not doing wonders for the payload:content ratio. On the other hand, at least HTTP/2.0 means that there isn't a fresh connection for each file.


Got up in the middle of last night and did some programming. Fun, except now I'm going be all tired at work.


I think that the thing I miss most from a command line when I'm using a GUI is the command history.

On the command line I can use the up/down arrows to find commands that I've entered before, edit them, and run them again. I can search through the history to see what options I used last time I ran the command, and I could (if I could be bothered) run analysis to find out what commands I use most often.

In the GUI I can't do any of that. Every time I want to do somthing I need to click through a whole pile of menus and dialogs, unless the application authors have included a shortcut for the specific thing I want to do.

I probably could install a mouse/keyboard recording tool, but that still wouldn't have the naked convinience of typing up arrow enter to repeat whatever it was I just did.



What lists does paint need?

Commands, for undo Paths and graphic styles, for paint Paths for object selection

Drawing an object goes from start to commit, although maybe more steps (add point, move anchor).

objects have a selected bool that changes their look (draw anchors)

startObject should render if it's top of the stack, but not otherwise.

Commit could manipulate the undo stack, replacing start with itself, keeping the start command and swapping it back on undo

Other commands can change objects (fill, style). Object stack is different to command stack. Commands create/alter/delete objects, and keep references of the old object and changed properties for undo.

Anchors are not objects, but instead are additions to the paths of selected objects.

Draw runs through object stack oldest first.


Paint todo/ideas

Infinite scroll - there's no reason to limit the drawing area since we're only putting pixels on the screen where the canvas viewport is. Add a global transform to the context with translate and scale (zoom), and a pan tool for click to drag.

Save - stash the action stack and drawing stack somewhere so the canvas restores at page load time

Export - Download current viewport as a png, download everything as svg

Style - Set things like line width, fill/stroke colour. Maybe a properties flyout on the right?

Object select - to edit object properties

If we store paths as svg paths then they'll serialize easier. Doesn't really matter, for rectangle and circle we can store coords and radius and convert them to paths later.

If we're going to do a property editor then we should spec up property types so we can generate the form mechanically. A shape is then defined by a list of property/type pairs, and maybe click handlers to manipulate anchors.


Pants. Serializing the action stack is going to be tricky, since it's a pile of functions (and closures).

One fix is to write a language - based on lox or mal - and have the ui save instructions in those terms.

let r = rectangle(10, 10, 35, 60)
set r lineWidth 2
set r strokeStyle "green"
draw r

// useful for humans, not sure if would ever be generated
set globalStyle {lineWidth: 4, strokeStyle: "brown" }
for (let r = 10; r <= 50; r += 10)
  let c = circle(25, 25, r)
  draw c
done

I don't think we need a full on VM, but a parser to build an ast, and then a visitor to execute - jlox, but in JavaScript and maybe a little stripped down (but also with object literals).

Worth a try, I haven't been through jlox in a while.


(of course, if we don't need humans to be able to read/write it, mal is probably easier to code, maintain, and extend, but I've got a picture in my head of me messing about in a console and that feels easier in lox. Mental note: leave space for pluggable languages)


I'm feeling proper knackered this evening, even after a couple of hours sleep. Did a bunch of thinking today (work and paint), and the diet is starting to kick in.


So yes, lox was/is massive overkill for the paint language. Current design is command per line, with a command word followed by space seperated options. E.g:

draw rectangle 1 10 30 20 40

Currently it knows draw rectangle, draw circle, and erase last (where the erase command is to undo one of the other two). I'm going to need to add at least move, resize, rotate, maybe skew, and set style.

Commands generally take a shape id as a parameter.

We'll need to add more shapes.


Let's make a Drawable a bag of properties - an object - with a type property to inform how to use those properties to e.g. draw a path.

{
  "id": 7,
  "type": "Rectangle",
  "top": 15,
  "left": 10,
  "bottom": 25,
  "right": 20,
  "style": {...}
}

(Somewhere there's a map of names to property types to inform a property editor.)

drawableStack gets renamed to display, push to paint, pop to erase, draw to refresh (and bring the refresh once a frame logic into the type along with getBoundingBox).

Shape specific code (such as drawable to path and drawable to anchors) is held in the shape objects that also implement the tool interface.


Another night staying up late to put off tomorrow. Work has got crap again, I think. Also Trump/America is being stupid again. (And yes, I get that Trump isn't actually stupid in any real sense, but the options he's picking are not great for future humanity)

Paint is going ok, I guess. Need to do colour and fill next, along with adding lines, curves, polygons, and probably resizing.

I've sunk all this time into rectangle and circle, and I'm worried that lines and other shapes are going to be too different for the shared code to help.

I'm too tired for this. See you later blog.


Lego Wishlist for March 2025

Lego.com prices:

  • 60488 Red Sports Car £8.99
  • 60450 Yellow Construction Wheel Loader £12.99
  • 60451 Emergency Ambulance £17.99
  • 71829 Lloyd's Green Forest Dragon £17.99
  • 60461 Red Farm Tractor with Trailer & Sheep £17.99
  • 60453 Lifeguard Beach Rescue Truck £19.99
  • 60439 Space Science Lab £34.99

Alternative (single purchase):

  • 60434 Space Base and Rocket Launchpad £124.99
  • 71822 Source Dragon of Motion £129.99

Oops. Hydra, the OAuth2 backend I'm using, quietly upgraded itself at some point, and that broke login. Fixed now (clearly, or I couldn't post).

Lesson learned: Use a specific version tag on containers (not :latest, or no tag).

Not that expensive a lesson this time at least.



Our savings account is held with Nationwide, a UK building society. I've had an account with them for a long time, and I'm generally happy with their services. However, about a week ago I ran into an issue with their android banking app - when I opened the app I got a security error instead of a login page.

Luckily, it only took a phone call to customer services and a trip into town to reset my online account for me to remember that a few weeks back I went through the big list of CAs that android trusts by default, and turned most of them off. (This probably counts as paranoia, as I imagine that government scale naughty people can get their CA trusted without it being listed.)

The certificate for Nationwide's home page is signed by"SSL Corporation", but enabling them in the list didn't help. A closer look at the certificate suggested adding "Entrust Inc." to the permitted list, and yup, the app is working again.

Thoughts

Nationwide are using different CAs for their webpage and their app. I was lucky the two CAs were related enough that I could find the connection, else I would need to either do some kind of search through the installed CAs (by turning them on and off until I found a match), or give up on Nationwide and pick a new savings provider.

I didn't look very hard, but I couldn't find anything through Google that looked like it would tell me which CA the Nationwide app trusts. I didn't bother asking Nationwide customer support, I don't imagine that question would be fun for anyone.

More broadly, banks (and retail in general) don't seem setup to help customers check the CA being used is the right one.

Since the Nationwide app only works if the system CA is enabled, it's likely that the app doesn't have it's own CA, and so can probably be spoofed with a proxy and a user installed CA (or a naughty system CA).


To remember your current position in the blog, this page must store some data in this browser.

Are you OK with that?