Spyke

Posts

programming·Programmingbytinkralge

RFC: Suggestion to monetise without ads

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.

::: spoiler 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.

:::

View original on programming.dev
android_dev·Android Developmentbytinkralge

Are there ORMs for android that support many-to-many relationships?

I have no experience with android apps and just started working on one that needs to work with relational data. The relational data has multiple many-to-many relationships and the inbuilt ORM (Room) is leads to class explosion.

While looking at ORM libraries for android, there seem to be many that are out of date:

From 5 of the Best Android ORMs (2014) and AlexeyZatsepin/Android-ORM-benchmark (2017)

I'm leaning towards Requery because I like its API the most (hides SQL the most), but haven't looked at ObjectBox yet.

View original on programming.dev
nix·Nix / NixOSbytinkralge

Feedback for the nixlang wiki

Despite the name, the nixlang wiki is a community contributor wiki to document things around nix that the maintainers haven't gotten around to, to short-circuit the lengthy review process for the official documentation, and an attempt to make an entry into the nix ecosystem easier.

It's difficult to write things from a perspective of somebody who doesn't know, despite once being that person!

It would be great to have some feedback on the wiki.

P.S I'm not the maintainer, just a contributor.

https://nixlang.wiki/Open linkView original on programming.dev
programming·Programmingbytinkralge

How would you store symlinks on a cloud service?

TL;DR No archive format like tar, zip, ... but how would you theoretically represent a symlink in a manner that can be stored on the cloud and retrieved back to the system as a symlink?

Backstory

I heavily use symlinks to organise my media and even wrote an application that helps me do so (it's in Python and being rewritten in Rust). But I also use stuff like home-manager and nix which makes heavy use of symlinks.

My goal is to back up my media and /home to the cloud at regular intervals. There are services that cost just about 60-100€ yearly for limitless storage in the cloud. So having part of my library purely in the cloud and using terrabytes of space would cost less than a single 15TB HDD (500+€). To have a local backup, I'd even need a least a second one, which would put me at >1000€ - the equivalent of at least 10 years of cloud storage.

Options explored

rclone

It is pretty sweet as it supports mounting a cloud drive as a folder and has transparent encryption! However there are multiple open issues on uploading symlinks and I don't know Go. I wouldn't mind trying to learn it if I had an idea how to upload a symlink without following it (following symlinks breaks them).

git-annex etc.

git-annex and using a bare git repo with a remote worktree is great, but I don't need to make diffs of stuff and follow how things moved around, etc. I just need to replace backups with a view of what's there. Plus, storing all that history will probably take enormous amounts of space which is wasteful.

Ideas

store a blob of stat() call for every file

I'm not sure about this. The stat struct does contain information about the filetype (directory, hard link, symlink, ...), but my knowledge of linux internals is limited and maybe that's too complicated for this usecase.

a db of links

Instead of storing the links themselves, I store a DB (sqlite? CSV?) of links, upload that DB and use the DB to restore links after pull it back down. 🤔 Actually this might be the simplest thing to do, but maybe y'all have better ideas.

View original on programming.dev
code_review·Code Reviewbytinkralge

[Rust] Simple predictive text review

I wrote a simple algorithm for predictive text that uses preceding words as context. Without looking at prior, it was an attempt as seeing what I could come up with.

The goal is for it to be incorporated in chorded input and pick the best candidate for the entered chord with the given context. Chorded input is the method of hitting all keys for a word simultaneously instead of hitting each key individually in expected order.

E.g you've typed "this is the worst" and hit the chord "aet", which word should be chosen? ate? tea? eta? This algorithm is there to answer that.

What I'm looking for in the code review in order of importance:

  • documentation (is it understandable? are there things missing? ...)
  • code architecture, code structure (function should be a member? composition could be changed? clarity, ...)
  • algorithm review (optimisations, improvements)
  • variable and class names (naming things is hard)
  • rust specific stuff (f64 instead of u32 maybe? dyn vs impl? ...)

The code is linted and automatically formatted.

[Rust] Simple predictive text reviewhttps://gitlab.com/NamingThingsIsHard/linux/chordnix/-/commit/3a1cf8ed40260b50c2704e340e04889092131f80Open linkView original on programming.dev

You reached the end