Programming

26072 readers
151 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
76
 
 

This is an article that influenced me a lot and made me understand the core idea of functional programming style.

Perhaps it clicked with me because I am a physicist. Physics describes changing objects - rigid bodies, atom quantum systems, electrodynamics - by equations. But the equations are functions: a set of quantities and states goes in, and a new state comes out. The functions by themselves are timeless.

And yet you can describe a rocket with this.

Clojure and pure functional programming applies that to software.

And it works! You can simulate a rocket with it, as aphyr showed in his brilliant example.

Clojure has, by default, no changing variables. Every value is immutable, like a string or a tuple in Python. As modifying a string in Python creates a new string, modifying a dictionary, vector, set or list in Clojure creates a new collection object. This is not as efficient as Rust, but stunningly elegant and very well suited for things like concurrent web servers.

More information on clojure here:

https://clojure.org/about/rationale

(aphyr has also written an introduction to Clojure, "Clojure from the Ground up"', and there are several other really good ones on-line, like "Clojure for the Brave and true".)

77
 
 

TL;DR detect donation options on a website, track website visits locally, show a monthly view of websites visited monthly with donation options, donate to your favorites (manually at first, automatically later - never worked in banking)

Intro

I'm sure a fair number read "monetisation" and though "that's ads". No. You've been conditioned to think that ads are the only way. They aren't. They are one of the worst.

Unfortunately, that's what many media creators, artists, writers, software developers, etc. assume. Peertube isn't a viable platform for creators because viewers have a lot of friction to give the creator money. Meanwhile, on platforms like youtube, all they have to do is view the video and everything else happens in the background.

What if we, the viewers, had an easier way to donate.

The optimal (my dream)

  • I install software and give it access to my bank account (my bank supports creating many sub accounts)
  • the software tracks the usage of the things I use, the pages I visit, the videos (and their creators) that I watch, the artists I listen to, the newspapers I read, the blogs I read, the forums I interact with, etc.
  • at the end of each month, I transfer %money to my sub account (automatic transfer)
  • the software is notified and %money is distributed, with an algorithm of my choosing, using the donation gateways of the stuff I consumed

This can all be done locally, without a server, and if need be stored per device, then aggregated via a local sync (WiFi, bluetooth, VPN, ...). Everything stays local, the bank just sees your outgoing transactions. Optimally, it would be with a private method of transferring money e.g Monero or GNU Taler.

Distribution examples

  • top X - equal split
  • weighted split (#1 - 50%, #2 - 30%, #3 20%)
  • exponential decay (halve until minimum is reached, 50%, 25%, 12.5%, ...)
  • linear decay (remove fixed amount until nothing is left, 30, 25, 20, 15, 10)
  • winner takes all (#1 get all the money)
  • weighted split + base ( base = 10, #1 +20, #2 +15, ...)

Reality

  • Tracking everything is difficult but website visits are easy with an extension
  • I've never worked with banking and have no idea how to connect to bank account (open banking?)

Tracking

These have their advantages and disadvantages, but together, they could cover most scenarios.

  • Peertube for example could add tags and provide a file on the server for information about donating to the server operator.
  • Lemmy could add tags to <head> for people who have created the thread.
  • People who use managed services but control the content can put donation links in the . These are the most at risk though as it's possible that managed service operators inject whatever they like into the traffic.

Reading the DOM

  1. find OpenGraph declarations <meta property="og:donation" content="https://wero.eu/example" />
  2. find payment provider links document.querySelector("a").filter(isPaymentProvider)

Querying the server

.well-known/donation servers should put that file there with a documented JSON format

Reading queries

Look for custom headers e.g X-Donation: https://wero.eu/example

Payments

If I'm not mistaken, GNU Taler should have an API that allows connecting to an account, but it only has a testnet. Paying with crypto probably needs a server or something where you host your wallet, but it should be possible. Open Banking, after having a quick look requires some kind of registration to be able to access the API. IMO, nobody's going to hand over details like that unless it's considered normal and we're far away from that.

Therefore, the most likely is that the user will simply be presented with the algorithms to distribute money, the amounts to distribute, and the distribution methods. My best guess is that people get a quarterly, semesterly, or annual notification with the "It's time to donate!" window and they figure it out.

Ups and downs

Advantages

  • It's completely local - nobody but you does the tracking, can analyse it, and use it
  • You decide how you want to distribute the money
  • You decide how much
  • You decide the frequency
  • You don't have to trust me with your money
    • I don't have to take a cut
    • I don't have to setup a company to handle your money
    • You don't have to trust that I transfer the money to those who have earned it
  • Operators have options:
    • Do nothing aka continue as before with existing donation options (wero, paypal, direct bank transfer, crypto, whatever)
    • Add a <meta> tag which gives power to the operator to dynamically generate it (as described before)
    • Make it work with static pages using .well-known/donations

Disadvantages

  • Users currently will have to make the transfers themselves
  • Transfers reveal who you're donating to to banks (no third-party intermediary)
  • Changes will be required by server operators or software developers
  • No security review done yet
    • Other extensions messing with <meta> tags
    • Other extensions messing with web traffic to insert HTTP headers
    • Server operators modifying HTTP headers and web content of their customers to replace donation targets
    • Malicious server operators tracking users that call .well-known/donations
    • Whatever else people come up with

I'm curious about constructive criticism, improvement suggestions, or maybe even links to dispell some of my beliefs about Open Banking.

Previous inspiration

flattr was a micro transaction platform that supposedly did something like this, but it never gained steam. They acted as the tracker and distributor, but it required that server operators also register with flattr.

78
 
 

Decided to bite the bullet and learn PHP, which is used for nearly everything at my job. My starting voyage was to mess around with "pure php", as in, no frameworks, no libraries, not even javascript, just the basic server with v8.3 running and some (currently very shitty) CSS styling.

So, I decided to go with a 2 step process: first, a site for me to post my stuff, with the possibility for external users to make accounts and leave comments. Step 2 would be making a forum where said users can interact. Before I began coding anything, I wrote down the database specification, though it's still "open for debate". I also didn't pay attention and made all tables as MyISAM initially instead of InnoDB, which made me lose all foreign keys, thankfully easily remedied given the small size of the project.

Thus far, I've got the user creation, listing, login (with hashed password), post creation and post viewing working. Visitors, normal users and admin see different links and forms, depending on pages, all with inline php code in appropriate pages - for instance, (unlogged) visitors don't see a comment box when reading a post. I'm currently working on the user edit page.

Anyway, why do I think I'm doing a lot of "wrongs"? For starters, I'm not using classes. At all. Functions are being added "globally" to one of 3 include somepage.php; that are in every page; every database related function - select all, select 1, update, are all in the db.php file. So, every page load is also loading the entire list of database functions, plus a bunch of html-automation related functions, even when none of them are used. Since PDO::fetch() returns an array with mapped keys (ie: $result['column1']), I feel like I have "no good reason" to use classes, especially as I'm still putting some finishing touches on the tables. I mean, I can access the relevant data with $bla['column_name'];, which is all I need thus far.

A lot of the resulting html comes from echo, some of it from functions to handle it more easily, like passing an array so a "global" function of mine returns it as neatly organized <td> elements.

There is no MVC, just good ol' <a href> and <form method=post> where they need to be. All my forms' actions call a separate php page that's just code to handle the form, always as POST, in order to check blank fields, size and character constraint, etc.

I've no doubt that, as is, my project has a number of security holes, though cross-site scripting and session poisoning are not among them. I did try sql injection and couldn't get it to work, so good on me.

As awful as this project might be against "the real world" use, I feel weirdly proud of what I'm achieving. Is there a name for this feeling, of pride for something you know is subpar?

79
 
 

I'm looking for a forgejo cli (something similar to gh for github or glab for gitlab - neither of which I've ever used).

I found one named forgejo-cli and another named fgj but, from a quick look at the source, both seem to save my API key in a plaintext file, which... I just find unacceptable (and, frankly, quite dumb).

Do you know of any others?

80
81
 
 

Publication croisée depuis https://programming.dev/post/46030028

About enshitification, open source and AI pollution

82
 
 

Long time lurker, first time poster. Don't know what it's been with my job but spurred this rant.

83
 
 

I have been building a small browser multiplayer project that was text only. Mostly social and party type games.

Recently I added room wide voice chat using WebRTC. Everyone in the room can join the call if they want, or just stay in text.

What surprised me was how different everything felt.

Before voice Small rooms with 3 or 4 people felt kind of dead Conversations were slower Social deduction games felt less intense

After adding voice Even 3 people feels active Accusations hit way harder when you can hear hesitation People stay longer once they join voice Some users join just to listen

Nobody is forced to join voice, but once one or two people join, others usually follow.

Has anyone else added voice to a text based project? Did it change engagement for you?

link

84
 
 

This is not just about code quality. It is about whether individual developers and product teams can maintain a coherent mental model of what the system is doing and why.

85
86
 
 

I saw the post earlier about making maps using Python. I thought that was a really cool concept as I love seeing open art projects like that. Do you know any other projects that allow you to make art with code?

87
88
89
90
 
 

What if I want to make an RPG game with a text dialog that you can scroll down? And according to my research, 50% of mobile games are made with Unity? Maybe some for the engine, some for pure coding? Maybe that's their trick?

91
 
 

Context: ~3.5yo Drupal / Prestashop / Plain PHP dev

I tried Cursor because our company paid for it, and it does bloody everything near instantly.

If I need to write a module for some custom data report UI, or a data importer of some variety, this thing just needs to know the detailed spec and it gets me probably 80% of the way to the feature in minutes. It's ridiculous. The rest is just me picking some UI libraries, fixing bugs, and probably optimizing the code a bit.

I really don't know what to do with the information that this thing can do what it took me so long to learn, in minutes, rather than hours, while I stumble around plugin declarations as if I just started to code.

Even the off-usage limit Cursor works really good. I can just keep coding with it past the $20 mark and it's fine.

Of course the code it generates is pretty shit and full of comments...but it works.

I've integrated it into my work almost entirely along with the rest of the team. We all spam it daily. We pretty much never write a feature ourselves anymore. From what Cursor says, most of our code in GIT from the past few weeks is AI generated (like 70-80%...)

Before you say it, yes, our codebase is shit, and was shit. We have practically no devops, no real team structure, and something is always on fire, though I'm under the impression that this isn't very uncommon nowadays.. (For context, we just wrote our first documentation for a project more than 4 years old, and it's all generated by Cursor, and there's more hardcoded shit in our code than configurable stuff)

I keep trying to manually write code that I'm proud of, but I can't. Everything always needs to be shipped fast and I need to move on to the next thing. I can't even catch my breath. The only thing allowing me to keep up with the team is Cursor, because they all use it as well. The last guy that refused to use AI was just excluded from the team.

How the hell do I deal with this information? Where do I go from here? I'm fucking terrified and I need some advice from somebody that isn't all up in the latest Opus model paying $80 (tax included) monthly to code with AI... I love my team, they're great people, but our obsession with AI is REALLY concerning.

PS: If somehow I leaked who I work for somewhere and this can be crossreferenced to my company please let me know. I don't want to be found talking about this, just because I don't know how they would react, but I really need a different perspective.

EDIT: Thanks all for the responses. You're confirming my fears. Idk how to feel about it...

EDIT2: I'm a bit overwhelmed by the attention haha. I'm trying to reply when I get free time. Thanks everyone

92
 
 

I'm talking about programs that can't be improved no matter what. They do exactly what they're supposed to and will never be changed.

It'll probably have to be something small, like cd or pwd, but does such a program exist?

93
 
 

Gen Z jobs aren’t dead yet: $240 billion tech giant IBM says it’s rewriting entry-level jobs—and tripling down on its hiring of young talent.

94
95
 
 

Introduction into Dead Simple CI framework for ci pipelines automation.

https://dev.to/melezhik/dead-simple-ci-introduction-1jh6

96
 
 

https://positive-intentions.com/docs/technical/architecture

i cooked a bit too hard on this. i don't advise you use this approach. its something I wanted to investigate for myself.

https://webpack.js.org/concepts/module-federation/#promise-based-dynamic-remotes

i was already using microfrontends for my project. when i came across dynamic remotes, i figured i could use it for statics redundency management. (tbh... a problem that doesnt exist.)

my project is far from finished and it would make sense to add additional safety nets for static-resource-integrity, but the basic concept seems to work and i wanted to share some details ive put together.

97
98
99
 
 

Not sure if this goes here or not? but ive dabbled a little here and there with different things but i lack like every skill to make a game. Im wondering what aspect or skill is worth getting better at, for gamedev?

I cant code, i cant draw/3d art, i cant make music, im bad with ideas, etc.

Where do i even begin or what would you advise?

100
 
 

EDIT: The original link is now a 404 because Ars Technica apparently fabricated quotes, or possibly even generated the article in an extreme case of irony.

Here is some context:
https://mastodon.social/@nikclayton/116065459933532659
https://arstechnica.com/civis/threads/journalistic-standards.1511650/

Here is the original (partially fabricated) archived article if you still want to read it: https://web.archive.org/web/20260213194851/https://arstechnica.com/ai/2026/02/after-a-routine-code-rejection-an-ai-agent-published-a-hit-piece-on-someone-by-name/

view more: ‹ prev next ›