501
5
It’s All Bullshit (thebaffler.com)
submitted 2 years ago by yogthos@lemmy.ml to c/programming@lemmy.ml
502
22

If you use a compiled language, you should periodically look at Godbolt and see what your code is doing and what changes to your code will do in the compiled output.

In this case a positively insane way of calculating squares and cubes generates 311 lines of ARM assembler output that will swallow your memory. With even something as simple as -O1 on the command line it's replaced by one or two multiplications respectively. With -fwhole-program it removes the functions entirely and interlaces them into the loop in main().

Know your tools. It makes huge differences!

503
7
submitted 2 years ago by yogthos@lemmy.ml to c/programming@lemmy.ml
504
4

Many thumbnail programs exist that will take a large image and reduce it to a thumbnail for you, often supporting working in batches. But what about turning user-uploaded images into thumbnails? Obviously, you don’t want to simply send a large image to the browser and have HTML resize it, because the quality wouldn’t be great, and your bandwidth would go through the roof. So you need something to handle this process on the fly, which is where this recipe comes in handy.

505
-12

Chat rooms and programming content

506
5
submitted 2 years ago by yogthos@lemmy.ml to c/programming@lemmy.ml
507
-4
submitted 2 years ago by yogthos@lemmy.ml to c/programming@lemmy.ml
508
-6
On repl-driven programming (mikelevins.github.io)
submitted 2 years ago by yogthos@lemmy.ml to c/programming@lemmy.ml
509
3
510
5
Gary Kildall Chats with Computer Language Magazine (computeradsfromthepast.substack.com)
submitted 2 years ago by JohnBlood@lemmy.ml to c/programming@lemmy.ml
511
8
submitted 2 years ago by JohnBlood@lemmy.ml to c/programming@lemmy.ml
512
-4
submitted 2 years ago by yogthos@lemmy.ml to c/programming@lemmy.ml
513
-8
submitted 2 years ago by cuenca@lemm.ee to c/programming@lemmy.ml

One needs to send 1 mln HTTP requests concurrently, in batches, and read the responses. No more than 100 requests at a time.

Which way will it be better, recommended, idiomatic?

  • Send 100 ones, wait for them to finish, send another 100, wait for them to finish… and so on

  • Send 100 ones. As a a request among the 100 finishes, add a new one into the pool. “Done - add a new one. Done - add a new one”. As a stream.

514
1
submitted 2 years ago by yogthos@lemmy.ml to c/programming@lemmy.ml
515
4
submitted 2 years ago by yogthos@lemmy.ml to c/programming@lemmy.ml
516
3
submitted 2 years ago by bahmanm@lemmy.ml to c/programming@lemmy.ml

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...
517
4
submitted 2 years ago by soenkehahn@lemmy.ml to c/programming@lemmy.ml

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

518
14
submitted 2 years ago by JRepin@lemmy.ml to c/programming@lemmy.ml

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.

519
-5
submitted 2 years ago by yogthos@lemmy.ml to c/programming@lemmy.ml
520
2

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

521
7
submitted 2 years ago by soenkehahn@lemmy.ml to c/programming@lemmy.ml

A software project management tool based on nix

522
5
submitted 2 years ago by yogthos@lemmy.ml to c/programming@lemmy.ml
523
5
Grokking Huffman Coding (open.substack.com)
submitted 2 years ago by overflow64@lemmy.ml to c/programming@lemmy.ml
524
7
submitted 2 years ago by bahmanm@lemmy.ml to c/programming@lemmy.ml

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
525
10
submitted 2 years ago by bahmanm@lemmy.ml to c/programming@lemmy.ml

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:

view more: ‹ prev next ›

General Programming Discussion

10014 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 7 years ago
MODERATORS