1
6
submitted 36 minutes ago by [email protected] to c/[email protected]

Some of you may have come across Helix - a very fast editor/IDE. Unfortunately, Helix has its own set of keybindings, modeled after Kakoune.

This was the one problem holding me back from using this excellent editor, so I soft-forked the peoject to add Vim keybindings. Now, two years later, I realize this might interest others as well, so here we go:

https://github.com/usagi-flow/evil-helix

I‘d be happy to polish the fork - which I carefully keep up-to-date with Helix‘s master branch for now. So let me know what you think!

And yes, I‘m also looking for a more original name.

2
18
submitted 2 hours ago by [email protected] to c/[email protected]
3
12
submitted 4 hours ago by [email protected] to c/[email protected]
4
50
submitted 13 hours ago by [email protected] to c/[email protected]

Not sure if this is the right community, but I didn't see a general one. What search engine do you use? Besides Google increasingly spying on its users, the quality of its search results seems to have gotten significantly worse over the last decade. What search engine(s) do you use?

5
65
submitted 18 hours ago by [email protected] to c/[email protected]

In this letter, Dijkstra talks about readability and maintainability in a time where those topics were rarely talked about (1968). This letter was one of the main causes why modern programmers don't have to trouble themselves with goto statements. Older languages like Java and C# still have a (discouraged) goto statement, because they (mindlessly) copied it from C, which (mindlessly) copied it from Assembly, but more modern languages like Swift and Kotlin don't even have a goto statement anymore.

6
12
submitted 22 hours ago* (last edited 21 hours ago) by [email protected] to c/[email protected]

Solution was quite easy. Thanks to the user reply here: beehaw.org/comment/3535588 or programming.dev/comment/10034690 (Not sure if the links actually work as expected...)


Hi all. I have a little problem and don't know how to solve. A CLI program in Python is broken since Python 3.12. It was working in Python 3.11. The reason is, that Python 3.12 changed how subclassing of a pathlib.Path works (basically fixed an issue), which now breaks a workaround.

The class in question is:

class File(PosixPath):
    def __new__(cls, *args: Any, **kwargs: Any) -> Any:
        return cls._from_parts(args).expanduser().resolve()  # type: ignore

    def __init__(self, source: str | Path, *args: Any) -> None:
        super().__init__()
        self.__source = Path(source)

    @property
    def source(self) -> Path:
        return self.__source

    @property
    def modified(self) -> Time:
        return Time.fromtimestamp(os.path.getmtime(self))

    @property
    def changed(self) -> Time:
        return Time.fromtimestamp(os.path.getctime(self))

    @property
    def accessed(self) -> Time:
        return Time.fromtimestamp(os.path.getatime(self))

    # Calculate sha512 hash of self file and compare result to the
    # checksum found in given file. Return True if identical.
    def verify_sha512(self, file: File, buffer_size: int = 4096) -> bool:
        compare_hash: str = file.read_text().split(" ")[0]
        self_hash: str = ""
        self_checksum = hashlib.sha512()
        with open(self.as_posix(), "rb") as f:
            for chunk in iter(lambda: f.read(buffer_size), b""):
                self_checksum.update(chunk)
            self_hash = self_checksum.hexdigest()
        return self_hash == compare_hash

and I get this error when running the script:

Traceback (most recent call last):
File "/home/tuncay/.local/bin/geprotondl", line 1415, in 
sys.exit(main())
^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1334, in main
arguments, status = parse_arguments(argv)
^^^^^^^^^^^^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1131, in parse_arguments
default, status = default_install_dir()
^^^^^^^^^^^^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1101, in default_install_dir
steam_root: File = File(path)
^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 97, in __new__
return cls._from_parts(args).expanduser().resolve()  # type: ignore
^^^^^^^^^^^^^^^
AttributeError: type object 'File' has no attribute '_from_parts'. Did you mean: '_load_parts'?

Now replacing _from_parts with _load_parts does not work either and I get this message in that case:

Traceback (most recent call last):
File "/home/tuncay/.local/bin/geprotondl", line 1415, in 
sys.exit(main())
^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1334, in main
arguments, status = parse_arguments(argv)
^^^^^^^^^^^^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1131, in parse_arguments
default, status = default_install_dir()
^^^^^^^^^^^^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1101, in default_install_dir
steam_root: File = File(path)
^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 97, in __new__
return cls._load_parts(args).expanduser().resolve()  # type: ignore
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/pathlib.py", line 408, in _load_parts
paths = self._raw_paths
^^^^^^^^^^^^^^^
AttributeError: 'tuple' object has no attribute '_raw_paths'

I have searched the web and don't understand how to fix this. Has anyone an idea what to do?

7
35
submitted 1 day ago by [email protected] to c/[email protected]
8
90
submitted 2 days ago by [email protected] to c/[email protected]
9
25
submitted 3 days ago* (last edited 3 days ago) by [email protected] to c/[email protected]

Can someone please help me understand how one could make his own frontend for the Ferdiverse? It seems like to run on a bespoke protocol, and has HTTP endpoints as well. The help says you can create your own frontend, divorced of HTTP. What I am wary of is the documentation being out-of-date.

So if there's a bespoke protocol, is there a middleware that translates it to HTTP requests to make it possible to run on a browser? Sorry I am very bad at web and network in general.

So to sum my question up:

1- Is there a bespoke protocol, non-HTTP, to access Fediverse?

2- Where can I lay my hands on the latest documentation for creeating a custom frontend, especially one that runs on a non-traditional 'view'?

Sorry if I mention the bespoke protocol for the third time, but what is the use of such protocol? Like is there a client for it? Or do they just mean a protocol ON TOP of HTTP? Because it would be moot. If there's an HTTP protocol I could just use libcurl. If this protocol is as 'bespoke' as they say, is it well-described? Like do they have ABNF for it?

Again I am not very good at network and web in general. This would be my first 'webapp' so to speak.

Even if such thing exists, I would wanna do it.

Thanks.

10
11
submitted 2 days ago by [email protected] to c/[email protected]

For some time now, I've been thinking about the concept of interactively manipulating mathematical expressions and equations via software. Like doing some quick algebra in Notepad or similar, except there's no potential for arithmetic/algebra errors, typos, etc. ruining any results.

At the same time, I also wanted to experiment a bit with zippers from functional programming. You need some way of specifying what (sub)expression to perform operations on, and it seemed like this kind of data structure could help with that.

And so, I made AlgeZip, a small proof-of-concept of the whole general idea. Although this polished Python version was completed only a few days ago, there were various other versions before this one in different languages and with worse-quality code. Instructions for things are on GitHub; requires Python 3.12 to run.

For simplicity, I decided to use boolean expressions instead of generic numeric algebraic expressions/equations, and only decided to include the minimum in terms of commands and functionality. From my understanding, it should be possible to transform any boolean expression into any other boolean expression in AlgeZip (without using the r! command except to set things up), though I could be wrong.

Thoughts, comments, and criticism on the idea as a whole, the program, or the source code are welcome, though I'm not sure if I'll be making any changes at this time.

11
40
submitted 3 days ago by [email protected] to c/[email protected]

I need to help auditing a project from another team.
I got the pointers on what's expected to be checked, but I don't have like templates for documents for what's expected from an audit report which also means I'm not sure what's the usual process to conduct an internal audit.
I mean I might as well read the whole repo, but maybe that's too much?

Any help or pointers on what I need to investigate to get started would be great!

12
77
submitted 4 days ago* (last edited 4 days ago) by [email protected] to c/[email protected]

So I've come to the point where I've wanted some to see some features on the software I regularly use and I feel confident enough that I can pull it off. However, once I start getting into it, it all becomes so overwhelming that it's hard to get anything done.

For instance, on more than one occasion I had trouble getting the projects to build on my machine (eg., unsupported OS, lack of documentation, etc.) and it left me unable to write a single line of code making the experience frustrating from all the time wasted that I had to move on.

Other times, I recognize some the patterns and get the general gist of some snippets, but the overall code seems so convoluted to me that I don't even know where to start to analyze a solution, even though if it'd probably take ten lines to implement.

For context, I've been more of a hobbyist programmer for the great majority of my life with a bit of schooling. I do have various finished apps under my belt so I'm definitely not new. But I have no reference for how long a feature should take to implement in someone else's code for the average Joe who does this for a living.

So I'm left wondering: What advice do you have that could make this all more accessible to someone like me? Do you have a general strategy to get started? How long does it take you from start to finish? And if you run into issues, where do you seek help without nagging the devs about their code who may take too long to respond to be of use?

Many thanks for the feedback in advance!

13
38
submitted 4 days ago by [email protected] to c/[email protected]

Thanks to the current SEO nightmare, I can no longer use search engines the same reliability as before. Stackoverflow is too toxic and often all I need is to properly look up some more obscure stuff about some API, which "could just be googled". AI, of course, is very unreliable.

Searching code on Github, then adjusting it in many ways to my needs (like to a different language, renaming variables to make more sense, additional optimizations, etc.) seems way more feasible nowadays. However, while there's a lot of code with very permitting licenses (including public domain licenses), others are not so much, and I don't want to argue against them, often I'm even understanding the reasons behind their decisions. I even try to give credit wherever I can, or look up the original source of an algorithm I find being referenced by someone else.

14
86
submitted 5 days ago by [email protected] to c/[email protected]

I've heard it thrown around in professional circles and how everybody's doing it wrong, so.. who actually does use it?

For smaller teams

"scaled" trunk based development

15
8
submitted 3 days ago by [email protected] to c/[email protected]

I used Pull Panda a while back to get organizational info and really good analytics on PRs.

Ever since GitHub bought the service and then killed it in 2022, I haven't really seen anything close to the level of analytics we got for that tool.

What is everyone using ATM?

16
145
submitted 6 days ago by [email protected] to c/[email protected]

Start learning at 50

I've always wanted to learn programming. I've read a blog post saying that at this age it was to late . Then I read a post here in saying the opposite. I've found a site that was learn x in y minutes where it has a bunch of languages there. After reading them, the languages that caught my attention were Julia, Clojure and Go. Are any of these good for a beginner or should I start with something else? I know what are variables, can spot an if/else statement but that's about it. What are some good resources for someone like me who likes to learn by doing things?

17
117
submitted 6 days ago by [email protected] to c/[email protected]
18
16
State of HTML 2023 (2023.stateofhtml.com)
submitted 4 days ago by [email protected] to c/[email protected]

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

State of HTML 2023

Results of the State of HTML 2023 Survey are out.

19
36
submitted 5 days ago* (last edited 5 days ago) by [email protected] to c/[email protected]

I feel like there are many devs out there who expose a lot of personal details and opinions all over the web. Maybe it's just me, but when starting out with the internet I tried my best to separate my personal details (name, age, sex, country, ethnicity, family ties, relationship status,...) from usernames in public.

Seeing devs do it willingly and voice opinions on divisive or sensitive topics kind of messes with me. Aren't y'all afraid of missing out on job opportunities if someone reads your opinions, code, or other stuff tied to your personal accounts? Or letting anybody (maybe family, friends, acquaintances, ...) in on your personal life, mindset, opinions and other personal information?

Anti Commercial-AI license

20
33
submitted 6 days ago by [email protected] to c/[email protected]

Video is nearly 3 years old now, but I think it's worth watching. Her presentation starts at around 2:30.

Basically, she explains how Redbean, a tiny (~450kb) and very fast C http server, works and how the same executable can be used to deploy it on most operating systems (she starts explaining that around 14:30)

Justine is also the mind behind Sector LISP, Lambda Calculus in 383 bytes, considerable optimizations to LLamaAI, plus several other things.

21
12
submitted 5 days ago by [email protected] to c/[email protected]
22
5
submitted 5 days ago by [email protected] to c/[email protected]

What is Test Coverage? Test Coverage vs Code Coverage What is the gap to have a true test coverage? How can tracing data improve test coverage? Relation between end-to-end tests and Tracing data Let's get our hands dirty with real code Write integration test using MockWebServer Write end-to-end tests without mocking interactions

23
0
submitted 3 days ago by [email protected] to c/[email protected]
24
13
submitted 1 week ago* (last edited 1 week ago) by [email protected] to c/[email protected]

Examples of an interesting computer programming paradigm.

25
12
submitted 1 week ago by [email protected] to c/[email protected]
view more: next ›

Programming

15853 readers
433 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 11 months ago
MODERATORS