Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
MrMoo
Sep 14, 2000

jsonpath is a thing too

Adbot
ADBOT LOVES YOU

MrMoo
Sep 14, 2000

early paper from Amazon, interesting read:

https://www.allthingsdistributed.com/2022/11/amazon-1998-distributed-computing-manifesto.html

MrMoo
Sep 14, 2000

Xarn posted:

People who like C, wtf is wrong with you?

It is simple and not much can go wrong. Anything else and there are always language bugs and severe limitations. All the classics: string handling & UTF-8, memory management, networking, threading, and multi-processing.

MrMoo
Sep 14, 2000

The language itself has minimal scope for errors, obviously anything a developer creates above is going to be super 💩

C++ almost guarantees developers making super 💩 above.

MrMoo
Sep 14, 2000

According to Luke from Floatplane, OpenAI just releases their GPT3 beta, and it’s impressive. Ask anything in text form, being aware the training set is 2 years old.



Writing stories about anything, writing short programs, finding and fixing security bugs, recipes, mending things, etc.

https://chat.openai.com/

Sign up and go back to this chat URL for thread mode, in this mode you can ask more questions and refine the answers until you “reset thread” via the menu.

Also, it has content filters but they are apparently easy to bypass.



If you find something it doesn’t know you can train it in a thread and it can then answer.

quote:

Write a program to render “420” with THREE.js

quote:

Have the scene slowly rotate on the z-axis

Also, it apparently does rather well at Advent of Code.

MrMoo fucked around with this message at 14:21 on Dec 4, 2022

MrMoo
Sep 14, 2000

I think IBM has some software for that.

MrMoo
Sep 14, 2000

is this the new webdev thing, to just gas light now:

https://www.conventionalcommits.org/en/v1.0.0/

MrMoo
Sep 14, 2000

https://www.businessinsider.com/self-driving-car-developer-george-hotz-resigns-from-twitter-internship-2022-12

:lol:

MrMoo
Sep 14, 2000

redleader posted:

nothing as gaslighting as wanting a standard format for commits in a project

It's the "conventional commits" presumptuous naming, much like "standard js". If they chose some more suitably dull it may be ok.

MrMoo
Sep 14, 2000

JavaScript tooling is absolutely a poo poo stain on webdev, which is saying something for webdev.

I had to manually import a library and fix up the code to get Jest (a Facebook authored test framework) to run. I just 🤷🏻‍♀️. TSC works fine, but TS-Jest (because apparently we need flavours of Jest) flips its nut with a gigantic error page of no value.

idk why Jest thinks I would care about using Babel? (another TypeScript compiler)

It’s the weird keeping onto some legacy trait whilst abandoning everything else.

To rub it in, the library is written in TypeScript itself, :lol:

I cannot believe such a fast moving industry still hasn't dropped ES5 and all the turd that is AMD, CommonJS, and UMD, various random methods of importing libraries. The errors I see are about ES6M syntax (modules) being unsupported, either in flavours of the "import" command, but also at times, the "export" command. NodeJS is still only "experimental mode" support for ES6 modules, and that's not even attempting to look at testing in a browser with the plethora of additional components to get there.

I expect problems with Node versus Browser environment, and there's plenty of weird issues there, from the tooling support of globals, to the random inconsistencies that NodeJS loves to present with almost all new HTML5 APIs.

MrMoo fucked around with this message at 20:05 on Dec 31, 2022

MrMoo
Sep 14, 2000

if they’re old they should be using non-GNU make, then almost nothing useful is implemented.

MrMoo
Sep 14, 2000

you know this happens a lot, abusing free tier services:

https://bootcamp.uxdesign.cc/how-a-single-developer-dropped-aws-costs-by-90-then-disappeared-2b46a115103a

MrMoo
Sep 14, 2000

Just noted TypeScript and VS Code still has no support for Web Workers? That's somewhat impressive.

Probably more poo poo on the ES6M pile, as Workers have no support for import maps at all and that's still quite 💩

Slap the VS Jest team for their work too. If I force "color" output, at least I can scroll in the terminal the output, but it's not really parsed to any useful effect. "less -R" doesn't work at all in a terminal, so some improvement at least. If I disable forcing the colour output then the VS Code extension just gobbles up all the output and hides it unless you run in debug mode. So many questions.

It would be nice if VS Jest only ran the tests for code that changes, maybe it's trying to do that 🤷‍♂️

I hate webdev tooling.

and webdev.

MrMoo
Sep 14, 2000

abraham linksys posted:

the current vs code jest "team" appears to be some person on github who doesn't even have an employer listed on their profile who is not being paid for their work but sure go off king

White knighting Facebook project spinoffs? Of all the companies to choose from.

All the significant work should be in the core Jest project, passing JSON objects back and forth, and just being a thin visual wrapper is all that is asked.

MrMoo
Sep 14, 2000

That’s a somewhat elitist and toxic attitude to take. I may indeed do a patch, whatever, this is day one obvious issues with the software.

MrMoo
Sep 14, 2000

Just reviewing some basic code calculating the astronomical season. It's very weird as it normalizes the year to 2000 for some reason, so clearly a Stackoverflow copy pasta, but no attribution. Paste a line into Google and find the original. It's the answer with 0 points and many bugs. Amazing.

https://stackoverflow.com/a/68500498

JavaScript code:
const seasons = [{
    name: 'Spring',
    start: new Date(2000, 2, 21),
    end: new Date(2000, 5, 20)
},{
    name: 'Summer',
    start: new Date(2000, 5, 21),
    end: new Date(2000, 8, 20)
},{
    name: 'Autumn/Fall',
    start: new Date(2000, 8, 21),
    end: new Date(2000, 11, 20)
},{
    name: 'Winter',
    start: new Date(2000, 11, 21),
    end: new Date(2001, 2, 20)
}];
...
The other answers on Stackoverflow are equally hosed up though, just amazing.

MrMoo fucked around with this message at 22:58 on Jan 23, 2023

MrMoo
Sep 14, 2000

it’s pretty simple from another answer, using Luxon DateTime:
JavaScript code:
 // https://stackoverflow.com/a/57444006
function getAstronomicalSeason(now) {
	const SPRING_START = now.set({ month: 2, day: now.isInLeapYear ? 19 : 20 });
	const SUMMER_START = now.set({ month: 5, day: now.isInLeapYear ? 20 : 21 });
	const AUTUMN_START = now.set({ month: 8, day: now.isInLeapYear ? 22 : 23 });
	const WINTER_START = now.set({ month: 11, day: now.isInLeapYear ? 20 : 21 });
	if(now >= SPRING_START && now < SUMMER_START) {
		return 'spring';
	} else if(now >= SUMMER_START && now < AUTUMN_START) {
		return 'summer';
	} else if(now >= AUTUMN_START && now < WINTER_START) {
		return 'autumn';
	} else {
		return 'winter';
	}
}

MrMoo
Sep 14, 2000

Its a Rolex posted:

is it normal to not document an API and instead tell someone to use the inspect element tool to deduce what the JSON you POST is?

Well I've had a "professional" of multiple decades say they have never written a JSON schema in their entire career, and they write APIs every day for new customers. Not specifically the "JSON schema", as in any reasonably complete detail of JSON contents that an API produces.

MrMoo
Sep 14, 2000

Tencent spent a lot of effort making a platform for Mysql:

https://main.qcloudimg.com/raw/document/intl/product/pdf/tencent-cloud_236_5146_en.pdf

They also have their own “performance” fork:

https://www.tencentcloud.com/products/dcdb

So you were using the latter as it’s targeted for doing everything (tm)

MrMoo fucked around with this message at 11:53 on Jan 27, 2023

MrMoo
Sep 14, 2000

I hate reading technical white papers but I also do not enjoy reading other peoples code.

My ask was for a Raft algorithm to elect a leader in a cluster, and all I can do is lose brain cells. I guess the Raft Consensus paper could be worse, but its nice to have a general structure for starting from without having to reinvent the wheel, etc.

I bookmarked several of the implementations listed, in C++20, Rust, JavaScript, and TypeScript. They all appear to follow the adage of novices making things more complicated than it needs to be. From a core logic of barely 100 lines, these projects run into 1,000s across many modules. The target for some appears to be flexibility in integration, but perversely they end up with the opposite as they hard code to particular external entities.

The most impressive so far has been https://github.com/unshiftio/liferaft, off to a great start:

quote:

liferaft is an JavaScript implementation of the Raft consensus algorithm.

So one creates an instance of a Raft class to contain all the magic, then call the join() API to add nodes in the Raft cluster. All good so far. However, instead of having a simple array of nodes by name, it creates a new instance of the class and sets a few properties. It's a really weird pattern.

https://github.com/unshiftio/liferaft/blob/master/index.js#L772

JavaScript code:
  join(address, write) {
    var raft = this;
...
    var node = raft.clone({
      write: write,       // Optional function that receives our writes.
      address: address,   // A custom address for the raft we added.
      state: Raft.CHILD   // We are a raft in the cluster.
    });

    raft.nodes.push(node);
  }
I have to give credit for not being a gigantic code base,

Honorable mentions to https://github.com/matthewaveryusa/raft.ts/blob/master/src/state.ts
JavaScript code:
    const arr: [
      string,
      string,
      string,
      string[],
      string[],
      string
    ] = JSON.parse(str);
For C++ implementations, https://github.com/datatechnology/cornerstone/blob/master/src/raft_server.cxx#L842 wins some gold stars by having over 10 instances of exit() in one module, and not for OOM.
C code:
        l_->err(
            lstrfmt(
                "..., must be something wrong, exit.")
                .fmt(sz_rd, data->size()));
        ctx_->state_mgr_->system_exit(-1);
        ::exit(-1);
Do developers not like allowing modules to be restarted on error at runtime anymore?

MrMoo
Sep 14, 2000

I implemented broadcast over a WebRTC mesh network using Raft protocol for leader election and WebSockets for SDP (SSL credentials for peer connections) relay.

The goal is to have a network of digital signage TVs run synchronised content pulling from a third party, whilst being resilient to both upstream and individual TV outages.

Network outages are quite common, along with terrible performance, and TVs can randomly overheat, and quite frequently just crash out and need daily restarting.

The elected leader is the one to pull from the third party API and broadcast out to everyone else. This seems the least stupid approach.

WebRTC allows multiple data channels over a single peer connection, due to its SCTP foundation. Thus the Raft protocol can communicate over one channel, the broadcast over another, etc.



Ultimately the solution would be better with a local HTTP server on each TV to enable local bootstrapping of the swarm, i.e. retrieve SDP of one TV, then build up a full mesh via peer forwarding.

Also, outside of Safari, the RTCDataChannel is stuck in the renderer thread, which isn't really great. It would be sensible to move it to a Web Worker.

MrMoo fucked around with this message at 23:59 on Feb 12, 2023

MrMoo
Sep 14, 2000

tef posted:

If it wasn't a third party api, i'd be tempted to suggest "mesh nodes all connect to websocket upstream, but the first one to connect wins and the server just tells the others to connect elsewhere"

Still, using raft seems kinda weird? Raft can do quorum writes because the membership of the network is known in advance. With a setup like this, you won't know how many mesh nodes are kicking around to begin with. That and doing leadership election over a raft log seems to be a bit weird when you can just do the leadership election that raft's doing to begin with, and even then, you don't need to ensure "i only vote for someone who has more of the replicated log" which is a huge chunk of raft's complexity

I'm using the leadership steps of the Raft protocol (requestVote RPC, and vote reply), without the log, which probably clears up the confusion. As it's digital signage, one knows explicitly the number of TVs in a group, and their IDs. The Raft "append" heartbeats by the leader ensure consistent leadership. As it it web protocols, all the timeouts have to be relaxed, certainly not running at 50ms.

Without the log replication, Raft becomes a really simple protocol.

MrMoo fucked around with this message at 17:25 on Feb 13, 2023

MrMoo
Sep 14, 2000

MononcQc posted:

leader election even in raft is trickier than it looks like and for years the protocol had a bug where in case of asymmetric netsplits where a caller asks for the leader but the leader’s response can’t make it back (while being visible to other cluster members) would end up having that one semi-isolated node constantly call for new elections and could paralyze the whole cluster.

the paper needed to be amended and the irl implementations patched up.

I've been checking the etcd raft and Hashicorp raft history and it appears preVote has been dropped but checkQuorum kept? etc used to have both. What is odd is that etcd has a "preVote" parameter, presumably for historical compatibility, but not plumbed to any function.

The Hashicorp tracker has a request to add preVote, but sitting idle.

Reading Go source code is not fun, especially when the developers insist on making all the variables and function names shorter and shorter.
Go code:
	bwal := &bootstrappedWAL{
		lg:       cfg.Logger,
		w:        wal,
		st:       st,
		ents:     ents,
		snapshot: snap,
		meta:     meta,
		haveWAL:  true,
	}
Even abbreviating "WAL", :lol:

MrMoo
Sep 14, 2000

I just had to mock a ES6 module Web Worker in TypeScript, and just :lol:
JavaScript code:
import * as Comlink from 'comlink';
import { jest, describe, expect, test } from '@jest/globals';
jest.unstable_mockModule('comlink', () => {
        console.info('Comlink');
        const transferHandlers = new Map<string, Comlink.TransferHandler<unknown, unknown>>;
        return {
                wrap: jest.fn().mockImplementation(() => {
                        console.info('Comlink.wrap');
                        return {
                                parseSchedule: (json: any) => {
                                        console.info(`parseSchedule(${json})`);
                                },
                                getEvents: (startTime: DateTime, endTime: DateTime) => {
                                        console.info(`getEvents(${startTime.toISO()}, ${endTime.toISO()})`);
                                        return [] as CalendarEvent<any>[];
                                },
                        } as CalendarWorker;
                }),
                transferHandlers,
        };
});
const { ScheduleItem, ScheduleItemView, BasicScheduler } = await import('../lib/basic-scheduler');
I guess it could be worse :shrug:

MrMoo
Sep 14, 2000

Those are just there after way too long trying different combinations to get the thing to be called. I love having to crawl the bug trackers to find any useful information about doing anything, with all the main documentation being out of date.

It is ironic webdevs chasing the latest fad are still struggling to implement ECMAScript 6 , 2015 everyone, that is 8 years ago.

I put a lot of this on Microsoft, launching TypeScript but no testing apparatus? The entire goal of TypeScript is safer programming, but firing the QA department wasn't enough I guess?

MrMoo
Sep 14, 2000

Postgres has a daemon to incrementally update materialized views, it’s shipping with v15;

https://pganalyze.com/blog/5mins-postgres-15-beta1-incremental-materialized-views-pg-ivm

MrMoo fucked around with this message at 12:00 on Feb 17, 2023

MrMoo
Sep 14, 2000

ah, as an extension since PG 13 though:

https://www.postgresql.org/about/news/pg_ivm-15-released-2583/

MrMoo
Sep 14, 2000

smackfu posted:

“Maybe the materialized view is current” doesn’t seem like a good thing?

You can always just call it "stale view" instead of "materialized view", what are the origins of the unusual naming anyway?

MrMoo
Sep 14, 2000

If the ID should be non-predictable, use bijection. Public presentation should almost always be UUIDs, for convenience the first 7 characters can be used for lookup, like a Git commit.

Silly optimization is to present the UUID in base 85 or whatever.

MrMoo
Sep 14, 2000

Doom Mathematic posted:

Use Base65536. Instead of "0b9a39c2-eb59-4e31-91f7-c2e565d50d00", simply write "𢀋𤠹-軫-晎-𧶑-𦯂𥭥㐍".

oh my,

quote:

Base2048 is a binary encoding optimised for transmitting data through Twitter. This JavaScript module, base2048, is the first implementation of this encoding. Using Base2048, up to 385 octets can fit in a single Tweet. Compare with Base65536, which manages only 280 octets.

https://github.com/qntm/base2048

and, base131072

quote:

We need 131,586 "safe" characters for this encoding, but as of Unicode 9.0 only 108,397 exist. However, future versions of Unicode may add enough safe characters for this to become possible.

https://github.com/qntm/base131072

Meanwhile, YouTube manages to cope with half-UUIDs with 11 character base64 encodes as the video ID. Of course stack exchange has a gigantic essay on the topic:

https://webapps.stackexchange.com/a/101153/279163

MrMoo fucked around with this message at 21:10 on Feb 24, 2023

MrMoo
Sep 14, 2000

Zlodo posted:

Things like different cores running at different frequencies giving out different results with no way to correct for it and such.

We have core clock independent TSC now, HPET was always a joke.

Funniest is still Win32 API that doesn't have a monotonic clock API. The Boost project just slapped their Chrono compatibility implementation around a non-monotonic API and didn't bother to document it. Check the MS C++ implementation of Chrono, and guess what, they hook into an undocumented API. :nice:

MrMoo
Sep 14, 2000

I've seen waves of various random bug reports. From basic GCC bumps in RHEL, to "reproducible builds", and various assembler best practice. It's unusual, but good input.

I have a package in RHEL, Ubuntu, and flavours, on life support for 10+ years :lol:

MrMoo
Sep 14, 2000

tef posted:

stripped out protobufs from python code and made them go faster and smaller with gzipped json (very string heavy data)

Outside of C/C++ this is almost always going to be the case. Every serialization performance test, no matter how flawed, will show JSON performing faster than others. The gotcha is the size of the message and the transit costs that means, so say using a reverse proxy to transparent `gzip` and if the client is a browser, you get "free" decompression.

MrMoo
Sep 14, 2000

It should not be read literally, what happens in higher level languages is that you end up with a dual level of serialization, between internal format to JSON, then to text. Thus in JavaScript land, objects are already JS objects thus that eliminates an entire stage of the pipeline in comparison. "Products" like MsgPack try to benefit from the lower memory usage in encoded form.

Ultimately with encoded messages there is a massive performance and convenience trade off. Random access to a field is an incredibly expensive operation and usually means (1) conversion to a map, or (2) reparsing on each access. The highest performance is given by single pass through a structure. However this only means something if your language has direct access to unpacked fields, any slow interpreted language is likely to require a map to simply access any variable, ideally JITs eliminating this.

MrMoo
Sep 14, 2000

Do I get extra points for working on the JFK AirTrain map system and also getting lost when trying to use it. :lol:

JFK signage is terrible, avoid public transport for T1 for a bit.

MrMoo
Sep 14, 2000

quote:

Elon Musk and Apple cofounder Steve Wozniak among over 1,100 who sign open letter calling for 6-month ban on creating powerful A.I.

https://fortune.com/2023/03/29/elon-musk-apple-steve-wozniak-over-1100-sign-open-letter-6-month-ban-creating-powerful-ai/

That reads like bad losers to the AI race and simple jealousy to OpenAI. What could remotely be achieved in 6 months of babble. If anything it is overly pro-communist as it definitely gives China more time to bribe and steal the technology.

MrMoo
Sep 14, 2000

champagne posting posted:

i don't get this joke

I think it’s in reference to the NPM package author(s) that overwrote old versions to break them. This happened with uWebSockets,

MrMoo
Sep 14, 2000

Just a Moron posted:

literal spaghetti code.

I’m sure someone has done this already, pics please.

MrMoo
Sep 14, 2000

Share Bear posted:

maybe more of a confessions thing but i honestly dont know why oop took over as the dominant programming paradigm,

i find it very confusing generally versus procedural or functional code

i also have written java professionally

It's clear, because in large developer groups it creates a demarcation between each developers work. As whomever said, a project of x people makes for x modules.

What is ironic is that JavaScript programming with ECMAScript modules allows people to write procedural code in a module but without OOP, and webdev land loves that.

Adbot
ADBOT LOVES YOU

MrMoo
Sep 14, 2000

sb hermit posted:

do people use glib for their own random linux event based daemons?

There are not many comprehensive options, only a pick-and-mix for specific functionality, e.g. libuv.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply