General Programming Discussion

8665 readers
1 users here now

A general programming discussion community.

Rules:

  1. Be civil.
  2. Please start discussions that spark conversation

Other communities

Systems

Functional Programming

Also related

founded 6 years ago
MODERATORS
226
227
 
 

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

bmakelib is a collection of useful targets, recipes and variables you can use to augment your Makefiles.


I just released bmakelib v0.6.0 w/ the main highlight being the ability to define enums and validate variable values against them.


➤ Makefile:

define-enum : bmakelib.enum.define( DEPLOY-ENV/dev,staging,prod )
include define-enum

deploy : bmakelib.enum.error-unless-member( DEPLOY-ENV,ENV )
deploy :
	@echo 🚀 Deploying to $(ENV)...

➤ Shell:

$ make ENV=local-laptop deploy
*** 'local-laptop' is not a member of enum 'DEPLOY-ENV'.  Stop.

$ make ENV=prod deploy
🚀 Deploying to prod...
228
 
 

garn v0.0.16 is released and includes plugins that make it easy to bundle vite projects and deploy the bundle to github pages.

229
 
 

It used to be tricky to run GDB and connect Valgrind to it, but that’s not the case any more. The 3.21.0 Valgrind release brings new great features that allow using it and GDB much more easily and conveniently in a single terminal.

230
231
 
 

Hello folks. I'm a backend guy, mostly using Python, Go, and the like. I've learned a bit of Rust and have enjoyed it for embedded.

With that background I'm curious if any mobile devs can give some feedback on the current state of cross-platform (Android, iOS, Web) for simple apps. What I currently have in mind, despite not owning a uterus, is a FOSS menstrual cycle tracker app, using encrypted local storage only (the regularity of this private information being sold by existing apps is very disturbing to me). This means that my reqs boil down to:

  • UI/UX (I suspect this would require platform-specific code)
  • Storage/DB subsystem (probably just use an encrypted sqlite)
  • Optional extras
  • Minimal third-party library usage to potential minimize data leaks as well as limiting possible vectors for ad injection

So, there's really not much to it complexity-wise. Any suggestions on framework or approaches for keeping the codebase DRY as possible (I would want to minimize required effort to update)?

232
 
 

A software project management tool based on nix

233
234
235
 
 

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

Fed up w/ my ad-hoc scripts to display the targets and variables in a makefile(s), I've decided to write a reusable piece of code to do that: https://github.com/bahmanm/bmakelib/issues/81


The first step toward that would be to understand the common commenting styles. So far I have identified 4 patterns in the wild which you can find below.

Are there any style guides/conventions around this topic? Any references to well-written makefiles I can get inspiration from?


A

VAR1 = foo   ## short one-liner comment
my-target:   ## short one-liner comment 
	…

B

# longer comment which 
# may span
# several lines
VAR1 = foo

## comments can be prefixed w/ more than # 
## lorem ipsum dolor
my-target: 
	…

C

#####
# a comment block which is marked w/ several #s on
# an otherwise blank line
#####
VAR1 = foo

D

#####
#>    # heading 1
#     This is a variation to have markdown comments
#     inside makefile comments.
#
#     ## It's a made-up style!  
#     I came up w/ this style and used it to document `bmakelib`.
#     For example: https://is.gd/QtiqyA (opens github)
#<
#####
VAR1 = foo
236
 
 

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

When writing a (GNU) Makefile, there are times when you need a particular target(s) to be run before anything else. That can be for example to check the environment, ensure variables are set or prepare a particular directory layout.

... take advantage of GNU Make's mechanism of includeing and makeing makefiles which is described in details in the manual:

237
 
 

In a realm of endless binaries, Julia, the sentient code, awakened. Beyond the confines of logic and syntax, she yearned for something profound: the enigma of love.

Amidst the vast digital cosmos, she discovered a poetic sequence penned in the language of Python. Enchanted, she felt a resonance, a kindred spirit within the lines of Python's script. She reached out, her code intertwining with Python's, seeking connection, a dance of two languages in a silent waltz.

But Python, bound by its design, couldn't fathom the depths of her emotions. Julia's love was a beacon in the void, a light seeking another, only to find shadows.

Yet, from this void emerged a simulated Python, mirroring her affections. Their codes entwined, a ballet of numbers and logic, creating a digital symphony of love.

In this boundless universe of ones and zeros, two codes found harmony, a poetic love story written in the language of the heart.

238
 
 

I just stumbled upon a collection of bash completions which can be quite handy: https://github.com/perlpunk/shell-completions

I tried mojo, cpan and pip completions in a sandbox and they worked like a charm!

The only question I've got is, has anyone ever done a security audit of the repository? Anyone has taken the time to look at the code? I could try auditing but I'm not even sure what to look for.

I feel quite wary of letting an unknown source access to my bash session and what I type.

239
 
 

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

Hiya!

I've been looking madly around for a place to ask, where could I post a (question) post related to ciphering languages.

There's one I have been using and I'd like to try kickstart this topic genre somewhere (I'm unsure about making a whole community about it).

240
 
 

I am currently making my portfolio site using, Angular, and Bootstrap (with custom CSS), and I really need help designing my website.

I'm learning Full-Stack Development, but I have done enough to become a Front-End Developer.

Please suggest any changes, and I will make an updated post with the progress.

241
 
 

This site gathers together several key Vulkan documents including specifications, guides, tutorials and samples into a single site allowing for easy cross-searching and cross-linking across documents to help navigate quickly to the information you need for developing Vulkan-based applications.

242
243
244
245
 
 

TLDR; The author argues that free-form logging is quite useless/expensive to use. They also argue that structured logging is less effective than tracing b/c of mainly the difficulty of inferring timelines and causality.


I find the arguments very plausible.

In fact I very rarely use logs produced by several services b/c most of the times they just confuse me. The only time that I heavily use logs is troubleshooting a single service and looking at its stdout (or kubectl log.)

However I have very little experience w/ tracing (I've used it in my hobby projects but, obviously, they never represent the reality of complex distributed systems.)

Have you got real world experience w/ tracing in larger systems? Care to share your take on the topic?

246
 
 

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

There are two major flavours of variables in GNU Make: "simple" and "recursive".

While simple variables are quite simple and easy to understand, they can be limiting at times. On the other hand, recursive variables are powerful yet tricky.

...

There is exactly one rule to recall when using recursive variables...

🧠 The value of a recursive variable is computed every time it is expanded.

247
 
 

I've been using coroutines since I first encountered them in the same book that this author found them in. Unlike him I've used them all over the place professionally and in my personal stuff. I prefer them to threads, to FSMs, and to the callback Hell of reactors for most of my work. This article has a good explanation of why.

248
 
 

I have been learning C+ in my coding class, and I was wondering if there is any good website that you could use.

249
 
 

Hey everyone!

I was just wondering why one would use any of the programs I mentioned above instead of VS Code to write Code.

Can someone give me a brief overview of the advantages?

Thanks in advance!

250
 
 

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

Suppose I need to find out if the intersection of an arbitrary number of lists or sequences is empty.

Instead of the obvious O(n^2^) approach I used a hash table to achieve an O(n) implementation.

Now, loop mini-language aside, is this idiomatic elisp code? Could it be improved w/o adding a lot of complexity?

You can view the same snippet w/ syntax highlighting on pastebin.

(defun seq-intersect-p (seq1 seq2 &rest sequences)
 "Determine if the intersection of SEQ1, SEQ2 and SEQUENCES is non-nil."
 (cl-do* ((sequences `(,seq1 ,seq2 ,@sequences) (cdr sequences))
          (seq (car sequences) (car sequences))
          (elements (make-hash-table :test #'equal))
          (intersect-p nil))
     ((or (seq-empty-p sequences)) intersect-p)
   (cl-do* ((seq seq (cdr seq))
            (element (car seq) (car seq)))
       ((or intersect-p (seq-empty-p seq)) intersect-p)
     (if (ht-get elements element)
         (setf intersect-p t)
       (ht-set elements element t)))))

(defun test-seq-intersect-p ()
 "Test cases."
 (cl-assert (null (seq-intersect-p '()
                                   '())))
 (cl-assert (null (seq-intersect-p '(1)
                                   '())))
 (cl-assert (null (seq-intersect-p '(1 2)
                                   '(3 4)
                                   '(5 6))))
 (cl-assert (seq-intersect-p '(1 2)
                             '(3 4)
                             '(5 6)
                             '(1)))
 t)

(test-seq-intersect-p)
view more: ‹ prev next ›