Programming

20943 readers
29 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 [email protected]



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
19
Project Gemini FAQ (geminiprotocol.net)
submitted 1 day ago* (last edited 1 day ago) by [email protected] to c/[email protected]
 
 

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.

3
 
 

I don't have much to say, only that I expected flutter to be a bloated fragile abstraction on top of different native GUI APIs, but no.

It's quite fast, relatively easy to develop and it just works.

I'm working on a desktop app that needs a high-perf rust impl, and (for now) flutter looks like a much better choice than tauri.

4
 
 

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

5
6
14
submitted 2 days ago* (last edited 2 days ago) by [email protected] to c/[email protected]
 
 

This is like a clean, simple reincarnation of make. And it is fascinating how it works:

Make is essentially a configuration file which textually describes a directed graph (DAG) of dependencies by their path names, together with embedded shell command lines which build each dependency.

This works more or less well, but if some dependency is missing, one has to add "make clean" commands. Or maybe, just to be sure, "make clean" (which would not be necessary if the tool really unambigously defined the build). Or for example if a system library has changed. Or if an optional dependency appears which was not there before.

And it becomes more complex if build steps run in parallel. Therefore, things like "make config" and so on are needed.

D.J. Bernstein examined these ill-defined cases, and came up with an alternative system, which he called "redo".

Redo turns this inside-out: It uses real shell scripts for building stuff, together with special shell commands that define dependencies. And these commands have dependencies as input, they can for example use what the compiler tells them. (The background is that e.g. in a complex C project with lots of #defines, only the C compiler has a precise picture what it needs). The top-level command runs all these build scripts in the right order. (In fact, they could also be written in Lisp, Java or Guile or whatever, as long as they support the common dependency-defining commands.)

The resulting system is surprisingly simple.

One quality for example is that in a source tree, definitions can be build recursively without any special provisions. No top-level Makefile required.

7
8
11
The Leo Text Editor's Home Page (leo-editor.github.io)
submitted 2 days ago* (last edited 2 days ago) by [email protected] to c/[email protected]
 
 

This is a very interesting but not well-known editor.

Some unusual features it has:

  • it is centered around outlines, this means one can divide a larger source code document into several or many smaller parts
  • it supports generation of output files from such outlines - and can read them back
  • it supports literate programming in a very nice way, and is a bit easier to use than org-mode
  • a section of an outline can appear more than one time in the directed graph of text segments - much like a hard-linked file can appear more than once in a directory tree. For example, one can use this to keep the same text in the on-line help of a CLI program, and in a long-form help document.

Personally, I have used it extensively to generate documentation for a large commercial library around signal processing. The fact that it supports an interlinked "DAG" of text elements made it easy to cross-reference and link important stuff. For exanple, I could maintain a glossary with footnotes, and I could also export it to a braindead ancient source control system called VisualSourceSafe - let a proofreader make changes, and then import it back in, keeping the structure, and merge the corrections via git.

Overall, it can do similar stuff like Emacs + Org-Mode, but while org-modes has a huge number of features, I'd say LEO is a tad simpler.

9
 
 

A high level overview on how zero-copy in iceoryx2 works.

10
15
submitted 3 days ago* (last edited 3 days ago) by [email protected] to c/[email protected]
11
 
 

Cross-posted from "What would be the best way to store the country of a user in SQL?" by @[email protected] in [email protected]


I use Gorm. This is the current code:

package main

import (
	"fmt"
	"log"

	"gorm.io/driver/sqlite"
	"gorm.io/gorm"
)

type Env struct {
	DB     *gorm.DB
	Logger *log.Logger
}

type User struct {
	ID           uint
	Username     string
	Name         string
	Email        string
	PasswordHash string
	Country      string //should probably be a foreign key of another table
}

func initDB() {
	env := &Env{}
	db, err := gorm.Open(sqlite.Open("gorm.db"), &gorm.Config{})
	if err != nil {
		fmt.Printf("Error opening database: %v", err)
		return
	}
	env.DB = db
	env.DB.AutoMigrate(&User{})

}

func main() {
	initDB()
}

As you can see in the comment in the code, I assume the best way would be to have a table of countries and then assign each user to one via a foreign key. However, it seems a bit cumbersome to manually create a list of all countries. Is there a better way to do this?

12
 
 

cross-posted from: https://lemmy.world/post/31184706

C is one of the top languages in terms of speed, memory and energy

https://www.threads.com/@engineerscodex/post/C9_R-uhvGbv?hl=en

13
 
 

I have created a new MIDI format to overcome both the limitations of the current one and the unwillingness of the International MIDI Consortium to develop a MIDI 2.0 file format. So I made my own for my game engine. I even added some primitive scripting features.

But here comes the big problem: now I need to develop an editor. While I created a textual representation of it, which is a weird mix of assembly with Lua influences and essentially musical notes and rhythm as values, but eventually it should have a full GUI editor.

The format so far has the following kind of commands:

  • Flow control commands
  • MIDI emit commands which can be either:
    • Note on and off commands
    • Velocity change (aftertouch)
    • Program change
    • Control change
    • Pitch bend
    • A few other less important commands (SysEx, etc.)
  • Commands for the scripting (Arithmetic commands on writable registers, compare and branch, etc.)
  • The ever important wait command, on which the whole system depends, as it tells the sequencer how much clock cycles have to wait between two commands

I have to process these commands for two display widgets, one displays the notes in a piano roll format, one displays any other commands. However, thanks to the way things work, I usually cannot just process MIDI commands directly. For example, notes are defined by a note-on and note-off event (often with aftertouch), no duration. And then comes editing. And then comes to editing around various wait commands. And then comes to editing around various conditional jump commands.

I started to work on a system that converted and separated each command for display, but it's a bit time consuming, and adds extra complexity. But modifying it a bit and adding a "transpiler" to the two systems would make editing pretty easy to implement. I already added "macro"-like features to the textual representation of the format. Could this work?

14
 
 

From their release page:

  • Updated to target Android 16 (SDK 36)
  • Fixed wallpaper download and apply for wallpapers in assets folder
  • Added support for storing the json file in assets folder
  • Updated dependencies
  • Added support for Global Icon Pack (thanks @RichardLuo0)
15
16
 
 

OC below by @[email protected]

What called my attention is that assessments of AI are becoming polarized and somewhat a matter of belief.

Some people firmly believe LLMs are helpful. But programming is a logical task and LLMs can't think - only generate statistically plausible patterns.

The author of the article explains that this creates the same psychological hazards like astrology or tarot cards, psychological traps that have been exploited by psychics for centuries - and even very intelligent people can fall prey to these.

Finally what should cause alarm is that on top that LLMs can't think, but people behave as if they do, there is no objective scientifically sound examination whether AI models can create any working software faster. Given that there are multi-billion dollar investments, and there was more than enough time to carry through controlled experiments, this should raise loud alarm bells.

17
18
19
20
21
22
 
 

edit: The game has been released on itch.io, see here: https://spenguin.itch.io/space-holes (exported for both Linux and Windows)

This is probably my first-ever high-effort game I made with Godot (or any engine, really...)! I've made all the sprites, tilesets, music, sfx, etc. by myself. (The music and sfx were generated using Jummbox and bfxr) And ofc I did all the programming myself too, with only the movement system borrowed from a different game that I never finished (can't waste that nice movement system! I don't want to re-program it again...) as well as the grass tileset (but the decorations on top are new)

I'm very proud of this and I think my pixel art skills have really improved :D

here are some more screenshots:

on earth in front of saturn rocket

wall jumping

in front of the event horizon

inside black hole

quiz, still falling in black hole

answer correct, still falling in black hole

spaghettification

final level, deciding whether to kill or spare the child

23
 
 

Vcc - the Vulkan Clang Compiler, is a proof-of-concept C and C++ compiler for Vulkan leveraging Clang as a front-end, and Shady our own research IR and compiler. Unlike other shading languages, Vcc aims to stick closely to standard C/C++ languages and merely adds a few new intrinsics to cover GPU features. Vcc is similar to CUDA or Metal in this regard, and aims to bring the advantages of standard host languages to Vulkan shaders.

Key Features

Vcc supports advanced C/C++ features usually left out of shading languages such as HLSL or GLSL, in particular raising the bar when it comes to pointer support and control-flow:

  • Unrestricted pointers
    • Arithmetic is legal, they can be bitcasted to and from integers
  • Generic pointers
    • Generic pointers do not have an address space in their type, rather they carry the address space as a tag in the upper bits.
  • True function calls
    • Including recursion, a stack is implemented to handle this in the general case
  • Function pointers
    • Lets you write code in a functional style on the GPU without limitations
  • Arbitrary goto statements - code does not need to be strictly structured !

Many of these capabilities are present in compute APIs, but are not supported in most graphics APIs such as DirectX or Vulkan. We aim to address this gap by proving these features can and should be implemented. More on why we think that’s important.

24
 
 

Introducing Dim – a new framework that brings React-like functional JSX-syntax with JS. Check it out here:

🔗 Project: https://github.com/positive-intentions/dim

🔗 Website: https://dim.positive-intentions.com/

My journey with web components started with Lit, and while I appreciated its native browser support (less tooling!), coming from ReactJS, the class components felt like a step backward. The functional approach in React significantly improved my developer experience and debugging flow.

So, I set out to build a thin, functional wrapper around Lit, and Dim is the result! It's a proof-of-concept right now, with "main" hooks similar to React, plus some custom ones like useStore for encryption-at-rest. (Note: state management for encryption-at-rest is still unstable and currently uses a hardcoded password while I explore passwordless options like WebAuthn/Passkeys).

You can dive deeper into the documentation and see how it works here:

📚 Dim Docs: https://positive-intentions.com/docs/category/dim

This project is still in its early stages and very unstable, so expect breaking changes. I've already received valuable feedback on some functions regarding security, and I'm actively investigating those. I'm genuinely open to all feedback as I continue to develop it!

25
 
 

Repository was archived?

view more: next ›