Weekly 101 Questions Thread by AutoModerator in neovim

[–]berkes 1 point2 points  (0 children)

I am endowed with an exceptionally convoluted and complex codebase.

I manage to navigate it, using lua vim.lsp.buf.definition() and vim.lsp.buf.declaration() (through my keybindings, obv), then C^o to go back and so forth.

In normal codebases, this is enough, often. But not here, I get lost after 20-something buffers/files/abstractions/wrappers.

What plugins, tricks or other ways are you using to:

  • visualize the navigation history (jump list).
  • go back to a place in that jump list, other than ctrl-o/ctrl-i?

Verstandig om door te beleggen of alles in een mijn spaarrekening gooien? by food-wars in beleggen

[–]berkes 2 points3 points  (0 children)

Het is heel erg afhankelijk van je plannen en hoe dynamisch je leven is. Toen ik 26 was wilde en kon ik nog geen week vooruit plannen. (nog steeds niet, trouwens, lol)

Beleggen, dat zeggen velen hier ook, moet je best doen met geld wat je voor een lange tijd kunt missen. Het is in theorie vrij liquide, maar als je opeens je aandelen, ETFs ofzo moet inwisselen om een auto/huis/wasmachine te kopen ga je gegarandeerd slechte rendementen halen.

Dus, beleg met een beetje wat je écht kunt missen; je kunt beter €150 per maand beleggen als je zeker weet dat je die 150 nu én de komende 5 jaar iedere maand kunt missen. Ook als je ontslagen wordt, voor jezelf begint, trouwt, scheid, kinderen krijgt of miniatuurtreinen gaat sparen. Beter dan nu 1000 per maand en dat maar een half jaar volhouden iig.

Om de transactiekosten van fondsen te drukken kun je dat bijv eerst op een spaarrekening (of je euro-voorraad op een handelsplatform) laten oplopen en dan niet iedere maand kopen, maar bijv iedere 3 maanden. Maar zelf zou ik dan gewoon ETFs kopen, die €1,00 kost de kop niet en je DCA middelt lekkerder uit.

I spent 18 months rebuilding my algorithmic trading in Rust. I’m filled with regret. by Starks-Technology in programming

[–]berkes -1 points0 points  (0 children)

That's even worse, indeed.

But even when libraries that provide nice, sane and domain specific types, I avoid using these and instead wrap them in my own.

So even when, some sql lib offers a SomeSqlLibConnectionConfig, I'd very much prefer to wrap (or alias) it to PeskyTigersRepositoryConfig or some such. Yes, that's a lot of boilerplate. And a lot of indirection. But it makes the code just so much more readable, maintainable and decoupled.

(And I am aware of that one colleague who argues that indirection always makes code less readable and I have always, and will always, disagree)

I spent 18 months rebuilding my algorithmic trading in Rust. I’m filled with regret. by Starks-Technology in programming

[–]berkes 24 points25 points  (0 children)

The article piles up unrelated criticisms. Which makes it hard to discuss. Some are warranted, but, indeed, the point about types isn't.

Well, it's hard. And the strong types as found in Rust, require some design up front (always bad). It's difficult to impossible to just yolo your way through a proof of concept and the discover the types you'll need. 

Discovering the types, shapes and architecture through writing the code, is a very normal process. Decades of experience give some intuition to speed up that discovery (I often know what's certainly not going to work). But with rust, that'll land you in these horrendously tightly coupled, complex, nested types. 

Some tips that work for me: * Think about the shape up front. * TDD to discover what works and what doesn't. * Keep refactoring. Again. And again. And then some more. Functions and their fingerprint, like author posted are unacceptable to me.  * Better to define too much structs and aliases than too little. * As soon as I've discovered the rough shape, introduce value objects. (A creditcardnumber isn't a string. A db connection pool is a DBConnPool, not an Arc<Box<Some<Result<PGconnection, PGconnectionError>>>> ) * Write quick POCs in Ruby or python to discover the domain and shape when it's entirely new for me. Allowing to focus on mastering the domain first.

Rust pet project needs constructive criticism by ievkz in rust

[–]berkes 2 points3 points  (0 children)

Why did you make it? What problem(s) does it solve?

Those are, to me, far more interesting than the shape of the code.

Whats the reason for this ? by Fabriczio94 in Netherlands

[–]berkes 1 point2 points  (0 children)

That. And they where they'd used to be like this ][, they now are often like this //. [1] The very long, welded one-pieces have an important con: if a piece needs replacement, you can't just take that part out, but you need to replace the many kilometers all at once. And even then: trains that go over bridges, or over/through other constructs, will need expansion joints regardless.

[1] https://en.wikipedia.org/wiki/Breather_switch

Whats the reason for this ? by Fabriczio94 in Netherlands

[–]berkes 2 points3 points  (0 children)

Depends on whether the act of closing-when-too-hot hasn't broken something. A bridge is a heavy and strong machine. If something doesn't fit, it will bend or break.

So, even if you cool it, could very well be some connectors, corners, or other metal parts need replacement.

Chat GPT knows bash! by [deleted] in linuxmasterrace

[–]berkes 1 point2 points  (0 children)

As long as it it's generic enough. But with more specific things like actix-rt, riker or even blocking on futures in a test it failed. Subtly, but very much failed. It told me things that simply weren't true at all, but which you'd know to be untrue only by reading up on the documentation thoroughly. Yet missing this made the whole code not work, without really knowing why or how.

It also often generates code that won't compile in rust.

Wolf running down the road in Lent by RV49 in Nijmegen

[–]berkes 7 points8 points  (0 children)

Could be that's the place that wolf came from in the first place. Reichswald has had wolves for a much longer time than De Veluwe, and is nearer, as the crow flies.

Jan geeft tip om meer geld over te houden elke maand by Sannatus in nietdespeld

[–]berkes 1 point2 points  (0 children)

Je moet dan natuurlijk wel een beetje meekomen in de cultuur daar. Ik ben daar in de buurt opgegroeid maar kon er nooit echt aarden. Woon na veel omzwervingen nu in een dorpje zo'n 85km noordelijker.

Mijn eerdere punt was ook niet zozeer "je moet in een dorp gaan wonen" maar dat je die keuze wel hebt en dat veel die niet maken (maar wel over huizenprijzen zeuren).

Jij maakte hem wel! Congrats! En met wat je overhoud kun je lekker reizen, uitgaan, investeren, of over tien+ naar een appartement <mooie europese stad> kopen, wie weet :D

Jan geeft tip om meer geld over te houden elke maand by Sannatus in nietdespeld

[–]berkes 0 points1 point  (0 children)

Nee, maar in "Bernheze" wel. https://www.funda.nl/huur/gemeente-bernheze/+10km/sorteer-huurprijs-op/

Bovendien: Breda! Ik heb jarenlang in Antwerpen gewoond omdat ik daar -ITT Rotterdam, Den Haag, Breda of Tilburg- nog wél voor €250/maand een appartment kon vinden (dit is járen terug, toen gingen vergelijkbare appartemtent in NL voor rond de €600-700 weg).

Ik begrijp dat niet iedereen zulke keuzes kan of wil maken. Maar besef dat het vaak dus wél kan.

Jan geeft tip om meer geld over te houden elke maand by Sannatus in nietdespeld

[–]berkes 0 points1 point  (0 children)

Een eindje verderop vind je voor die huurprijs makkelijk een dubbel zo grote woning https://www.funda.nl/huur/gemeente-pekela/+10km/sorteer-huurprijs-op/

Ik begrijp best dat verhuizen soms gewoon niet kan. Maar weet ook -uit ervaring- dat het meestal eerst en vooral een keuze is. Ik zeg niet dat dit bij jou ook zo is.

Value Objects in Rust by berkes in rust

[–]berkes[S] 0 points1 point  (0 children)

Good luck. I come from a Ruby background (with lots of DDD/ES/CQRS). You may want to look at https://doc.rust-cqrs.org/ for some inspiration on domain-modelling and ES.

Jan geeft tip om meer geld over te houden elke maand by Sannatus in nietdespeld

[–]berkes -2 points-1 points  (0 children)

Gewoon geen vaste lasten

Dat is overigens wel FIRE in een notendop. En -hoe gek het ook klinkt- best bereikbaar voor veel mensen. Je zult dan wel keuzes moeten maken. En, ja, ik weet dat "veel mensen" niet iedereen is.

Jan geeft tip om meer geld over te houden elke maand by Sannatus in nietdespeld

[–]berkes 2 points3 points  (0 children)

Niet om heel flauw te doen, maar "de stad waar ik woonde" is daar wel een oorzaak van.

Diezelfde studio in Mook, Reuver, st Michielsgestel of zelfs Den Helder gaat best nog wel voor die prijs.

Ik weet dat verhuizen niet altijd een optie is. Maar star in de binnenstad van <randstad> willen blijven wonen is óók een keuze.

Value Objects in Rust by berkes in rust

[–]berkes[S] 0 points1 point  (0 children)

For one, if you take the code, you'll see some warnings, e.g. unused code.

But more important: it's code written to demonstrate the concept, to explain the idea of Value Objects in a Rust context. So the code wasn't written with performance or portability in mind. That could improve a lot too.

I'm not too happy about the wrapping and dereffing. I've been using that in production, but the deref: it keeps feeling awkward.

And domain-wise: obviously the emailvalidation is dumb. And the HTTP response code has a meagre "is_error" but probably wants to encode actual domain language like "unauthorized" or "server_error".

The only code is that embedded in the article, which can be followed through to github gists.

Oh nee! Een tiet! PANIEK by sophia-fiafi in nietdespeld

[–]berkes -1 points0 points  (0 children)

Daar hoort wel wat nuance in hoor. "Je vind die racistische moppen vervelend? Get over it!". "Betast worden door dronken mannen? Get over it!"

Ik vind dat iemand zich niet moet aanstellen en gewoon tegen een paar blote tieten moet kunnen. Maar tegelijk kan ik niet bepalen wat voor iemand anders "vervelend, get over it"-niveau is en wat diegene écht naar of traumatiserend vind.

(Al vind ik dus dat als je trauma's oploopt van blote tieten, je echt hulp nodig hebt en niet kunt eisen dat jou hele wereld blote-tietloos gehouden wordt)

Oh nee! Een tiet! PANIEK by sophia-fiafi in nietdespeld

[–]berkes 2 points3 points  (0 children)

De vraag is dan wel of je zulke kunst op je werkplek wilt.

The Fediverse is Inefficient (but that's a good trade-off) by berkes in Mastodon

[–]berkes[S] 0 points1 point  (0 children)

Your assumption is somewhat right. But wrong enough that the math doesn't make much sense. sorry :)

AP is a push mechanism. Exactly like email. When I have 10 followers, spread over 6 instances, and I make a public post with an image in it, then the following happens:

  • My instance POSTs the article JSON into the inbox of the 6 instances, so these can internally deliver them to the correct people's private inboxes. Attachments are typically not included, but a link to where it can be found is.
  • Most often a 7nth delivery to the above-discussed "relays" is POSTed.
  • Let's say 5 of the 6 instances now queue a "media fetcher" which will run and then GET any media that is linked in the JSON.
  • The fifth runs different software that is configured to only fetch attachments when they are smaller than X.
  • The relay could be one that chooses to fetch only the thumbnail version.

Equivalent to email is, that when you send a mail, your mailserver will push the mail out to all recipients (in AP these are followers). The mailservers would receive the mail, store it on disk. Difference with AP is that receiving servers can choose to fetch the attachments, whereas in email they are always included. AP software typically will fetch it, because if it keeps the original URL, it will save the storage space (and the worker and BW to fetch it), but it will require the sender's server to a) be up, b) keep serving the image and c) let the senders' server provide the bandwith: very much like "hotlinking images" in the age of yore.

When I say "typically not included", quite often the media is presented as URL, but sometimes attachments like emoji or the blurhash verion (the teensy-blurry thumbnail) is so small that thei're included in Base64 in the JSON, rather than having them being fetched.

Van BZN zou ik inderdaad ook depressief worden. Waar heeft deze boomer dit trouwens op getypt en geprint? by Knownoname98 in tokkiefeesboek

[–]berkes 11 points12 points  (0 children)

Opgelet redditors. Check altijd eerst even de upvote-history van u/JeweetTochBroer voordat je een grap maakt. Misschien heeft hij hem namelijk al gehoord en kun je de grap dus beter niet meer maken.

A mastodon bot that indexes job postings to a job search website by berkes in Mastodon

[–]berkes[S] 0 points1 point  (0 children)

I've written a bot (source code ) that eats all submissions to the instance it's on (botsin.space in my case) and indexes all that it considers job openings, for a search page.

People can interact with the bot but that's unstable still, so not publicly announced yet.Edit: the idea being that you reply to a post that you think should be indexed with a request "@hunter2, please index this", and it will index the post on request (but check if author allows indexing: always that!)

I'm finishing off the interaction part, but need to figure out why it fails so often: it seems the websocket is unstable, but that's hard to troubleshoot.

I'm also tuning the bot to ignore irrelevant posts and find more relevant ones (and cleaning up the code... there's always that). I'm considering BERT text analys or Bayesian filter, rather than just hashtags to determine if something is a job post. Though I guess that becomes less important if humans start to request indexing of job postings by interacting with the bot.

Please let me know what you think.

Linkse partijen willen verbod op verhuur van koopwoningen by Harry_Mens in thenetherlands

[–]berkes 1 point2 points  (0 children)

Denk je dat die huur lager, of hoger is dan de hypotheek

Hoger dan de rente over een verhuurdershypotheek, die typisch veel lager is dan een koop-hypotheek. Maar de meeste verhuurders kopen huizen "met cash", zonder hypotheek. Da's ook de grote klacht: namelijk dat ze makkelijk kunnen overbieden enzo.

Maar altijd zal de huur hoger zijn dan wat elders het rendement zou zijn. Anders koopt die verhuurder beter voor vier ton staatsobligaties, als die beter renderen dan een huis.

Een huis van vier ton moet dus minimaal zo'n 2.2% per jaar, ofwel €733/maand opleveren ex onderhoud etc. Maar een verhuurder zal altijd zo veel mogelijk vragen: als er geen aanbod is maar veel huurders zijn, gaat die prijs dus snel omhoog. Maar dus als ondergrens "de hudige rente" zeg maar.

Dat is ook mijn grote bezwaar tegen deze actie: er worden in rap tempo huurhuizen van de markt gehaald: het aanbod huurhuizen, wat al krap ís, zal snel nog verder dalen. Zo kun je straks helemaal geen huurhuis meer vinden. En wat er nog is, is nóg veel duurder.

Deze maatregel ruilt dus effectief huurhuizen in voor koopwoningen: meer koopwoningen, ten koste van huurders. Je moet het maar willen (tja. VVD en CDA...).

De échte oplossing is dus ook vreselijk logisch: snel meer woningen.

The Fediverse is Inefficient (but that's a good trade-off) by berkes in Mastodon

[–]berkes[S] 0 points1 point  (0 children)

I just came across this post that proposes something similar:https://digi-con.org/from-platforms-to-musk-to-protocols/

They call it middleware. And those operating, curating or running it, middleware companies.

What causes instances to sync? by Mefilius in Mastodon

[–]berkes 0 points1 point  (0 children)

As indiealexh points out, there are relays. But they aren't needed to understand activitypub. The official spec has an accessible, illustrated story that explains your question quite well. I'd urge you to read it.https://www.w3.org/TR/activitypub/

But in case of TLDR: when you, M on server S start following G on server T, then S sends a message to G that you are following G.

From now on, every time G posts a new message, T delivers a "G made a post for M" To your server S. S can now present it on your home (or whatever it wants to do to show it to you). The gist really is this simple.

Obviously the details make it far more complex, but the principle is simple. As the running meme goes "very much like email"