General Programming Discussion

8707 readers
56 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
326
327
 
 

I have a fundamental knowledge of C and I am wanting to get better at understanding C. here is an example of what I'm looking for. I write random programs to try and challenge my self with help from the man pages, for example i'm trying to create my own Linux shell right now, but I feel as i'm just using functions and not understanding what's happening when I use them, the article that I linked helped me understand what was going on with scanf and fgets more, and I'm looking for similar articles.

328
 
 

In an era where developers are increasingly expected to handle operations tasks, this InfoWorld article discusses the growing discontent among developers and operations specialists. The 'You build it, you run it' model has led to overwhelming responsibilities and created bottlenecks due to different skill sets. The article suggests that a shift in responsibilities could be the solution, where developers have more control over development and testing environments without being fully responsible for production. It also discusses the rise of Site Reliability Engineering (SRE) as a popular solution to balance developer velocity and operational stability. Interested to hear your thoughts on this topic!

329
 
 

I am often wondering if large webservices can run on old-school monolithic relational databases. It would be great because being able to simply model your applications data model as a set of SQL tables with strong constraints about data types and relations has huge benefits. But a single computer can only have that many cores and that much memory, so how far do modern monolithic database systems actually scale? And is Postgres going to be enough for Lemmy?

I stumbled upon the linked article on twitter. And it seems impressive. They are running their two billion dollar IT business on one single managed postgres instance. They started to migrate away from that when they hit the two billion mark in 2020. But instead of choosing a NoSQL system, they chose to stick with Postgres. They split groups of tables into different database instances.

Given that a two billion dollar company can run on a single Postgres instance like that, I have high hopes that no Lemmy instance will ever hit a limit with that.

At the moment it seems though that some parts of lemmy use Postgres in an inefficient way, so there may be some engineering necessary. But in the end I am positive that even an instance with 100k users should be able to run lemmy as it is, with a single postgres instance.

330
331
332
 
 

For context, Im used to working in MVC with .net core for webdev, which has everything all nicely contained within VS for better or worse. I believe Lemmy uses react.js and rust from a cursory glance, but im not quite sure what exactly is best. Im also curious what db software it would use

Im also curious on how a testing environment would work for this. I imagine youd have to host your own instance to test any changes to have access to data, but theres a lot here that honestly I dont know much about.

Is there any posts or documentation anywhere that would be a good guide to getting started on this sort of thing? I doubt development is going to be as seamless as developing in Visual Studio where everything is all from the same company, but Id imagine that there are particular ides that work better with the types of tools that manage this

333
 
 

Idea: Scrape all the posts from a subreddit as they're being made, and "archive" them on a lemmy instance, making it very clear it's being rehosted, and linking back to the original. It would probably have to be a "closed" lemmy instance specifically for this purpose. The tool would run for multiple subreddits, allowing Lemmy users to still be updated about and discuss any potential content that gets left behind.

Thoughts? It's probably iffy copyright-wise, but I think I can square my conscience with it.

334
 
 

I've been working on re-implementing a board game in C. However, when running the players positions don't increment.
Current output:

 6,  9,  7,  6,  5,  5,  8,  7
 6,  9,  7,  6,  5,  5,  8,  7

Expected output:

 6,  9,  7,  6,  5,  5,  8,  7
14, 15, 19, 16, 13, 13, 14, 17

Code:

#include <stdlib.h>
#include <stdio.h>

// Define types here:
typedef enum {false, true} bool;

// Define constants here:
const unsigned char MAXPLAYERS = 7;	//Game has max of 8 players
const unsigned char SPACES = 40;	//Board has 40 spaces
const unsigned int SEED = 51732;	//Seed for random numbers
const unsigned int DIE = 6;		//Number of sides of die

// Define variables here:
unsigned char player = 0;
unsigned char player_position [] = {0, 0, 0, 0, 0, 0, 0, 0};
unsigned char die = 0;

// Define functions here:
// Moves player Input spaces.
void move_player (char moves) {

player_position [player] += moves;
if (player_position [player] > SPACES) {

	player_position [player] -= SPACES;

}

}

// Switches active player in order.
void increment_player () {

player ++;

if (player > MAXPLAYERS) {

player = 0;

}

}

// Returns random number between 1 - Input.
unsigned char rand_num (unsigned char max) {

unsigned char i;

i = rand () % max + 1;

return (i);

}

// Sets dice variable && returns 1 if double.
bool roll_dice () {

unsigned char a = rand_num (DIE);
unsigned char b = rand_num (DIE);

die = a + b;

return (0);

}

// Main logic
int main () {

char input = 0;

srand (SEED);
printf ("Game client started.\n",
	"Press enter to iterate turns.\n");

while (1) {

scanf ("%c", &input);

for (unsigned char i; i <= MAXPLAYERS; i++) {

	roll_dice ();
	move_player (die);

	increment_player ();

}

printf ("%2i, %2i, %2i, %2i, %2i, %2i, %2i, %2i\n",
	player_position [0], player_position [1], player_position [2],
	player_position [3], player_position [4], player_position [5],
	player_position [6], player_position [7]);

}

return (0);

}
335
 
 

I was looking into hover, namecheap, and google domains.
This is the first time I'm looking into this so ELI5.

Is any one better than the others?
Would I find issues with different DNS set in my pi-hole?

336
 
 

Learn how the grandfather of most major compression algorithms, LZ77, works!

337
338
339
 
 

First off, I'm totally new here (Reddit refugee).

But I guess we will see an endless September after July 1st.

How can we (I?) create an "onboarding" server? or in my case: a lemmy server for (people interested in) programmimg.

Let's say I have some (pick one


or all):

  • digital ocean droplet (vps)
  • herzner vps
  • k8s cluster
  • ...you get the point

How do I get my foo.bar Lemmy server running?

  • is there a docker-compose.yml or helm chart to get the services running on my droplet/cluster?
  • how do i connect my server to other lemmy servers in the fediverse?
  • are moderation tools available, or do i have to build them on my own? (are there existing repos i can join, to prevent reinventing the wheel)
  • is there documentation available for that? If not: on what repo can I make pull requests for improving the docs? (i like writing my documentation in markdown + "material for mkdocs" that generates the github/gitlab/whatever pages)

thanks in advance :thumbs-up:

340
341
342
343
344
 
 

I really like the part where she talks about randomly remembering things looking like magic. I'm 15 odd years into my career now and large part of my debugging approach is that same kind of "randomly remember something relevant" magic that I can't teach the junior engineers I work with.

345
346
347
348
349
350
view more: ‹ prev next ›