Programming

21200 readers
30 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
1
 
 

Hi all, I'm relatively new to this instance but reading through the instance docs I found:

Donations are currently made using snowe’s github sponsors page. If you get another place to donate that is not this it is fake and should be reported to us.

Going to the sponsor page we see the following goal:

@snowe2010's goal is to earn $200 per month

pay for our 📫 SendGrid Account: $20 a month 💻 Vultr VPS for prod and beta sites: Prod is $115-130 a month, beta is $6-10 a month 👩🏼 Paying our admins and devops any amount ◀️ Upgrade tailscale membership: $6-? dollars a month (depends on number of users) Add in better server infrastructure including paid account for Pulsetic and Graphana. Add in better server backups, and be able to expand the team so that it's not so small.

Currently only 30% of the goal to break-even is being met. Please consider setting up a sponsorship, even if it just $1. Decentralized platforms are great but they still have real costs behind the scenes.

Note: I'm not affiliated with the admin team, just sharing something I noticed.

2
3
 
 

~Update~

You can now encrypt plain text, so anything you want. With this, you can send sensitive information over insecure channels or share publicly with real plausible deniability. (below 2000 characters works without issue)

~Changes~

I rebuilt the system with a different encryption design, and address many of the flaws pointed out in V1.

I really wanted any password to always decrypt so you never know if you are right. I found the XOR algorithm that does this, but there is an entropy problem, where an incorrect password will almost always output non-common characters, I attempted to solve this at its core by diving into the math and some research papers but got nowhere, as it seemed to be almost impossible.

I tried finding an algorithm that would give me perfect plausible deniability, so if you shared a link X with a password you could use a different password and get Y, saying you never intended to share X. It doesn't exist 😢 I came up with a workaround by adding decoys which are mutable XOR ciphers joined, it allows you to set what other data is included, so you can tailor your alibi.

Here is the demo link. There are three memes you can find

Password: test1, test2, test3

~Safety~

It should be safe to share data encrypted with this method, I did some basic brute force tests and did not find any shortcuts, I have a rough estimate of a billion years on a server farm for a 12digit password.

~Considerations~

@calcopiritus@lemmy.world said:

"There’s 2 secrets here: the link and the password. And to share it with someone you need to share 2 secrets: the locked link and the password."

A strong password is almost impossible to crack, but you can use a popular text link tool like pastebin with expiry to mask the encrypted data. As for eliminating the password, I have considered using the site as the 'shared secret' so you share just the cipher, and if you know the URL you can paste it in, and it would be encrypted/decrypted with a derived key the site stored.

4
5
 
 

Are there communities, free software/open source or otherwise, using Lemmy as their forum software?

Nowadays, many use Discourse, some are on Zulip, and I just don't care about the Discord ones. Would Lenmy not fit the same purposes? It is federated and easier to participate in, like mailing lists - no need to sign up per forum. Matrix is too, but it doesn't seem to be made for long-form writing.

I believe Discourse was designed based on experience with community dynamics, and Zulip is well-designed too. Would something with federated participation like Lemmy not work as well?

6
 
 

I recently took up running and need a few good podcasts to listen to while doing so. I thought this would be a great opportunity to broaden my general programming knowledge and keep more in touch with new developments - can you recommend something?

Everything goes, from weekly stuff summarizing new tech to deep dives into certain topics.

7
8
9
 
 

After 20 years, PNG is back with renewed vigor! A new PNG spec was just released.

10
 
 

I made this tool so you can share 'locked' links safely & anonymously with a password. It gives you plausible deniability and crowd blending when sharing privates links.🔒

https://qrc.site/anon (open sauce) 🦑

11
 
 

Cross-posted from "How could I allow users to schedule sending emails at a specific interval?" by @lena@gregtech.eu in !learn_programming@programming.dev


Basically, I'm trying to figure out how I could allow a user to send a schedule in the cron syntax to some API, store it into the database and then send an email to them at that interval. The code is at gragorther/epigo. I'd use go-mail to send the mails.

I found stuff like River or Asynq to schedule tasks, but that is quite complex and I have absolutely no idea what the best way to implement it would be, so help with that is appreciated <3

12
13
14
15
16
17
 
 

About enshitification of web dev.

18
 
 

Perhaps the most powerful and widely used tool for literate programming ist Emacs org-mode with the babel extension. I have used it, and it is good!

However, org-mode puts a hurdle to novice users - to practice literate programming, they need to learn a bit of Emacs, which is a task in itself.

I linked the above project because it has two interesting properties:

  • One can write the literate document in Markdown. This is not as powerful as org-mode, which is tailored to larger documents, but very accessible.

  • One can modify the generated source files directly, and they are automatically read back into the literate document. This makes it much easier to work with existing tools that modify source code.

19
 
 

I had an interesting email come in about billing. GitHub thinks I owe them money...cents on the dollar but still $$. I am on the free tier on GitHub and have been the past 15+ years. image
Up til recently, ive had no bills and im not an admin on any org. It looks like all my GitHub actions on my repos are accruing billing now. None of these repos are private. So im not 100% why this is occurring.

Has this happened to anyone else? Is there something im missing here?

20
 
 

Summary by Dan Luu on the question about whether for statically typed languages, objective advantages (like having measurably fewer bugs, or solving problems in measurably less time) can be shown.

If I think about this, authors of statically typed languages in general at their beginning might not even have claimed that they have such advantages. Originally, the objective advantage was that for computers like a PDP11 - which had initially only 4 K of memory and a 16-bit adress space - was that something like C or Pascal compilers could run on them at all, and even later C programs were much faster than Lisp programs of that time. At that time, it was also considered an attribute of the programming language whether code was compiled to machine instructions or interpreted.

Todays, with JIT compilation like in Java and the best implementation of Common Lisp like SBCL being at a stone's throw of the performance of Java programs, this distinction is not so much relevant any more.

Further, opinions might have been biased by comparing C to memory-safe languages, in other words, when there were perceived actual productivity gains, the causes might have been confused.

The thing which seems more or less firm ground is that the less lines of code you need to write to cover a requirement, the fewer bugs it will have. So more concise/expressive languages do have an advantage.

There are people which have looked at all the program samples in the above linked benchmark game and have compared run-time performamce and size of the source code. This leads to interesting and sometimes really unintuitive insights - there are in fact large differences between code sizes for the same task between programming languages, and a couple of different languages like Scala, JavaScript, Racket(PLT Scheme) and Lua come out quite well for the ratio of size and performance.

But given all this, how can one assess productivity, or the time to get from definition of a task to a working program, at all?

And the same kind of questions arise for testing. Most people would agree nowadays that automated tests are worth their effort, that they improve quality / shorten the time to get something working / lead to fewer bugs. (A modern version of the Joel Test might have automated testing included, but, spoiler: >!Joel's list does not contain it.!<)

Testing in small units also interacts positively with a "pure", side-effect-free, or 'functional' programming style... with the caveat perhaps that this style might push complex I/O functions of a program to its periphery.

It feels more solid to have a complex program covered by tests, yes, but how can this be confirmed in an objective way? And if it can, for which kind of software is this valid? Are the same methodologies adequate for web programming as for industrial embedded devices or a text editor?

21
 
 

I desperately need some Python help. In short, i want to use multiple keys at once for sorting a dictionary. I have a list of keys and don't know how to convert it to the required list.

This is a single key. The self.items is a list of dictionaries, where d[key] is resolved to the actual key name such as "core_name", that the list is then sorted as. This works as expected for single sort, but not for multiple.

key = "core_name"
self.items = sorted(self.items, key=lambda d: d[key])
key = "label"
self.items = sorted(self.items, key=lambda d: d[key])

Problem is, sorting it multiple times gives me wrong results. The keys need to be called in one go. I can do that manually like this:

self.items = sorted(self.items, key=lambda d: (d["core_name"], d["label"]))

But need it programmatically to assign a list of keys. The following does not work (obviously). I don't know how to convert this into the required form:

# Not working!
keys = ["core_name", "label"]
self.items = sorted(self.items, key=lambda d: d[keys])

I somehow need something like a map function I guess? Something that d[keys] is replaced by "convert each key in keys into a list of d[key]". This is needed inside the lambda, because the key/value pair is dynamically read from self.items.

Is it understandable what I try to do? Has anyone an idea?


Edit: Solution by Fred: https://beehaw.org/post/20656674/4826725

Just use comprehension and create a tuple in place: sorted(items, key=lambda d: tuple(d[k] for k in keys))

22
 
 

I'm very excited to announce that I have recently joined Turso as a software engineer. For many in the field, including myself, getting to work on databases and solve unique challenges with such a talented team would be a dream job, but it is that much more special to me because of my unusual and unlikely circumstances. As difficult as it might be to believe, I am currently incarcerated and I landed this job from my cell in state prison. If you don’t know me, let me tell you more about how I got here.

23
 
 

Biome is a formatter and linter for web languages: JavaScript, TypeScript, CSS, HTML, JSON, and GraphQL.

Version 2 adds type-aware lint rules and it is the first TypeScript linter that does not require tsc. Other new features include:

  • Monorepo support
  • GritQL Plugins
  • Revamped, configurable import sorting
  • Linter domains
  • Bulk suppressions
  • Analyzer assists
  • Many new lint rules
24
1
Project Gemini FAQ (geminiprotocol.net)
submitted 1 week ago* (last edited 1 week ago) by HaraldvonBlauzahn@feddit.org to c/programming@programming.dev
 
 

cross-posted from: https://feddit.org/post/14262415

On the question what are use cases for a Gemini server:

Gemini is kinda a modernized version to the old Gopher protocol. Its purpose is to share hyper-linked text documents and files over a network - in the simplest way possible. It uses a simple markup language to create text documents with links, headings etc.

Here is a FAQ

Main differences with similar technologies are:

  • It is much, much easier to write hyper-linked documents than in HTML

  • a server is much much smaller and easier to set up than a web server serving HTML. It can easily and securely run on a small Raspberry Pi without special knowledge on server security.

  • in difference to gopher, it supports modern things like MIME and Unicode

  • There are clients for every platform including Android and iOS

  • also, there are Web gateways which allow to view stuff in a normal web browser

  • unlike Wikis, it is only concerned about distributing content, not modifying files. This means that the way to store and modify content can be matched to the use case: Write access to content can be via an NFS or Samba server, or via an SFTP client like WinSCP or Emacs.

  • Unlike HTML2, it does not support advertising, tracking, spying to users, and so on.

  • the above two points mean that it does not need user authentication

  • the protocol is text-centric and allows for distraction-free reading, which makes it ideal for self-hosted blogs, small projects or associations, or microblogs.

Practically, for example, I use it to share vacation photos with family.

Two more use cases that come first to my mind:

  • When I did my masters thesis, our lab with about 40 people had a HTTP page hosted on a file server that listed tools, data resources, software, and contact persons. That would be easier to do with Gemini because the markup is simpler. Also, today it would not be feasible to give every student write access to a Apache web server's content because of the complexity of web servers, and the resulting security implications.

  • One time at work, we had a situation with a file server with many dozens of folders, and hundreds of documents. And because all the stuff had been growing kinda organically over many years, specific information was hard to find. A gemini server would have made it easy to organize and browse the content as collaboratively edited hypertext which serves as an index.

25
 
 

cross-posted from: https://lemmy.ml/post/31328788

view more: next ›