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
26
 
 

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.

27
 
 

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.

28
29
30
1
The Leo Text Editor's Home Page (leo-editor.github.io)
submitted 2 weeks ago* (last edited 2 weeks ago) by HaraldvonBlauzahn@feddit.org to c/programming@programming.dev
 
 

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.

31
 
 

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

32
33
 
 

Cross-posted from "What would be the best way to store the country of a user in SQL?" by @lena@gregtech.eu in !learn_programming@programming.dev


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?

34
 
 

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?

35
 
 

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

36
 
 

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)
37
 
 

OC below by @HaraldvonBlauzahn@feddit.org

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.

38
39
40
41
42
43
 
 

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

44
 
 

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.

45
 
 

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!

46
 
 

Repository was archived?

47
48
1
submitted 4 weeks ago* (last edited 4 weeks ago) by HaraldvonBlauzahn@feddit.org to c/programming@programming.dev
 
 

What I think in addition to what Atkinso writes: If you just strip arbitrary bytes that happen to be equal in value to the numeric value of ASCII control characters or whitespace, how can you be sure that you don't destroy valid non-whitespace unicode symbols?

You can't! This will work only of you have actually ASCII input.

49
50
 
 

Guys, need opinion!

I am an indie dev, a student (still in school), trying to think of ways to earn with just my laptop, internet, and programming skills, any ways as part of my journey I have developed several apps, now as an indie creator with practically no capital, and just reddit and facebook for marketing, should one explore this world of selling apps, your opinion and tips are highly valued so please do comment

P.S I have linked the types of apps I have that I could set up of sale, if you have any feedback on it, do tell https://muhammadj.gumroad.com/l/wifipassfinder

view more: ‹ prev next ›