Wednesday, 6 March 2024

Betime + svelte part 1





The bitsies here, inside all the computer's caretaking, being typed in.

The stuff in the middle, in the container of what matters.

How shall we scuttle them?

Like this?


I review my notes from when I built this before the summer break:

  Record $C is the Record** until now

   and $B is:

    items

     a copy of bloube/*

    times

     a copy of kommit/*

I make variables amongst prose explicit by prefixing with $

* could be any amount of anything

    usually something

    in this case a stack of time we are inside.

The kommit/ is like a table, the * inside it, or linked from it. It's a path going in.

The times/* are to be chewed on (rendered down) and copied back to kommit/*, the latter being what goes into the picture we take over time.

Some of the things in kommit/* may be very old. Imagine a beach.

Ordering the sounds...

# a mode, complements I.Pi
function Inspherical({Con,s}) {
...
# make coming and going smooth
Con.sc.animal = 1
}

The insphere contains what matters, the data that gets saved|done|housed.

We add an animal quality, to transition in and out of being.

We must unpack that somewhere in the Con**

Animation

An element that uses the animate directive must be the immediate child of a keyed each block

No doing animation by wrapping things in a Moves.svelte,

No deciding to have a transition or not, eg:

{#if C.sc.animal}
<span transition ... >
{:else}
<span ... >
{/if}

The language we write here has html and templating in one - not templating and then html!

No strange if placement, eg:

{#each o_(C) as n (n.t)}
<span {#if C.sc.animal}transition:slide={{ duration: 90, easing: quintOut }}{/if}
style="display:inline-block; vertical-align: middle; border:2px solid gainsboro; border-right:none; padding: 0 3px; margin: 0 3px; border-radius: 3px;">
<svelte:component on:reCon="{reCon}" this={pis[n.c.pi]} C={n}/>
</span>
{/each}

It's tempting to think it might know what all this is.

However, needing a keyed each block seems to indicate that Svelte avoids individuating the many (components|things within) on update.

    They simply fall out of some non-formula as a complete set, not replacing their previous selves, piece-wise.

So we give it a keyed each.

n.t could (one day) instead be Cip. 

Cip is Aip for space we resolve $n (see 'resolve $n'). 

Each Cip is owned by an individual item 

as best we can resolve it (amongst its peers in the set)

across reformulations of the space (usually to adjust details periphery to this individual)

This all spurs me to ask AI how can I list the components within a component in svelte?

(then descend on the town with a violin)

to come back and read Svelte doesn't provide... 

You're meant to have the component to begin with, then

 

Anyway, in the universal atom src/lib/pi/Con.svelte I go with:

... let duration = 0
if (C.sc.animal) {
duration = 90
}
</script>
...
{#each o_(C) as n (n.t)}
<span transition:slide={{ duration, easing: quintOut }}
        ...

This simply shortens the duration if not animal.

Which should be default?

Who knows.

It then dances with this loop in src/routes/t/TestBetimes.svelte,

let tocken = async (spam) => {
await tock(spam)
if (!asapily) await new Promise(resolve => setTimeout(resolve, 72));
await tick()
}

More on spam later. It is liable to be maimed passing through the system. Someone may have put ads in it.

    Ie it can change and you might change it.


Looks a bit bouncy. Hmm.
This reminds me of the time
I had to label some columns
When html couldn't rotate text
And then we wake up in the now
When html couldn't move well

Anyway

Without wandering back to cytoscape with screenshots of html for nodes, interactively and ongoingly...

Let's do a sort of carpentry across "the pretty blocks" making up our composition

In Con.svelte:

afterUpdate(() => {
...
let geo = wrapper.getBoundingClientRect().toJSON()
let ge = sex({},geo,'width,height,top,left')
...

You might find sex() gets nothing from geo because !geo.hasOwnProperty('width')., so says 

It (a DOMRect object) wants us to call .toJSON() to get a plain hash, that then works with Y/Pic

The browser should be invisible.

Anyway, lets see what these values do:

{#if geometricating}
<Chart {spam} />
{/if}


Our height (blue) increases a bit.
Our top (red) changes as we scroll.

Here are some more things from geo

It's terribly slow, these are supposed to be 11hz or so:

Reducing load, mix-blend-mode: screen;


We obviously want to join the nodes in one graph, having several distinct lines...

focus on positioning

Here's the html.

<nodule style="display: table; position: sticky;">
<div id="spacer" style="width: 107.9px;height: 162px;"></div>
<div id="wrapper" style="left: 1px; top: 1px; position: absolute;">
...

The left|top position: absolute is going to be from the nodule with position: sticky

If I gave nodule a top: 0px, you get an idea of what sticky is supposed to do:


It can also just be position: relative - anything but the default (initial): position: static

an element with position: absolute; will look upwards in the DOM tree until it finds an ancestor that has a position value other than the default static to determine its reference point for positioning

This #spacer is set to the size of the #wrapper,

let animalsizing = async (uniquely,ttl,was) => {
        ...
if (C.t != 'treeh 16') return
        ...
was ||= ex({},sizing)
ex(sizing,getnumbers(wrapper,'width,height'))
if (was && heq(was,sizing)) return
sizing = sizing
        ...
animalsizing runs as part of afterUpdate for all Con.svelte
We focus|limit this new feature to two of them (kommit|times/treeh 16)

We remember what sizing was
#wrapper's width+height -> sizing
If sizing changes, cause an update: sizing = sizing

We were also going to try and set left|top, but with that  we can now set them to:
ex(sizing,{top:1,left:1}) 

shrinkage

but then! the width of #wrapper shrinks to that of #spacer, for some reason...

with css adjusted via devtools

It's not clear why #wrapper is deciding to break onto many lines because of (its sibling) #spacer's width...

Though it must be that left|top of 1px whittling it down:

ex(sizing,{top:0,left:0})

It is now undetectable!

Except treeh 16 is breaking like so:

Unless we forget to add a little exaggeration to the width!?: 

ex(sizing,getnumbers(wrapper,'width,height'))
sizing.width += 3


That must be squeezed by a border width somewhere?

Then there's the slight growth in width over time.

I blame non-monospaced numbers?


Then we can highlight those that do animalsizing:
let backgroundism
$: backgroundism = spatialising ? "#ffc2" : "none"


Then just to refresh us all what happens to width (blue) over time:


If I zoom out a bit:


the jiggles

The Con:kommit shows some good input data:

Then somewhere after 90a2c4523d012c,

We 
let spacerHeight = tweened(0, {
duration: 300,
easing: quintOut
});

Hilarity:


I fix that:
And that:

        // was may be passed from a longer-ago moment of animalsizing
was ||= ex({},sizing)
let ge = {
width: wrapper.offsetWidth,
height: wrapper.offsetHeight
}
// animated transition
spacerWidth.set(ge.width + 3)
spacerHeight.set(ge.height)
// sizing stabilises
ex(sizing,ge)
if (was && heq(was,sizing)) return

Try this:


The wrapper collapses.

We could table the wrapper:
<div id="wrapper" bind:this={wrapper}
style="...
display:table-row;
wdith:100%;
">
and each thing (Con/$pi):
{#each o_(C) as n (n.t)}
<span
transition:slide={{ duration, easing: quintOut }}
style="...
display:table-cell;
wdith:100%;
">
So:

The Cont (the labels, eg 'C treeh 27') are breaking...
The columns don't line up! So up in Conz:
{#each nodules as n (n.t)}
<nodule style="display:table; position: relative;" >

I adjust our selection of Con to do animalsizing for:
// if (!(goodnumbers.includes(number) || C.t == 'times' || C.c.d == 1)) return
// if (C.c.d == 0) return
if (C.c.d > 2) return

Add this wrapper in case C.c.d == 0 and it has n <nodules> above it
<nondual style="position: relative;" >

Then I sprinkle some of these about:
wdith:100%;


This is odd. I did not expect the wrapper not to wrap everything inside it...

Anyway, lets sprinkle some more:

{#if nodules.length}
<nodules style="
display:block;
vertical-align: middle;
border:5px solid #f8c;
border-right:none;
padding: 0 3px; margin: 0 3px;
border-radius: 3px;
width:100%;
">
<!-- the (n.t) means indexed by that, should be a Cid - they are reused for identity -->
{#each nodules as n (n.t)}
<nodule style="
display:table;
position: relative;
width:100%;
" >

Note the Cid - this is a humanised Cip. Instead of numbers exclusively, use noise from the object itself, as usual in naming.



This extra width prevents Cont (the labels, eg 'C treeh 27') breaking into lines!

widening

Obviously I need to research the forces going on here:
<nondual style="position: relative; width:97%; display:inline-block;" >
<!-- -->
<div id="spacer" bind:this={spacer} style="width: {$spacerWidth||0}px; height: {$spacerHeight||0}px;"></div>
<div
id="wrapper"
bind:this={wrapper}

style="
left: {sizing.left||0}px;
top: {sizing.top||0}px;
position:{spaciness};
display:table-row;
width:100%;

">

The width:97%; trick worked in isolation,


 but causes everything to deflate and widen like an ooze.

I try:
<nondual style="position: relative; width:100%; display:table;" >


Looks messier.
Then!
Some more something.

Might we decide that <giverto>...<takerto> is too wasteful and switch to many rows in that case?

I teeter around with setting width:100% on here:


<nodules style="
display:inline-table;

from being block, causes this:

and with 

<nodules style="
display:inline-block;


So it seems okay where it is...
We are now letz.git 3fd7e61289c6d29d3 table is widening
Let us now slower the loop than the transition:

Maybe just a little bit more:

They look more like fades?

Adding in a general update-hilighter:

// flash a background colour
let givenbg = tweened(0,{duration:300,easing:linear})
function itisgiven() {
givenbg.set(1, { hard: true });
// .then(() => {
givenbg.set(0);
// });
}

To be called at the end of animalsizing().
It starts going towards 0 as soon as 1 is set.
Doing .then(... makes it stay 1 for a duration I think...
This looks nice:

Like green fire.
Lovely but endless: our tween is reactivity? And reactivity causes our tween?

Lets only animalsizing() (and tween) if we have new geometry:
let change = !heq(was,sizing)
...
change && await animalsizing(ge)

And make it happen to a floating mark called sleeve.
There is one on every -Con/-$pi (-Cont, -Rec, -Conz):

<giverto ... >
<sleeve style="width:cal(100% + 6px);height:100%;position:absolute;
border-left:1em solid hsla(120, 100%, 75%, {$givenbg});
border-radius: 0.3em;
top:-3px;
left:-3px;
"></sleeve>


buffering

// desired shape of spacer, given recent turmoil
let de = good_size(ge)


This looks calmer.

Bits of html overlap as they change size slowly.

We are missing the final adjustment once things stop changing, which I simulate by clicking on things.












Wednesday, 28 February 2024

Dirty Old Zealand

They say I was surprised to stumble upon the information that in 2022 Aotearoa/NZ imported 3.7 million tonnes of animal feed. Dairy consumed 75% of it and poultry 12%. The worst news is that just under 2 million tonnes of that was from the palm oil industry.

Can we really claim to have a sustainable beef and dairy industry when it relies so heavily on imported feed, much of it from sources known to be unsustainable? #sustainability #globalheating #climate



Tuesday, 27 February 2024

SPACE

 Lovely pics coming from the James Webb Space Telescope (JWST)! Here's a preview:

Have a look, each with informative plaques : https://transfem.social/notes/9q3vm1v0x6lh02q1#pswp


That bunch of tarp it's sitting on is sunshield, the telescope needs to operate at extremely cold temperatures (around -220°C) to observe the faint infrared light coming from distant objects in the universe. Yay!

Friday, 23 February 2024

the animal industry

damning criticism
(lifted from reddit)

If you are not vegan, you support extreme agony and violence against other animals without any justification or necessity, and you support the greatest form of climate destruction by far.

And that's no exaggeration. If we implement veganism, we are able to reclaim about 75 % of the land that is currently used to grow animal feed etc. Globally, that corresponds to an area the size of North America and Brazil combined. That itself reduces emissions enormously, but we then can also rewild those vast areas of land. If we restore wild ecosystems on just 15 % of that land, we save about 60 % of the species expected to go extinct. We then also are able to sequester about 300 petagrams of carbon dioxide. That is nearly a third of the total atmospheric carbon increase since the industrial revolution. Now let's say we were not so conservative, and we brought that up to returning 30 % of the agricultural land to the wild. That would mean that more than 70 % of presently expected extinctions could be avoided, and half of the carbon released since the industrial revolution could be absorbed.

So basically by implementing a switch to veganism, we would not just halt but reverse our contributions to global warming. That and it would also be a step towards ending our violence against non-human animals.

References:

https://www.nature.com/articles/s41586-020-2784-9

https://allianceforscience.cornell.edu/blog/2020/10/rewilding-farmland-can-protect-biodiversity-and-sequester-carbon-new-study-finds

https://ourworldindata.org/land-use-diets



the fix
A physical internet (via drive cables, a packet switched gondola network) where you can easily get most of a meal delivered to your kitchen.
I believe it's mostly the complexity of really good vegan cooking that holds people back.
This can be seen in the way the bag-of-chips product often has milk solids added to fatten it up.
The veges can be tastier, but that requires either:
  • Growing such healthy specimens the eater is in awe, wants nothing else
  • Adding other veges - just the right ones, prepared just so...
Which is where "most of a meal delivered" comes in.
Provide the hard stuff like caramelising onions, freshly seared chilli, rendering down and steeping (for a day?) a tomato sauce...
Such a system would have surplus, so it might push food on people in that case.
Quite new world.





javascript variable names may contain hidden characters

 javascript allows[0] this invisible character in variable names... can you see it in your editor?

    let goodbye = 1
    let good‍bye = 2

The Good

In vscode,

In vim,

The Bad

In letz,


In github, which is surprising since a lot of code review gets done via their web interface?


They can be fed to xxd or vim to show you the character again.

Or you can search for ZWJs locally (but not on github?)

s@sa:~/src/letz$ grep -rnP '\x{200D}' src | sed -n 'l'
src/routes/Code.svelte:21:    let good\342\200\215bye = 2$

Really?

Vite|typescript will not have it:

But devtools will:

Oh Well

Could be exploited huh? 

[0] https://262.ecma-international.org/14.0/#sec-names-and-keywords

Monday, 12 February 2024

Land of Look Behind


a Rasta movie. very good.

About Rasta, with some universal things to witness for all humans.

eg early on the will to progress and conquer clean water and such is laid bare.

2eaa877165bb34b1bb3090bab34b59d02a232a09