Programming

23556 readers
260 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
 
 

Please excuse - and do not hesitate to point out - any violation against etiquette that I might be committing here... I am new here.

I started to learn C a few months ago as a hobby as part of a bigger project, namely to learn about computers in general. I have had so much fun reading Code - The Hidden Language of Computer Hardware and Software by Charles Petzold. But that's another story...

I was about to buy a few new SSDs and needed to do some budgeting. Instead of using my phone's calculator, I decided to try to write a calculating program in C, because I hadn't touched programming for some weeks or months because life and I wanted to see if my knowledge had matured some.

The goal was to have it do the four standard arithmetics and also save the last result in a variable, which I just called "memory" for lack of bette phrasing on my part. Maybe next week I'll figure out how to make it possible to use the value saved in memory instead of having to type a number.

I welcome any constructive criticism on how and why this code is up to code or not(sorry...), if it can be improved and how or even if it's just garbage and why that is. I am just proud that it worked without gcc throwing any errors.

#include <stdio.h>

int main(void) {

        int num1 = 0;
        int num2 = 0;
        int choice = 0;
        int memory = 0;

        printf("Welcome to the Calculator of the century!\n\n");

        while (1) {
                printf("What would you like to do?\n\n");
                printf("(1) Add two numbers\n(2) Subtract two numbers\n(3) Multiply two numbers\n(4) Divide two numbers\n(5) Show memory\n(6) Exit\n\n");
                printf("Enter 1, 2, 3, 4, 5 or 6: ");
                scanf("%d", &choice);

                if (choice >= 6 || choice < 1) break;

                if (choice == 5) {
                        printf("\n%d in memory.\n\n", memory);
                } else if (choice < 5 || choice > 0) {
                        printf("\nEnter the first number: ");
                        scanf("%d", &num1);
                        printf("Enter the second number: ");
                        scanf("%d", &num2);
                }

                if (choice == 1) {
                        printf("\nThe sum of %d and %d is %d\n\n", num1, num2, num1 + num2);
                        memory = num1 + num2;
                } else if (choice == 2) {
                        printf("\nThe difference of %d and %d is %d\n\n", num1, num2, num1 - num2);
                        memory = num1 - num2;
                } else if (choice == 3) {
                        printf("\nThe product of %d and %d is %d\n\n", num1, num2, num1 * num2);
                        memory = num1 * num2;
                } else if (choice == 4) {
                        printf("\nThe quotient of %d and %d is %d\n\n", num1, num2, num1 / num2);
                        memory = num1 / num2;
                }
        }

        printf("\nWe hope to see you soon again!\n");
        return 0;
}
3
 
 

During OpenAI’s GPT-5 launch event, they demoed the model’s ability to fix real bugs in production code. Live on stage. In their own repository. The kind of demo that makes CTOs reach for their credit cards and engineers nervously update their resumes. There’s just one small problem: the fix they promised to merge “right after the show” is still sitting there, unmerged, three and a half months later.

4
 
 

cross-posted from: https://lemmy.ca/post/55496692

Devs gripe about having AI shoved down their throats

5
6
 
 

I’m trying to convert a blog into an EPUB and keep running into issues with existing tools.

I first tried blog2epub, but it fails during parsing with:

lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: meta line 10 and head, line 17, column 8

I then tried WebToEpub on Firefox, providing:

  • Content selector: .article-content
  • Chapter title selector: .title

It generated an EPUB, but the file wouldn’t open in any reader.

What I’m looking for is a tool where I can point to a blog’s base URL, define CSS selectors for the article title and body, and have it automatically fetch all entries and create one chapter per post. Or something similar.

Does anyone know of a reliable tool, script, or workflow that does this well on Linux?

7
31
Tips on getting certs? (lemmy.dbzer0.com)
submitted 2 days ago* (last edited 2 days ago) by SpiceDealer@lemmy.dbzer0.com to c/programming@programming.dev
 
 

A couple of weeks ago, I made this post over at !asklemmy@lemmy.world asking if I should go back to university. After some thoughtful consideration, I've decided to pursue certs; specifically Comptia A+ and then the Network+. I'm almost done with an A+ study guide I bought and feel almost ready to take the exam. But I've also wanted to hear about your experience on getting tech certs and the career that followed. Any advice is welcomed. Thanks in advance.

8
 
 

I am baffled any time I'm on facebook how horrid it is. Loads insanely slowly, won't accept picture uploads at random, randomly doesn't let you share to people in your friends group (it will just hide people for no reason). Such a terrible website. Sadly I have to stay on it for friends and music reasons (there is nothing else anyone I know uses) but man, it's crazy how badly they want you to install their spyware app so you don't use the browser version.

9
10
11
 
 

I have a vendor that sucks donkey balls. Their systems break often. An endpoint we rely on will start returning [] and take months to fix. They'll change a data label in their backend and not notice that it flows into all of their filters and stuff.

I have some alerts when my consumers break, but I think I'd like something more direct. What's the best way to monitor an external API?

I'm imagining some very basic ML that can pop up and tell me that something has changed, like there are more hosts or categories or whatever than usual, that a structure has gone blank or is missing, that some field has gone to 0 or null across the structure. Heck, that a field name has changed.

Is the best way to basically write tests for everything I can think of, and add more as things break, or is there a better tool? I see API monitoring tools but they are for calculating availability for your own APIs, not for enforcing someone else's!

12
13
14
15
 
 

Feeling slightly exhausted by the world? Let's reverse a string in Rust in a needlessly complicated way. I was expecting to make a tiny simple video and ended up going further into unsafe than I ev...

16
 
 

Using the book Haskell Programming from First Principles by Christopher Allen, Julie Moronuki (https://haskellbook.com/)
Exercises are allowed to be used according to license

Come to my Discord to chat or bring up questions from the video
Discord server: https://discord.com/invite/r4pMZAuKGC
Donations are welcome at: https://ko-fi.com/ellyse7777

17
18
19
 
 

Fortunately, data demonstrates that making a better choice does not require daunting multiyear rewrites of existing codebases. Security can be dramatically improved by incrementally shifting the development of just new code to memory-safe languages. If these vulnerabilities can be avoided with low impact on other development goals, then choosing to introduce new ones should increasingly be considered unacceptable, and our goal should be for vulnerabilities to become increasingly impossible to introduce.

[...] This leads to a counterintuitive insight that defies some popular anecdotes: The most vulnerable code in your project is not some dusty legacy component, but the code being written today. This is because, like most bugs, vulnerabilities have a half life. The longer code exists and is exercised, the more likely its flaws are to be found and fixed, leaving the freshest code with the highest concentration of bugs.

[....]

Beyond stability, there have also been gains in development velocity. Change lead time, the time it takes for a code commit to be successfully deployed, is a critical measure of efficiency. One of the largest factors in this metric is often code-review latency. Our data shows a fascinating trend: As our developer community has gained experience with Rust, the time required for code reviews has decreased (see figure 4b). Rust changes tend to go through fewer revisions and spend less time in the review cycle, with an approximately two times faster median code review in 2024 compared with C++.

[...]

These positive outcomes demonstrate that choosing a memory-safe language is not about making a tradeoff between security and productivity. We are not sacrificing quality for velocity or productivity for security. We are improving across all of these metrics simultaneously. The results were achieved while reducing costs associated with sandboxing, fuzzing, and the engineering hours spent triaging and patching bugs. Using a better tool allows for fewer tradeoffs, resulting in better software and, ultimately, a better product.

20
21
22
 
 

Dr Iain McGilchrist paints a stark moral and existential picture of where AI is heading, and how this is preceded by and furthers a dangerous shift in our brains to a focus on power.

23
 
 

cross-posted from: https://jlai.lu/post/28733131

24
25
view more: next ›