Searching We.Love.Privacy.Club

Twts matching #programming
Sort by: Newest, Oldest, Most Relevant

Saw this on Mastodon:

https://racingbunny.com/@mookie/114718466149264471

18 rules of Software Engineering

  1. You will regret complexity when on-call
  2. Stop falling in love with your own code
  3. Everything is a trade-off. There’s no “best” 3. Every line of code you write is a liability 4. Document your decisions and designs
  4. Everyone hates code they didn’t write
  5. Don’t use unnecessary dependencies
  6. Coding standards prevent arguments
  7. Write meaningful commit messages
  8. Don’t ever stop learning new things
  9. Code reviews spread knowledge
  10. Always build for maintainability
  11. Ask for help when you’re stuck
  12. Fix root causes, not symptoms
  13. Software is never completed
  14. Estimates are not promises
  15. Ship early, iterate often
  16. Keep. It. Simple.

Solid list, even though 14 is up for debate in my opinion: Software can be completed. You have a use case / problem, you solve that problem, done. Your software is completed now. There might still be bugs and they should be fixed – but this doesn’t “add” to the program. Don’t use “software is never done” as an excuse to keep adding and adding stuff to your code.

​ Read More

Okay, here’s a thing I like about Rust: Returning things as Option and error handling. (Or the more complex Result, but it’s easier to explain with Option.)

fn mydiv(num: f64, denom: f64) -> Option<f64> {
    // (Let’s ignore precision issues for a second.)
    if denom == 0.0 {
        return None;
    } else {
        return Some(num / denom);
    }
}

fn main() {
    // Explicit, verbose version:
    let num: f64 = 123.0;
    let denom: f64 = 456.0;
    let wrapped_res = mydiv(num, denom);
    if wrapped_res.is_some() {
        println!("Unwrapped result: {}", wrapped_res.unwrap());
    }

    // Shorter version using "if let":
    if let Some(res) = mydiv(123.0, 456.0) {
        println!("Here’s a result: {}", res);
    }

    if let Some(res) = mydiv(123.0, 0.0) {
        println!("Huh, we divided by zero? This never happens. {}", res);
    }
}

You can’t divide by zero, so the function returns an “error” in that case. (Option isn’t really used for errors, IIUC, but the basic idea is the same for Result.)

Option is an enum. It can have the value Some or None. In the case of Some, you can attach additional data to the enum. In this case, we are attaching a floating point value.

The caller then has to decide: Is the value None or Some? Did the function succeed or not? If it is Some, the caller can do .unwrap() on this enum to get the inner value (the floating point value). If you do .unwrap() on a None value, the program will panic and die.

The if let version using destructuring is much shorter and, once you got used to it, actually quite nice.

Now the trick is that you must somehow handle these two cases. You must either call something like .unwrap() or do destructuring or something, otherwise you can’t access the attached value at all. As I understand it, it is impossible to just completely ignore error cases. And the compiler enforces it.

(In case of Result, the compiler would warn you if you ignore the return value entirely. So something like doing write() and then ignoring the return value would be caught as well.)

​ Read More

We really are bouncing back and forth between flat UIs and beveled UIs. I mean, this is what old X11 programs looked like:

Image

Good luck figuring out which of these UI elements are click-able – unless you examine every pixel on the screen.

​ Read More
In-reply-to » Fuck me sideways, Rust is so hard. Will we ever be friends?

@prologic@twtxt.net I’m trying to call some libc functions (because the Rust stdlib does not have an equivalent for getpeername(), for example, so I don’t have a choice), so I have to do some FFI stuff and deal with raw pointers and all that, which is very gnarly in Rust – because you’re not supposed to do this. Things like that are trivial in C or even Assembler, but I have not yet understood what Rust does under the hood. How and when does it allocate or free memory 
 is the pointer that I get even still valid by the time I do the libc call? Stuff like that.

I hope that I eventually learn this over time 
 but I get slapped in the face at every step. It’s very frustrating and I’m always this đŸ€ close to giving up (only to try again a year later).

Oh, yeah, yeah, I guess I could “just” use some 3rd party library for this. socket2 gets mentioned a lot in this context. But I don’t want to. I literally need one getpeername() call during the lifetime of my program, I don’t even do the socket(), bind(), listen(), accept() dance, I already have a fully functional file descriptor. Using a library for that is total overkill and I’d rather do it myself. (And look at the version number: 0.5.10. The library is 6 years old but they’re still saying: “Nah, we’re not 1.0 yet, we reserve the right to make breaking changes with every new release.” So many Rust libs are still unstable 
)


 and I could go on and on and on 
 đŸ€Ł

​ Read More

OpenBSD has the wonderful pledge() and unveil() syscalls:

https://www.youtube.com/watch?v=bXO6nelFt-E

Not only are they super useful (the program itself can drop privileges – like, it can initialize itself, read some files, whatever, and then tell the kernel that it will never do anything like that again; if it does, e.g. by being exploited through a bug, it gets killed by the kernel), but they are also extremely easy to use.

Imagine a server program with a connected socket in file descriptor 0. Before reading any data from the client, the program can do this:

unveil("/var/www/whatever", "r");
unveil(NULL, NULL);
pledge("stdio rpath", NULL);

Done. It’s now limited to reading files from that directory, communicating with the existing socket, stuff like that. But it cannot ever read any other files or exec() into something else.

I can’t wait for the day when we have something like this on Linux. There have been some attempts, but it’s not that easy. And it’s certainly not mainstream, yet.

I need to have a closer look at Linux’s Landlock soon (“soon”), but this is considerably more complicated than pledge()/unveil():

https://landlock.io/

​ Read More

So I was using this function in Rust:

https://doc.rust-lang.org/std/path/struct.Path.html#method.display

Note the little 1.0.0 in the top right corner, which means that this function has been “stable since Rust version 1.0.0”. We’re at 1.87 now, so we’re good.

Then I compiled my program on OpenBSD with Rust 1.86, i.e. just one version behind, but well ahead of 1.0.0.

The compiler said that I was using an unstable library feature.

Turns out, that function internally uses this:

https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.display

And that is only available since Rust 1.87.

How was I supposed to know this? đŸ€šđŸ«©

​ Read More

CNCF Kubestronaut Program Momentum Highlights Asia’s Role in Growing Cloud Native Talent
Upcoming Kubestronaut celebrations in China and Japan to honor global program growth Hong Kong, China– 10 June, 2025 – The Cloud Native Computing Foundation¼ (CNCF¼), which builds sustainable ecosystems for cloud native software, today announced continued
 ⌘ Read more

​ Read More

How can one write blazing fast yet useful compilers (for lazy pure functional languages)?
I’ve decided enough is enough and I want to write my own compiler (seems I caught a bug and lobste.rs is definitely not discouraging it). The language I have in mind is a basic (lazy?) statically-typed pure functional programming language with do notation and records (i.e. mostly Haskell-lite).

I have other ideas I’d like to explore as well, but mainly, I want the compiler to be so fast (w/ optimisations) that 
 ⌘ Read more

​ Read More

plwm: X11 window manager written in Prolog
plwm is a highly customizable X11 dynamic tiling window manager written in Prolog. Main goals of the project are: high code & documentation quality; powerful yet easy customization; covering most common needs of tiling WM users; and to stay small, easy to use and hack on. ↫ plwm GitHub page Tiling window managers are a dime-a-dozen, but the ones using a unique or uncommon programming language do tend to stand out. ⌘ Read more

​ Read More

JubilejnĂœch 280 rokov prĂ­chodu SlovĂĄkov do Petrovca
Báčsky Petrovec sa v dƈoch 22. aĆŸ 25. mĂĄja 2025 niesol v slĂĄvnostnej atmosfĂ©re pri prĂ­leĆŸitosti DnĂ­ Petrovca a vĂœznamnĂ©ho jubilea – 280. vĂœročia prĂ­chodu SlovĂĄkov do tejto vojvodinskej slovenskej osady. Program bol tradične bohatĂœ a počas troch dnĂ­ ruĆĄno bolo nielen v Miestnom spoločenstve, ale aj v Turistickej organizĂĄcii Obce Báčsky Petrovec, v MĂșzeu vojvodinskĂœch SlovĂĄkov, v Spolku PetrovskĂœch ĆŸien, na NĂĄmestĂ­ 
 ⌘ Read more

​ Read More
In-reply-to » @kat I don’t like Golang much either, but I am not a programmer. This little site, Go by example might explain a thing or two.

One of the nicest things about Go is the language itself, comparing Go to other popular languages in terms of the complexity to learn to be proficient in:

​ Read More

Google’s “AI” is convinced Solaris uses systemd
Who doesn’t love a bug bounty program? Fix some bugs, get some money – you scratch my back, I pay you for it. The CycloneDX Rust (Cargo) Plugin decided to run one, funded by the Bug Resilience Program run by the Sovereign Tech Fund. That is, until “AI” killed it. We received almost entirely AI slop reports that are irrelevant to our tool. It’s a library and most reporters didn’t even bother to read the rules or even look at what the intend 
 ⌘ Read more

​ Read More

10 Most Devastating Computer Viruses
Long before computers made their way into workplaces and homes everywhere, people theorized about a destructive kind of program that could replicate itself and spread between networked machines. In the 1980s and early 1990s, those programs became popularly known as “computer viruses.” You’ve probably had one at some point. All it takes is one wrong [
]

The post [10 Most Devastating Computer Viruses](https://listverse.com/2025/05/19/10-most-devastating-comput 
 ⌘ Read more

​ Read More

What were the MS-DOS programs that the moricons.dll icons were intended for?
Last time, we looked at the legacy icons in progman.exe. But what about moricons.dll? Here’s a table of the icons that were present in the original Windows 3.1 moricons.dll file (in file order) and the programs that Windows used the icons for. As with the icons in progman.exe, these icons are mapped from executables according to the information in the APPS.INF file. ↫ Raymond Chen 
 ⌘ Read more

​ Read More

What Problems are Truly Technical, not Social?
Most “tech” problems (and solutions) seem social, with e.g. most newer startups relying on internal connections to gain real world adoption, otherwise blocked due to institutional apathy and bad regulations (sms 2fa, hospital faxes
)

A recent (unlocated) poll asked a similar question: “what percent of workers in the software industry are employed writing programs that should not exist?” While we do have NP-hard problems, politically hard problems like avoi 
 ⌘ Read more

​ Read More

Rust celebrates ten year anniversary with Rust 1.87.0 release
I generally don’t pay attention to the releases of programming languages unless they’re notable for some reason or another, and I think this one qualifies. Rust is celebrating its ten year anniversary with a brand new release, Rust 1.87.0. This release adds anonymous pipes to the standard library, inline assembly can now jump to labeled blocks in Rust code, and support for the i586 Windows target has been rem 
 ⌘ Read more

​ Read More

Using AI to build a tactical shooter
This video demonstrates a nice mental model of how to structure AI assisted programming for building prototypes (planning stage and implementation stage), how to increase speed by varying the input (audio vs. text), along with different smaller tactics to improve the process.

Comments ⌘ Read more

​ Read More

I have zero mental energy for programming at the moment. đŸ«€

I’ll try to implement the new hashing stuff in jenny before the “deadline”. But I don’t think you’ll see any texudus development from me in the near future. â˜č

​ Read More
In-reply-to » tar and find were written by the devil to make sysadmins even more miserable

@kat@yarn.girlonthemoon.xyz @prologic@twtxt.net Given that all these programs are super old (tar is from the late 1970ies), while trying to retain backwards-compatibilty, I’m not surprised that the UI isn’t too great. đŸ€”

find has quite a few pitfalls, that is very true. At work, we don’t even use it anymore in more complex scenarios but write Python scripts instead. find can be fast and efficient, but fewer and fewer people lack the knowledge to use it 
 The same goes for Shell scripting in general, actually.

​ Read More