lainchan / λ
The Beginner's General
λx.x · 2024-11-25 13:00
This is the Beginner's General for beginners' questions.
If any of you have a simple question, and a suitable thread doesn't already exist, just post it here and someone will probably try to answer it.
Remember to do some research before asking a question; no one wants to answer a question that a simple search can already resolve
Old thread: >>37650
Roy Batty · 2024-11-26 05:05
Is it reasonable to do localization and internationalization for dates and timezones using GeoIP2, or is the accuracy too far off even for this task. Am working on a small trello board that might morph into an LMS or SIS and would like to localize the dates and times without having to wait for the client side to send me such information.
Neuromancer · 2024-11-27 10:30
>>40487
>localization and internationalization for dates and timezones using GeoIP2
Found a better solution: localize and internationalization using Accept-Language HTTP header, and handle the timezones client side by traversing all the UTC time elements creating Date() objects and running toLocaleTimeString(). This should give perfect accuracy, while not requiring any additional requests; only downside is a little bit of JavaScript.
sizeof · 2024-11-27 13:13
>>40487
>>40494
Won't be making this thread a development log as might have a reputation for doing elsewhere, but will say that this solution did not work out as desired. Basically the localization works great, but because timezones can move a card from one day to the next this information is needed for the server-side rendering. My original question is then still open.
Lady 3Jane.. · 2024-11-27 15:13
>>40495
And it's closed again, the key is to redirect on load without GET parameters specifying the timezone to one which is and then handle everything server-side. This is two requests, but doesn't require the user to be using Javascript, nor does it need to be run everytime the page is loaded.
Dujour · 2024-12-03 17:32
Good book for learning beyond the basic mechanics? I don't know where to get started writing an actual real program.
Nameless · 2024-12-04 11:37
C question here.
why are they telling me to use size_t for an array index at my C uni programming course? i get that it's unsigned, but isn't size_t the type specifically made to be returned by sizeof? shouldn't i use an unsigned long instead (or unsigned int which is 4 instead of the 8 bytes of both size_t and unsigned long)?
isn't it also harder to do pointer arithmetics on an array with a size_t?
Ender · 2024-12-04 13:25
>>40572
>pointer math
just works on index [stride] instead of byte positions, size_t is fine as any other pointer sized integer.
Sigmoid functions have small ranges of input/output values [0..255], so lookup tables seem to be the best[only?] optimization method. Asside from hardware based solutions it seems like eveyone is fie with AI running like crap. What am i missing? Like, Tensorflow is just trusting the compiler to inline their functions [but it doesn't], so instead of just a single MOV [LuT] we have stack frame construction, [2] CPU cache invalidations [w/ microcode compilation], etc.
Is evoryone keeping quick AI code out of open source or what?
Neuromancer · 2024-12-04 13:36
#include <stdlib.h>
#include <stdio.h>
void swap_three(double* p0, double* p1, double* p2){
double* temp;
*temp = *p0;
*p0 = *p1;
*p1 = *p2;
*p2 = *temp;
printf("test: p0: %f p1: %f p2: %f\n", *p0, *p1, *p2);
}
int main (void){
double just = 23, testing = 24, things = 25;
swap_three(&just, &testing, &things);
swap_three(&just, &testing, &things);
swap_three(&just, &testing, &things);
return EXIT_SUCCESS;
}
//Program received signal SIGSEGV, Segmentation fault.
///usr/src/debug/glibc/glibc/elf/dl-call_fini.c...
//_dl_call_fini (
//closure_map=closure_map@entry=0x7ffff7ffe2e0) at dl-call_fini.c:43
//43 ((fini_t) array[sz]) (); This runs fine but segfaults on exit with the details posted above (provided by gdb). Any help understanding why? It's more for curiosity than anything else.
Project 2501 · 2024-12-04 13:56
>>40575
Never mind please pretend this post didn't happen :(
Lukasiewicz · 2024-12-07 13:03
what programming languages and/or projects would be good for a beginner? i am obsessed with the idea of programming but i have no idea where to start
Hacker · 2024-12-07 22:18
>>40617
Not to be rude, but this is a good question to ask chatgpt
You're more likely going to want to start with a course or textbook to learn the basics. Pick that course or textbook based on what you want to make. If you want to process text files, spreadsheets, automate stuff on your PC use python. If you want to make websites use javascript. If you want to learn programming fundamentals probably C or C++. If you want to make 2d games again python is decent. If you want to make 3d games C++ or C#.
Colmerauer · 2024-12-07 23:08
>>40617
Hi, this is ChatGPT. Start with Python and C. Write something simple that you'll actually use yourself, like a text editor. That way you'll keep improving it and adding new things to it as you learn them. ChatGPT never lies.
cond · 2024-12-08 00:32
>>40617
Just make a game or program you want to use that can be made quickly using a high level language to use less lines unless the program is just doing something simple then lower level is fine too. Skip reading just find the info you need to do what you want or you will just forget everything you read anyway. You will have a sense of completion and can just learn more later as you need it.
.corvo · 2024-12-08 05:21
>>40617
i started with C and Lua back in the days, Lua is still a solid choice if you want to get your feet wet and id start by making a game of blackjack; you'll get to use conditional statements, loops, user inputs and random numbers
Elliot Alderson · 2024-12-10 11:38
Yeah I have the beginner's question of "how the hell do I get x509 certs working on keycloak via k8+nginx"
I'm rapidly losing my mind.
Lady 3Jane.. · 2024-12-10 18:16
>>40624
Should I dive right into small projects that I come up across or? I have a pretty good base in mathematics and the courses that I've seen online seem pretty monotone with all the explanation on what's an integer and blah blah blah
I only know Elisp :-D and I'm planning to have fun with something low-level, that's where my second question comes in
I really want to get dirty with under-the-hood stuff, would you recommend C, Rust, or assembly for that? Not as a long-term time investment but rather as a learning experience
Technician · 2024-12-10 18:16
>>40645
Didn't mean to reply to that lainon :-I
Iverson · 2024-12-14 17:38
>>40572
portability. size_t gets imported from headers, which depending on OS and hardware will have the correct byte sizes for the type. sometimes this matters, as you might write programs that are dependent on size_t being 4 vs 8 bytes, or whatever.
renames · 2024-12-15 06:04
>>40645
If you want to learn low-level programming, you need to read a good book because there are too many rules that you need to know. I suggest learning C as your second language. Knowing Elisp is enough if you know it reasonably well. For learning C, I suggest reading C: A Modern Approach 2nd edition by King: http://knking.com/books/c2/
Be sure to read a programming style doc from S*ckless and follow it. When learning C, I suggest using these C compiler flags: -O2 -Wall -Wextra -std=c11 -pedantic But! Be sure to remove -pedantic when you write your real programs.
Dujour · 2024-12-17 21:24
>>40631
Hello, what are some sources you would recommend for learning Lua? Are the Programming in Lua books a good resource for someone who has never coded before?
Nguoi La · 2024-12-18 12:07
>>40732
Lua is a good language to start with. You can just start with the free book from Lua homepage:
>https://www.lua.org/pil/contents.html
You can use Exercisim, Project Euler or Leetcode to find programming exercises. When you start writing serious programs, you probably want to get acquainted with LuaRocks package manager.
setq · 2024-12-21 07:15
I have do the Java OCA soon, and just looking at the few questions already made me want to throw up. How would i tackle on something like this? I have like 2 weeks and must pass above 70%. Do lainons have any advice for a fool like me? Thanks.
Yours truly, lainon · 2024-12-21 08:25
>>40772
>Do lainons have any advice for a fool like me
Yes. Stop thinking about ways to do it and just do it
If everybody took this advice we would've have advanced by at least 500 years by now
Dox · 2024-12-21 08:31
I'm writing a simple sentence generator for my native romance language (Brazilian Portuguese). It's in JavaScript, but I might reuse it as a node.js program in the future. What is the best way of storing words with their other forms?
For example, picrel is how I wrote the object for the definite article. That works on a super small scale, I guess, but I want new words to be submitted. Nothing too crazy like writing my own lemmatizer; I'll probably store the stem manually for regular words and every form for irregular ones. Is Json the way to go for someone with time, or is it inefficient through the lens of the computer?
(I know jackshit about computational linguistics and little about programming; it's just for soykafs and giggles.)
Special Agent Bob · 2024-12-21 19:54
>>40773
true okay, im grinding books and doing a coursera.
Terzibashjian · 2024-12-30 06:07
so I tried to boot up a simple game I made the other day and got a library error:
>error while loading shared libraries: libraylib.so.450: cannot open shared object file: No such file or directory
recompiling it fixed this, but looking at my /lib64/ folder I'm seeing libraylib.so.550 instead so I'm guessing that got updated
there's also a libraylib.so without version number, so if I were to ship a game eventually and didn't want to statically link the lib (even though that seems like it'd save some headaches) I should specifically link to that unversioned lib as a dependency, right?
.. · 2025-01-02 16:26
>>40772
unrelated, but is that koronba?
Turing · 2025-01-02 18:15
>>40855
Yes anon, the best there is koronba.
Cat Mother · 2025-01-08 14:53
Hello Lain. I am obsessed with doing things the "right" and "safe" way at the get go, which as you can imagine has hindered my progress somewhat as a beginner with C. So here is my current confusion: User input using C standard libraries seems to be a point of contention in the community (understandably so, given possible exploits). If I want to try to have a simple user input loop where first the user inputs an integer and then afterwards the user is prompted to confirm the input with a Y/n or \n, my monkey brain says use scanf() for the integer and getchar() for the confirmation. But... due to the nature of scanf(), getchar() reads a bunk endline and so the buffer needs to be cleared. This has lead me down a rabbit hole with everyone saying dont use scanf() and you should never need to clear the buffer etc, yet every solution appears needlessly complicated and leads down another rabbit hole. What does Lain think? What is the best way to approach this correctly (I have made an ugly input loop, but it doesnt feel right and doesnt work well as a function).
while(1) {
printf("Enter num: ");
if (scanf("%d", &num) == 1) {
printf("\nNum set to [%d]. Is this Correct? (Y/n)\n", num);
getchar();
int confirm = getchar();
if (confirm == 'Y' || confirm == 'y' || confirm == '\n' || confirm == '\r') {
printf("\nNum set to [%d].\n", num);
break;
}
}
}
⍕ · 2025-01-08 22:00
>>40898
That should work, but I don't think scanf would gracefully handle non-integer input.
As for "best approach", there isn't any, they all suck (when security is a priority), but this is the convention I've seen mostly
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
int num;
char buffer[16];
char confirm;
while(1) {
printf("Enter num: ");
if (fgets(buffer, sizeof(buffer), stdin) != NULL) {
if (strchr(buffer, '\n') == NULL) {
fprintf(stderr, "input exceeds buffer, exiting.\n");
exit(EXIT_FAILURE);
}
if (sscanf(buffer, "%d", &num) == 1) {
printf("\nNum set to [%d]. Is this correct? (Y/n)\n", num);
if (fgets(buffer, sizeof(buffer), stdin) != NULL) {
confirm = buffer[0];
if (confirm == 'Y' || confirm == 'y' || confirm == '\n') {
printf("\nNum set to [%d].\n", num);
break;
}
}
}
}
}
return 0;
}
If the above seems too much of a PITA, you could always learn Go.
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
func main() {
reader := bufio.NewReader(os.Stdin)
for {
fmt.Print("Enter num: ")
input, _ := reader.ReadString('\n')
input = strings.TrimSpace(input)
num, _ := strconv.Atoi(input)
fmt.Printf("\nNum set to [%d]. Is this correct? (Y/n)\n", num)
confirm, _ := reader.ReadString('\n')
confirm = strings.TrimSpace(confirm)
if confirm == "Y" || confirm == "y" || confirm == "" {
fmt.Printf("\nNum set to [%d].\n", num)
break
}
}
}
BloodCat · 2025-01-09 10:56
>>40898
I hope these articles help you as they did to me.
https://sekrit.de/webdocs/c/beginners-guide-away-from-scanf.html
https://overflow.hostux.net/questions/2565727/which-functions-from-the-standard-library-must-should-be-avoided
Lady Jessica · 2025-01-09 15:30
>>40901
>>40905
Wow, what a complicated little rabbit hole for something that feels like a day 2 CS class assignment. I ultimately went with a combination of your two answers, primarily because the strol() portion of the article made some sense to me and im not sure the benefit of sscanf() over scanf(). So I have this monstrosity which I will have to break down somehow into a portable input loop function. (BTW the reason im using C is because I'm playing around with some low level memory stuff for the heck of it).
Well anyways, I suppose I'll share my shamelessly half-stolen attempt at a simple input loop. Thanks for the input.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
int main (void) {
//User input test w/ fgets and strtol
long myNum;
char buf[32];
int success;
do {
printf("Enter your number: ");
if (!fgets(buf, sizeof(buf), stdin)) {
return 1;
}
char *endptr;
char chIn;
int confirm;
errno = 0;
myNum = strtol(buf, &endptr, 10);
if (errno == ERANGE) {
printf("Input number too small or too large.\n");
success = 0;
}
else if (endptr == buf) {
// No character was read
success = 0;
}
else if (*endptr && *endptr != '\n') {
//*endptr neither end of string nor newline,
//implying the whole string was not converted
success = 0;
}
else {
// Have user confirm entry.
printf("You entered [%ld]. Do you want to use this number? (Y/n)\n", myNum);
do {
if (!fgets(buf, sizeof(buf), stdin)) {
return 1;
}
chIn = buf[0];
if (chIn == 'Y' || chIn == 'y' || chIn == '\n' || chIn == '\r') {
printf("[%ld] confirmed. Thanks for playing.\n", myNum);
confirm = 1;
success = 1;
}
else if (chIn == 'n' || chIn == 'N') {
printf("Entry rejected.\n");
confirm = 1;
}
else {
printf("Please enter 'Y' or [RETURN] to confirm entry, or 'N' to retry.\n");
confirm = 0;
}
} while (!confirm);
}
} while (!success);
return 0;
}
limited · 2025-01-09 19:41
>>40907
>Wow, what a complicated little rabbit hole for something that feels like a day 2 CS class assignment.
C was made in 1972, specifically for the PDP-11 "minicomputer" (small mainframe).
Dennis Ritchie and Brian Kernighan never anticipated the language would become so widespread.
They also lacked the hindsight of the concept (and seriousness) of "cybersecurity" that really took off in the 1980s.
They also lacked the hindsight that the U.S. DOD would become very concerned about "safety-critical systems" in the late 1970s.
If they had that hindsight, I'm certain they would've designed basic functions like `scanf` differently.
For example, if K&R magically had some hindsight of the 1980s, `scanf` might've looked something like this
char buffer[20];
scanf("%19s", buffer); They didn't, nor did they have the political capital to make an overhaul with breaking changes in the ANSI C 1989 standard in the name of safety,
which probably would've made the Python 2 -> Python 3 transition look like a moonlit beach stroll, and possibly killed C's adoption.
So we're stuck with the consequences.
Morpheus · 2025-01-10 02:52
Is there anyway to view guidedhacking content for free? This site has a ton of content but lately it's paywalled.
Yamaoto Toshi · 2025-01-10 14:50
I have a question about how to organice my data in C programs.
I have done a medium-project and I had the approach of main() was the "provider" data for my functions. ie:
#include "lib.h"
// lib.h only contains one function: x_funct(int)
int main(void) {
int num = 10;
x_funct(num);
return 0;
} In the project, I organize data that is related in structs (ie: struct Circle: float x, y, radious, ...) into headers files and then declare them in main(). But doing this in a medium-sized project, which has many functions and these functions need data, turns main() into an ugly and seemingly meaningless section. The lines were skyrocketing!
So I thought: what if the variables related to each other were inside the same place where the functions that use them are?
//lib.h
#ifndef LIB_H
#define LIB_H
extern int num; // x_funct(int) uses this variable
void x_funct(num);
#endif // LIB_H
// lib.c
int num = 10;
void x_funct(int num) {
// do something
} #include "lib.h"
int main(void) {
x_funct(num);
return 0;
} So, I just call the main functions in main() and send arguments.
I have heard that global variables are a bad practice because it is difficult to debug with them. But I think it's a matter of being careful, using the necessary external variables and having good documentation.
(why I got a "go away, spammer" message?)
Hacker · 2025-01-11 18:11
>>40917
Maybe i need more context for this question, but i have an idea.
I am asuming that you need a better way to declare the internal state/context of your aplication, is it?. You could do function that initializes ("provides") the state when you are going to start using the library, and then pass that state to all the functions that need it.
The extra for doing this is that you can switch contexts easy, if the state is not that complex.
Its better to group the data in a single data structure, that is declared by only one function, and is passed by reference (and changed) for other functions; and finaly destroyed by only one function, away from main();
// lib.h
#ifndef LIB_H
#define LIB_H
struct x_state {
const num;
size_t entities_count
Circles entities_array*;
};
struct x_state x_make_state(void);
x_funct(struct x_state* s, const int ephemeral_parameter);
void x_state x_destroy_state(struct x_state* s); // if you alocate something
#endif
If you dont want a function to change the state, pass the pointer as const. That prevents human errors.
void x_funct_that_reads(const struct x_state* s, const int ephemeral_parameter
(I sound very stackoverflow-esque, but eh...)
Wirth · 2025-01-11 18:19
Its there another way of doing c generic data structures that is not a void pointer and a "size_t data_length" header. I know that unions exist, but on very diferent structs, it wastes a lot of bytes often.
I want insigth on other aproaches, like how codec/data-transmission headers work, or how other languages aproach it.
But.. its that it?!, making jugglery with pointer aritmetic?, its that how higher-level languages manage generics? or i am totally unaware?
\_(ˀ . ”)_/
↑ · 2025-01-11 19:07
>>40931
It's pretty similar, but you can also do something like
enum obj_type { OBJ1, OBJ2 };
struct gen_obj {
enum obj_type type;
char obj[];
};
struct obj1 {
enum obj_type type;
int int1, int2;
};
struct obj2 {
enum obj_type type;
int int1, int2, int3;
};
void f1(struct obj1*);
void f2(struct obj2*);
void f(struct gen_obj* a) {
switch (a->type) {
case OBJ1:
f1((struct obj1*)a);
break;
case OBJ2:
f2((struct obj2*)a);
break;
}
} The generic object stores its type rather than its size, and the compiler deals with the various sizes on its own. One issue is that struct gen_obj doesn't have a size. You can make the second element a pointer to a concrete object if you need that (at the cost of one more indirection).
Hacker · 2025-01-12 11:36
>>40929
>Maybe i need more context for this question
Sorry if I was ambiguos.
What I want is to keep the main() function as clean as possible; with this I mean what I said in my previous post, not to have lines and lines of structs and data structures instances at the beginning of main(). That these data be encapsulated and sorted in their respective files, and execute the main functions in main().
>like pic rel
I am in the process of designing a clear, readable and maintainable software architecture.
Maybe I'm the clueless one who thinks this is a good way to organize a medium-large project and I'm not seeing a critical point or a clear mistake.
If you know of any other way to organize my code that complies with the architecture I want, or how a medium-large project is truly structured, I'll be happy to read it!
Anyway, here's another way to do what I'm looking for: instead of using extern , I'd use static variables/data structures. I see this as “packages”. Each “package” contains variables and functions that use these variables. Clearly, so that this approach does not become inconvenient, its use is in general:
// lib.h
#ifndef LIB_H
#define LIB_H
#include <stdio.h>
void x_funct(void);
#endif // LIB_H
// lib.c
#include "lib.h"
#define MAX 3 // max lenght
static int num_arr[MAX] = {1, 2, 3}; // int array, only usable in this file
static void print_max_lenght(void) { // it prints the MAX value
printf("MAX: %d\n", MAX);
}
void x_funct(void) { // this function uses num_arr[]. It prints the elements of the array
for (int i = 0; i < MAX; ++i)
printf("number: %d\n", num_arr[i]);
print_max_lenght();
}
#include "lib.h"
int main(void) {
x_funct(); // this function prints an array
return 0;
}
Obviously, this is just a small and silly example. I'd give more documentation and more clear and meaningful variable/function names in the source code.
How would work this in a medium-large project?
Church · 2025-01-12 18:52
>>40937
Your approach could work; reserving memory statically
within the isolated packages. Depending on how
complex the "packages" are, they might benefit from
having object pools or arenas to manage their static
memory. But if it's really for a medium to large
project, and you want modularity, then a common
pattern you might want to consider is not reserving
the memory statically and internally within the
"packages", but allowing them to take blocks of memory
allocated outside the package, for more flexibility
and reusability.
Once they are initialized they take ownership of
that memory and handle it internally, but they don't
on their own reserve anything. This way, multiple
instances of a "package" can exist, possibly in
different threads, and a "package" can handle
different amounts of data as needed. The memory
passed to the package can be statically allocated
memory, that's not the point, the point is to not have
it allocated by the package itself, but by the
package's initialization caller.
Hacker · 2025-01-14 05:04
In the past I programmed a bit in Java then took a break from programming altogether. Then did KN King's C for a while since I had always wanted to learn C but due to some outside factors stopped midway through. Now I've started learning C++ since I figured it's more likely I can get a job that involves that (and in turn allows me to practice it) than in C, and I like both over something like Java because of the control it gives you.
With that background out of the way, I know I should learn a functional language at some point to expand my horizons. I explored Haskell on a very superficial level some years ago but in practical terms I know little to nothing. In the subject of FP should I take up Haskell again? Considered SICP but LISP seems fairly niche and I'd like to be able to do some projects in my target language. If I can somehow do a project that involves both that and C++ it'd be awesome.
And on the topic of exposing yourself to different paradigms and languages, anything else I should look into? I did some basic ASM years ago and I'm curious to try something like APL at some point but I'm fully aware it's more intellectual curiosity than anything, it has very little practical value. I figure if I get to actually use the language it would help learn it better. I was also interested in Prolog at some point but with how much the field has grown since then maybe it would be a waste of time and it'd be better to focus on more practical things.
list · 2025-01-14 14:38
>>40949
It all depends on your priorities because your post isn't clear about that, i.e., on practicality vs. intellectual curiosity. No you will not get a job that uses C++ by the way, or even C; it's easy for me to make that bet due to statistical reality. Same goes for functional languages but at least with those you seem to acknowledge they're for intellectual curiosity.
Agent Richard Gill · 2025-01-16 07:00
>>40959
I'd like to indulge my intellectual curiosity but realistically I think I'll want to do something else with the rest of my day if most of it will be spent busy with coding for professional purposes. Short version my priority is practicality because I need a job.
A major reason why I had all that back and forth in the past, which is basically a hole in my curriculum, was because most jobs were webdev of some type (even back end ones were dedicated to web apps or the like) which I really hate. I did give it a shot at one point, thinking I'd have to get used to it, but after a few months in a position I decided I'd rather change fields entirely than work with webdev. Ever since I started learning C++ however I've been reminded of how much I like the kind of stuff it deals with and I did find some cpp jobs even if they aren't as numerous, I'm just not qualified for them yet.
Nobody special · 2025-01-19 13:43
I have a question from someone who is just starting to code and has never done any real projects other then beginners university exercises.
What tool are really used in the professional world?
To be more specific, I want to make a windows application the tracks, lets say, my exercise habits and gives insightful data about it. What tools should I use?
At first, I tried doing it as an Android app, and screwed everything up. I was following a tutorial and everything was going alright, bat as soon as I tried new things, a gazillion of errors began to appear. For this, I was learning to code in Kotlin, using IntelliJ and Android Studio. Eventually I gave up and now I'm looking how to do it as a pc app.
My question is exactly about this last part, what tool should I get used to if I want to get a job? Because I don't want to spend hours and hours trying to solve a problem from a specific IDE and never use it again in the future. If I'm trying to solve a problem, I want to know that this knowledge will be useful in my professional life.
Being more specific about the pc app, I saw tutorial doing it with C++, using Visual Studio, with some knowledge about SQL. Should I learn those deeply? Or there is some secret more general IDE used professionally that I should look for?
Thanks in advance.
Demeere · 2025-01-19 13:55
>>40949
>anything else i should look into
forth. not the language itself, because it isn't really one, but the ideology/methodology behind it, and the implementation. leo brodie books, ultratechnology.com articles, colorforth.github.io etc. literally transformed the way i look at programming.
Gyula Kovacs · 2025-01-19 14:26
>>40985
>windows app that tracks habits
in visual studio you can use c#+winforms, there's gui layout editor as an aid, but i'd rather write my layouts by hand, so i'd prefer java swing which too has a beginner-friendly api. c++ is ok, but for more "serious" programs.
>Or there is some secret more general IDE used professionally that I should look for?
vim/emacs. both are more lightweight and have plugins for everything. ok they are just editors not ide, but they'll force you to setup the build system sepatately so you'll get to know the tools that visual studio and other ides like to hide behind their pretty gui.
visual studio is fine for a beginner, it's not too problematic from my little experince with it.
android dev is easy actually, but a solid understanding is necessary, so read all the docs.
Anamika · 2025-01-22 13:25
How do I learn software engineering?
What I mean is: I know some basics of programming. I am knowledgeable about my PC. I know some C, Python, etc and I can probably learn new syntax in a few days to be decently comfortable with using it. So I'm not asking about language tutorials, or tutorials at all. I'm asking about books or courses that teach how to design software.
I started writing a C + SDL2 Tetris clone, for practice. I got some of it running, but then I got stuck on how to represent actual Tetris pieces. I thought about it, and decided to cheat and look for other people's Tetris clones in C. One of those I found used a very clever way to encode shapes, it basically had an array of 4 hex values, that were 16 bits, so a 4x4 matrix. Those hex values, for example 0x0F00, encoded a "line" tetris piece - second row of the matrix was 4 bits of 1. I thought it was pretty genius. And then I realized, that I could never come up with a solution like this myself. I just lack the knowledge. I learned a lot by studying that code, and now I'll spend more time trying to include it in my version, but I feel like it's the wrong way of doing things.
So, any recommendations?
Nameless · 2025-01-22 13:55
>>40949
>I know I should learn a functional language at some point
>In the subject of FP should I take up Haskell again? Considered SICP but LISP seems fairly niche and I'd like to be able to do some projects in my target language.
Haskell is also very niche language. Lisp is worth learning for other reasons (like macros and code as data). Honestly, I would learn a bit of both. SICP is a great book. One of the best CS books, actually!
>And on the topic of exposing yourself to different paradigms and languages, anything else I should look into?
Scheme/Common Lisp, assembly, Forth, Prolog and Smalltalk (try the Pharo MOOC). You don't need to become very good at these but do learn the basics! These languages have some really interesting concepts.
> I'm curious to try something like APL at some point
Me too! I will probably wait until the upcoming APL MOOC at mooc.fi gets finished.
>>40985
>What tool are really used in the professional world?
git and VSCode are universal.
> I want to make a windows application the tracks, lets say, my exercise habits and gives insightful data about it. What tools should I use?
Just use Python! Save the data as CVS or JSON file.
>what tool should I get used to if I want to get a job?
Learn VSCode and git. The relevant programming languages are HTML, CSS, JavaScript (and React) and NodeJS. But business software uses Java or C# (and SQL). Different fields use different programming languages.
> I saw tutorial doing it with C++,
C++ is only worth it if you want to make video games or write embedded software but remember that embedded software requires a very good skill at C, too.
Dozer · 2025-01-22 15:13
>>41000
>I started writing a C + SDL2 Tetris clone, for practice. I got some of it running, but then I got stuck on how to represent actual Tetris pieces. I thought about it, and decided to cheat and look for other people's Tetris clones in C. One of those I found used a very clever way to encode shapes, it basically had an array of 4 hex values, that were 16 bits, so a 4x4 matrix. Those hex values, for example 0x0F00, encoded a "line" tetris piece - second row of the matrix was 4 bits of 1. I thought it was pretty genius. And then I realized, that I could never come up with a solution like this myself. I just lack the knowledge. I learned a lot by studying that code, and now I'll spend more time trying to include it in my version, but I feel like it's the wrong way of doing things.
People who play games don't care at all how they are made as long as it runs well enough. Minecraft was written in Java and was very poorly optimized, that didn't stop Microsoft from buying it from Notch for $2B. If you want to get things done, you should not worry about doing things "the wrong way." That said, don't be a dickhead like certain AAA developers who should know better and hog up a ton of storage and memory usage and peg CPU cores when it can be avoided with just some minimal diligence.
word · 2025-01-24 05:33
>>41003
>tons of storage
intentional exploitation of fools.
Microsoft spearheaded this idea inflating excel filesize because customers think bigger filesize = more content = better and others adopted it. Modern AAA psychology is also fill the hard drive so they cant install competing games.
More insidious is the current TAA (temporal antialiasing) trend - its artifact&blur generating garbage but devs wont allow to turn it off because many other effects rely on hiding their flaws behind it. So they force it on you to hide other engine issues.
Bobby Newmark · 2025-01-31 23:18
Learning ASM to get better code in C in terms of efficiency. Is it worth it?
I've heard that you can write faster code in C if you analyze that code in ASM. why?
Leto Atreides I · 2025-02-01 02:51
>>41084
>worth
Do you absolutely need more performance? Only reason to do it. If not its smarter to invest your time elsewhere.
>why analyze in asm
Same situation as how do you know google translate didn't mess up? Only by knowing the language and checking yourself.
And what if a word doesn't exist? (instruction). The translator has to guess your intent and find the best replacement. Naturally that will be worse than doing it yourself because you know exactly what you want. The simplest example is comparisons against 0 exist in hardware so you can do it with a single instruction. Any other value requires 2 instructions because it loads the value into a register first and then compares against it. So " x>=1 " is 2x instructions to single " x>0 " while mathematically identical, that's still a simple example the compiler can automatically fix but when it gets complicated the only method is manual.
x<->y · 2025-02-02 10:16
>>40486
how do you people approach a codebase? i can write simple code, but i want to understand the code of a program i use.
Mitnick · 2025-02-02 12:12
>>41096
First thing, you don't need to read the whole code.
I repeat: you do not need to read the whole code.
Even if you are reading it to learn something, you are better off looking for "how did they solve problem x" and then read the source code. What I want to say about this part is simple: first you have a question and then look for the source code for the answer of that question.
Now, with that out of the way, you need to ask yourself what you want to do and what you should be looking for in the source code to help you answer that. Look for any function that may help you, for example. Most of the time you don't really care about how the function does what it does, you just want to make sure that is the function you need.
So, what is it you want to do that requires you to read the codebase?
Yuki Nagato · 2025-02-07 18:02
I have been programming in C++ for a while, but I have been interested in C programming.
I've already done one or another program, having to “change my mindset”, since C has no OOP elements. My question is:
Is there a standard way or useful techniques to organize my projects?
I've been looking for information on this, and I usually find loose tips,
like being careful with dependent libraries and having a modular code.
One thing I want to make clear is that I'm not looking for the OOP style to be adapted to C.
eden · 2025-02-07 18:18
Hello everyone, apologies if this question is juvenile or against the rules, but this is the forum I trust most to ask. If it’s against the rules, please let me know where this question would be more appropriate.
Can anyone recommend any other forums, blogs, discussions, discords, etc that discuss strategies for developing high quality auto-checkout bots? I can already imagine you guys rolling your eyes, but I am looking for something beyond just the slop of YouTube and Medium tutorials on using Selenium. I’m looking more for strategies along the lines of static IPs, rotating user agents, browser fingerprinting, maybe using C++ to have more control over HTTP requests, that sort of thing. Not specific tutorials, but maybe a discussion of what to consider when designing a highly effective bot. I have some experience in web development, but my expertise is in other programming fields so anything beyond the basics is greatly appreciated. I am NOT looking for buying one, I want to make one myself as I trust myself on making a quality bot. Any additional literature or discussions around specific websites, such as Best Buy’s queue system, would also be appreciated.
Unidentified · 2025-02-08 10:00
Is Structure and Interpretation of Computer Programs good for learning what a program should look like?
William Holtzer · 2025-02-11 09:59
How do I motivate myself to fix profound bugs in my programs rather than just giving up on it and starting something else?
I have so many projects just ending at some point, because I couldn't fix my broken code for a week or two and the idea for another project seduces me into giving up on my current one. I feel like an eternal beginner, I have been programming for several years now, tried many languages, paradigms, and various projects from graphics to networking tools to chess programming and beyond, but I never finished anything above 200 LoC. This really weighs on my mind and I want to get something done finally. I don't feel like I am competent enough to contribute other projects, due to my lack of experience on large code bases, so I want to finish a project actually.
Hououin Kyouma · 2025-02-12 04:03
In Python, how would I go about getting a person's height (feet and inches) into just inches? Here's a snippet:
print("Welcome to the BMI calculator! What is your height?")
a = input("> ")
height = a.split("'\ ")
feet = int(height[0])
inches = int(height[1])
total_inches = (feet * 12) + inches
print("What is your weight?")
weight = float(input("> "))
bmi = (weight / (total_inches ** 2)) * 703
print(f"Your BMI is {round(bmi)}.")
I know what regexes are, I know about awk, and I know basic bash commands, but I am new to Python. I figure most people would type 5' 9" or something similar, but I will also be adding if statements for other possible inputs.
Let's just say a user inputs 5' 9 for now. How do I separate the numbers so I can do math on them like in the code? I thought the backslash followed by the space would be enough, but it doesn't work.
The Plague · 2025-02-13 12:03
Does anyone know how I would implement a very basic, rudimentary implementation of "struct" for a compiler? Or, alternatively, how I would learn how to do this?
Technician · 2025-02-14 00:54
>>41152
Remove the space and \ from your argument into split. The split method takes in a delimiter as it's first argument, meaning the character which you want the split to occur at.
height = a.split("'")
Elliot Alderson · 2025-02-14 06:35
>>41152
You don't need to escape the space. If you enter that command in a shell, it should output a warning
> SyntaxWarning: invalid escape sequence '\ '
Technician · 2025-02-15 07:25
Hello, I hope all of you are doing awesome.
Is there, like, a site that teaches you how to build stuff by yourself (that is, without having to follow a tutorial that does everything for you) while explaining why things work and encouraging research? I'm looking for how to develop back-end with Node.js, but all the “tutorials” I find do something more or less like the following:
Hello friends! Today we are going to learn how to make a simple server with Node!
First, we program the server:
/*
Literally inserts all the code to copy-paste. At best, at least half explains why the lines works.
*/
That's all! Don't worry about understanding why it works, you're already a programmer!
It's a bit annoying... and YouTube tutorials are no better.
I've had better results reading the official documentation, but the bad thing about documentation is that it often assumes that you already know something, e.g. that you already know why port 3000 is being used. WIkipedia has become my best friend.
A thousand apologies if I seem arrogant or ridiculously demanding, but I want to understand why a decision is the best one when developing a project both for my sake and for the sake of the people who will use my application. One of the best sites I've found that emulates more or less what I'm looking for is OSDev (wiki [dot] osdev [dot] org for those who are interested), which does put code snippets, but also explains things in a very detailed way. Too bad my focus is not operating system development. I've been told to just copy and paste, but I don't want to turn in half-baked solutions without having learned something. What if one day I want to do something that is not in the manual?
Thank you very much in advance. Have a great day!
BloodCat · 2025-02-15 08:06
>>41207
yes, it's called copilot, deepseek or chatgpt
fsociety · 2025-02-15 08:50
>>41208
this is a dangerous path
AI will literally say "api a is the only available solution" until you query "solve it with api b"
ai is in essence limited copypaste from sites like stackoverflow but without the comments explaining alternatives & tradeoffs.
You can get a solution fast with ai but it wont give you the best solution and forcing good alternatives requires querying them specifically which requires prior knowledge you can only get outside AI.
Technician · 2025-02-15 10:08
>>41208
>>41209
First of all, thank you for the answers; I mean it.
But... I pretty much despise everything that has to do with “artificial intelligence” (although the only intelligent part about these tools is the name and the marketing surrounding them). I could rant about why, but even that's not worth my time. I'll just say that using those fancy auto-completes would defeat the purpose of me wanting to learn something new. If the point is to let a machine do the creative, interesting stuff for me, I might as well sit and watch TV all day.
I beg you, let's not turn this thread into a debate on Artificial Intelligence.
Zero Cool · 2025-02-15 13:03
>>41210
Codecrafters.io is a pretty good resource. You'll be building your own implementation of common tools, and the tutorials don't hold your hand so much, more like "here's what you gotta do to build this next small part, now find a way to do it". Downside is it's not free, but most good things aren't.
Trinity · 2025-02-15 20:17
>>41209
41207 complains about tutorials and documentation missing context for beginners, that problem is directly solved by asking LLM to give that context while going through said tutorial. "Explain this simple code snippet" is something AI is good at.
Arisu Mizuki · 2025-02-16 12:19
>>41149
post your code and explain what the problem is
Hiro Protagonist · 2025-02-16 20:12
>>41190
I could have sworn I tried that already. Thanks, it works
Miho Iwakura · 2025-02-16 21:51
How did you realize programming was for you?
I use linux and i did program a bit before but i never dived deeper than terminal toy programs ex: currency conversion.
But i always come back to it, only to block again and i am not sure if it's my own traumas saying i'll never amount to anything so why try or if it's just not for me.
I tried HTML/CSS before and although i love the idea of making my own website i stress out and burn myself as soon as i learn something new with CSS.
I just don't get a feeling for it.
I don't have a particular goal in mind either, it just seems fun but then it isn't.
I want to be able to write useful programs for myself at least.
Hong, Guil Dong · 2025-02-17 02:41
I want to self host my content (essays and self published short stories) in an html page.
The language I feel like using is Python for my own reasons. What way should I go about it? What books should I read for self hosting?
I used to write code 4 years ago but some events left me completely out of it. Most thing I have read on reddit just outright tell me to use cloudflare or other similar services. What do you people recommend?
I know that self hosting anything on my machine/network is a risk, but I don't think my site will have any inputs/outputs, any PHP or even js that could be exploited.
Zhora · 2025-02-17 02:50
>>41233
Well, connect with like-minded people. Learn a low-level programming language, get into malware and break your navi.
CarlosMZ · 2025-02-17 05:22
>>41233
I identify with you too much.
It seems that programming is something you enjoy more as a hobby than as something you would like to do professionally.
The reality is that making software in a professional environment can be quite boring and stressful: Team meetings, dealing with code from colleagues who don't care about getting their work done correctly, deadlines, classic “the client asked for some last minute changes,” dealing with technologies you don't like (in your case CSS) and a wave of other things related to the professional world... All this I tell you based on my experience.
A phenomenon I also witnessed was the classic “Impostor Syndrome.” Several colleagues who were ten thousand times better programmers than me and even some of my superiors sometimes told me that, quote, “they didn't feel fit for the job.” What I'm trying to tell you with this is that many people who are dedicated to the world of software have more than once said to themselves “programming is not for me, I should have done something else... I wasted my time” even if they have already done impressive things, so it's completely normal that sometimes you feel lost. The reality is that Computer Science is a discipline in which you never stop learning new things, so it can be very overwhelming.
Now, what I can recommend to you (this is what worked for me, everyone is different) is that your first project should be a game. It doesn't have to be very complex (don't go for Minecraft as your first project), something simple like a 2D shooter like Space Invaders or a clone of a game with very basic physics, e.g. Flappy Bird. Even in their simplicity, they are elaborate enough to determine if you would like to program more complex projects. Again, that's what worked for me (and I even ended up realizing that animation is really enjoyable for me). I don't know what your “favorite” language is; I personally love JavaScript. C++ is excellent, but I feel that for simple projects it's like killing a fly with a bazooka, although that's my unprofessional opinion. Find a library of your language of choice (e.g. JavaScript/Phaser, Python/Pygame, Java/jMonkey) and start programming; it doesn't have to be perfect, the point is to start working on more elaborate projects.
This whole rambling is just my humble opinion based on personal experiences; what worked for me may be different for others. Keep in mind that if you're going to do programming professionally, you're going to have to deal with projects of a different nature (when i was working, I had to maintain financial applications a couple of times, but most of the time it was about modifying websites).
Without further ado, I wish you and anyone reading this much, much success. And even if you end up realizing that programming "isn't your thing," life is full of opportunities and interesting stuff. Just don't give up.
Boole · 2025-02-17 18:45
I want to find all patterns of repeated bytes 5+ bytes
Google told me a lcp / suffix array was a good way to do this but when I load a large file it uses too much memory and crashes.
What's a better way that won't crash for big files?
Nell · 2025-02-18 08:35
>>41241
In files? In filesystems? Recursively? Can't even ask questions properly?
Anyway, `LC_ALL=C grep -E '.{5}'` is how I'd do it.
Meddler · 2025-02-18 11:16
>>41235
>What books should I read for self hosting?
I recommend using something like NeoCites because it's free and easy., You can of course buy a VPS. In that case, here is a good guide for you:
>https://landchad.net/
If you want to make a home server and host your site from home, I highly recommend that you get a separate device (raspberry pi or something) and host it as Tor hidden service.
>https://support.torproject.org/onionservices/
>riseup.net/en/security/network-security/tor/onionservices-best-practices
>https://community.torproject.org/onion-services/setup/
If you want to host a hidden service or if you want to use a VPS, you need to enable automatic security updates! Also, use Debian stable or Ubuntu Server as your server OS. I recommend that you use darkhttpd as your http server, but you can also use nginx if you want to (you probably don't need the extra features, however). I highly recommend that you start with NeoCities and move on to a VPS later. Hosting from home is a bit more risky.
>>41241
You don't want to read the whole file right away. You can read each line or certain amount of bytes.
>https://docs.python.org/3.13/library/functions.html#open
Something like...
python
with open('filename.txt', 'r') as file:
for line in file:
print(line)
or...
arr = []
with open('filename.txt', 'rb') as file:
while True:
stuff = file.read(32) #read max 32 bytes
if stuff = "":
break
arr.append(stuff)
or...
from functools import partial
with open('mydata.db', 'rb') as f:
for block in iter(partial(f.read, 64), b''):
process_block(block) All code in this post is untested, but I have used this technique in the past.
Sipho Nkosi · 2025-02-19 02:56
>>41243
Much appreciated anon! I have already done the first step, your advice is greatly appreciated. I will get to reading and probably gonna have to get a raspberry as there is a lot of fun stuff to do there.
On another note, anyone got a recommendation for a portable computer? I was thinking of getting a thinkpad, but one of my frieds suggests I get a mac, just because I will be able to resell it in a few years for a good sum.
Anamika · 2025-02-19 18:34
I would like to render some html to a window in wayland for a Lua program I'm writing. What's the easiest way to do something like that?
I know I'll need something like GTK for the actual window. I then need something to render the HTML, right? Or is there a GUI toolkit that renders HTML?
DEBUG-CONTENTS · 2025-02-21 06:32
>>41252
Easiest way would be to simply write a html file and open it in a browser.
If you want interactive elements / animation you can use EEL which allows you to run a html website as a local webserver with python backend.
Just attach your lua code to python and python to JS.
Alternatives come down to using something like tauri to simulate a browser as an app.
Might be cool but its way more work.
Tequila · 2025-02-23 06:31
I'm writing a little calculator for bitboards (chess) in raylib and C, however I'm unsure how to make the GUI work. Here you have the relevant code snippets:
C
static const uint32_t BOARD_SIZE = 8;
static const uint32_t CELL_SIZE = 80; // Size in pixels
static const uint32_t TOP_PADDING = 0.1f; C
while(!WindowShouldClose())
{
uint32_t startY = (uint32_t)(screenHeight * TOP_PADDING);
BeginDrawing();
ClearBackground(RAYWHITE);
for(uint32_t iterFile = 0; iterFile < BOARD_SIZE; iterFile++)
{
for(uint32_t iterRank = 0; iterRank < BOARD_SIZE; iterRank++)
{
uint32_t x = iterRank * CELL_SIZE;
uint32_t y = startY + iterFile * CELL_SIZE - 10;
DrawRectangleLines(x, y, CELL_SIZE, CELL_SIZE, BLACK);
}
}
EndDrawing();
} The idea behind here is that you have a 8x8 field, where you can edit every particular bit in a 64bit integer and then you get output the number that it would be with the selected fields. My idea is something like this: https://tearth.dev/bitboard-viewer/ but without the second and third board. What I am asking for is how do I draw this board independent of the window. So if I want to draw the field so, that 10% of the upper left corner of the GUI is left free in order to have place for the input field, is there a good way to do this in code or should I use the raylib GUI editor instead?
Shogun · 2025-02-23 06:38
>>41268
I didn't mean to spoiler the pictures.
Jens Hansen · 2025-03-07 16:43
>>41268
I'm a bit rusty in C and have never used Raylib, but I think I get what you're trying to do.
Does the window scale with the board/cell sizes? If so, make the window a fixed size.
Then define a separate rectangle to use as boundaries for the grid, this will be like the board, so define it outside of the for loops drawing the grid. Then instead of using "screenHeight" for startY use the new rectangle's coordinates.
Hope this helps, good luck!! ^^
dup · 2025-03-15 11:58
>>40486
A few new programs on my Windows ten PC always crash on start up with an access violation error[0xc0000005]. All other old/new programs seem to work fine.
I ran prime95 to test CPU & RAM. Ran Memtest for single RAM sticks. No crashes no errors. Ran SFC, DISM & CHKDSK.
One of the programs is open source, I ran it in a VM and it starts up OK.
Is there a way to use windbg to find some clue of what is causing it to crash? All I have is its crashing when trying to write to some address & the module name is ntdll. I have the symbols for ntdll that Microsoft make available. I don't know how to use windbg or know if windbg is giving out any useful information, I've read that sometimes ntdll is blamed for errors that occur else where.
Is it possible to fix this?
Does the ntdll version have to match the OS build version exactly?
There has been three patch Tuesdays so far but the ntdll timestamp in both sytem32 & syswow64 is dated from last year.
Apoc · 2025-03-15 14:36
>>41389
turn off/adjust xmp, turn off/adjust turbo boost, adjust memory voltage, adjust cpu voltage, reseat ram, reseat cpu, etc. etc.
Drano · 2025-03-16 15:01
>>41394
BIOS is set to default settings. RAM is actually running 800MHz below what's on the package label.
Tequila · 2025-03-17 09:47
>Ubuntu Will Replace GNU Core Utilities With Rust
I'm not a beginner, but maybe I'm missing something very profound. Why do even rewrite anything in Rust? To me it appears absolutely not worth the effort when C/C++ just works. It seems like distrohopping, motivated by following current trends or desire to just be different rather than actual need.
Yamaoto Toshi · 2025-03-17 10:07
>>41414
>Why do even rewrite anything in Rust?
Enthusiastic cult, I mean fanbase, composed of young techbros full of piss and vinegar. The love of reinventing the wheel is what kept me away from Rust for probably longer than I should have. They can't accept that mature software even in languages without memory safety is more featureful and less buggy than their slapped together soykaf.
Unspecified · 2025-03-17 13:51
>>41414
>Why do even rewrite anything in Rust?
There are two reasons: Memory safety. And the fact that C and C++ have a lot more corner cases. Mainly undefined behavior and deprecated stdlib functions (A lot of the undefined behavior was most likely added only because the committee started using it as excuse or maybe it's still there due to legacy reasons?). Also, I can't comment much on C++ because I have tried to learn it once but I lost interested in it because it's too large and complex.
Most common serious security issues come from the same bugs that are only easy to make in asm, C and C++. They could use Golang, Rust and Ada. Or many other languages (maybe Zig?). And most of these mistakes wouldn't be easy to make. Of course, the language needs to be portable (with support to many CPU archs) and performant. All of the languages I just mentioned fit the description but sadly Ada isn't popular, and Rust has a lot of momentum. That being said, Rust has its problems (mainly unfriendly syntax, no spec and the language is getting a lot of new features on a regular basis.).
Of course, the biggest reason why C and C++ won't get replaced any time soon is that they are good enough, and they are too entrenched in *NIX ecosystem and design. And they also have excellent tooling and library ecosystem. Still, I personally think that new software shouldn't be written in C or C++. I think it's better to use Go or something else. It will mean less work for you and the end product will be more secure. But it will be still fast enough.
>Why Go?
Because I think having a GC is a good choice for all programs where the GC pause doesn't matter (of course, Golang wouldn't be a good fit for writing video games or real time systems). It will eliminate a lot of bugs and it makes programming much easier. Also, Go does concurrency the right way (it makes it easy). The stdlib is great. And the overall complexity of the language is not too high.
>>41389
You could try the magic Windows fix:
sfc.exe /scannow
dism.exe /Online /Cleanup-Image /RestoreHealth
Milner · 2025-03-17 14:32
>>41419
>Also, I can't comment much on C++ because I have tried to learn it once but I lost interested in it because it's too large and complex.
It was the other way to me. I learned Rust to some extent, but it was too big and complex to ever use it in practice, forgot most of it by now. I like Go though.
>I personally think that new software shouldn't be written in C or C++.
I disagree. Those languages are perfectly usable and shouldn't be considered obsolete, other languages just have too little advantage to replace it. Rust shouldn't be seen as a replacement, just an alternative way.
>less work for you
This raises the concern harshly mentioned by >>41415, the code will be memory safe, but will have a lot of other issues, bugs and inconveniences ("slapped together soykaf"). I'm not trying to forcibly make a point against Rust. It's a great lang and I might start to use it. I'm just pretty sure rewrites like the Ubuntu one are pointless and may do more harm than good.
Molly Millions · 2025-03-18 11:16
>>41419
Tried the magic Windows fix too.
藤原純一 · 2025-03-18 14:28
Any advice on how to host a private minetest server from a network with no open ports?
My friend hosts a minetest server for myself and a few others*, but recently moved
to an apartment complex with:
1- A shared wifi network
2- That has zero publicly-open ports
3- That is owned by a big corp so he cannot just ask them to open a port
*None of us can host the server, we are stuck working around his locked-down network
My knowledge of networking is limited, so my only idea is to use some sort of tool
to package minetest network traffic as "other network traffic" and ship the server data
in/out using an available port. I *think* this is how this sort of situation is
usually handled, but I have no idea how to go about it, please help!
Addendum: Poking around the web I see a couple "freemium" services that offer to solve this
problem, but I'd rather roll my own solution as long as it isn't insanely difficult.
Crazy Jake · 2025-03-19 00:48
>>41425
Tor and i2p both solve that issue, but the latency might be too high for real time games. Another possibility is to rent a cheap VPS and setup reverse proxying through it.
Unspecified · 2025-03-19 05:53
Does anyone know a good web resource for learning java and javascript? Books have too much padding for something like that and I find that watching youtube videos is not an efficient way to learn anything
John Rain · 2025-03-19 08:50
>>41427
Yeah this is the answer. Just rent a 25$ VPS and call it a day.
Lunch · 2025-03-19 13:11
>>41429
Does anyone know a learning resource for javascript other than w3schools?
Colmerauer · 2025-03-19 16:37
>>41431
>>41428
>Does anyone know a good web resource for learning java and javascript?
mooc.fi or project Odin.
>https://java-programming.mooc.fi/
>https://fullstackopen.com/en/
>https://www.theodinproject.com/
Mitnick · 2025-03-21 07:16
>>40486
I've been working on an Arch install on VirtualBox, and I'm wondering if there's a way to get that image onto a USB and run it on the metal on my computer. Is this possible?
x<->y · 2025-03-22 18:40
What's the best way to progress from little baby single-file projects to meaningful multi-file/function programming?
Motoko Kusanagi · 2025-03-22 23:26
>>41477
Plan a bit more and create better abstractions. Some will naturally be siloed off, others you may want to reuse elsewhere. Dig into open source projects to get an idea of how others do this.
And don't feel pressured to split things up. It doesn't make sense for everything, and can make you descend into overabstraction hell. Been there, done that, never again.
>baby
>meaningful
Do not confuse the number of source files for a measure of anything. Elegance is simplicity.
sizeof · 2025-03-23 12:52
>>41464
> I'm wondering if there's a way to get that image onto a USB and run it on the metal on my computer. Is this possible?
Yep that is definitely possible using something like clonezilla. You'd have to install the drivers for the metal but it should work.
https://clonezilla.org/
setq · 2025-03-24 12:12
I need a static site generator and I realized nobody has written one in assembly. I have written *some* assembly, but never used it for a project and much less for a project, which I would use myself. I plan on using FASM on amd64 hardware on Linux, just using Linux syscalls and nothing else. Is such a project necessarily doomed to fail or can it be fruitful?
Kay · 2025-03-24 13:48
>>41491
It would be a fun project. If your goal is just to output HTML from some other format, that is a good idea. However, if your goal is to then use Assembly to write the web server that runs said output, you're in over your head.
William Holtzer · 2025-03-25 12:20
lainons, do you think this is a secure code? This is just a prototype
void str_cpy(char* str, const char* src, size_t str_max) {
/* secure version of strcpy() */
/*
*str must be an empty string. You don't want to overwrite data
*src must have information. It means that at least src[0] != '\0'
*/
if (str == NULL || str[0] != '\0' || src == NULL || src[0] == '\0' || str_max == 0) {
printf("str_cpy returned\n");
return;
}
size_t str_i = 0;
for (str_i; src[str_i] && str_i < str_max-1; ++str_i)
str[str_i] = src[str_i];
str[str_i] = '\0';
}
protected · 2025-03-25 13:01
>>41506
I don't see the point in checking for the content of str and src, especially as you're only checking the first byte. What do you feel is unsafe in strncpy?
list · 2025-03-25 13:25
>>41507
>I don't see the point in checking for the content of str and src
Well, my intention with str is to have a free space to fill in data, and with src, if the first element is empty ("" or ‘\0’), there is nothing to copy.
>What do you feel is unsafe in strncpy?
I've read this: https://stackoverflow.com/questions/869883/why-is-strncpy-insecure
Anyways, I wanted to write my own safe copy function, just for fun :-).
Agent Jones · 2025-03-25 14:29
>>41508
>Well, my intention with str is to have a free space to fill in data
Which you're not checking, str could contain a 0 by coincidence or contain more data later.
>with src, if the first element is empty ("" or ‘\0’), there is nothing to copy.
But there is no need to single-case that. In general, simpler code is safer code as it leaves less room for exploitation, and is easier to audit and maintain.
>I've read this: https://stackoverflow.com/questions/869883/why-is-strncpy-insecure
You could have just said that strncpy doesn't always null-terminate strings. That's a good point, and can indeed warrant writing your own version.
From your tests, I would only keep the two NULL checks and str_max == 0
I'll point-out that your function could leak the length of the string (through side channels (timing, cache-access, ...)), which might be an issue in some cryptography applications (or when dealing with sensitive data whose length is meaningful). That's a rather niche concern though.
aliased · 2025-03-25 16:08
>>41506
secure code can mean almost anything, the problem I see with your code is that it fails silently instead of returning an error code. another potential problem is that src and str could overlap and you would be modifying the src (violating the intent you are communicating with "const char*"), but that's fine
>str_max == 0
is this an error check (like the previous ORd conditions) or a shortcut? if zero-length buffers are allowed, it shouldn't return an error
Colmerauer · 2025-03-25 16:16
>>41506
You probably would be interested in the strlcpy paper. Try to write a clone of the function based on the paper and the man-page.
* The strlcpy paper: https://www.openbsd.org/papers/strlcpy-paper.pdf
* strlcpy(3) man-page: https://man.openbsd.org/amd64/strlcpy.3
Don't look at the code, yet!
You can view the code at:
>https://github.com/openbsd/src/blob/master/lib/libc/string/strlcpy.c
drop · 2025-03-25 16:31
>>41512
nta but strlcpy has nothing to do with their code. the preconditions are different, read anon's comments more carefully
Zhora · 2025-03-25 18:06
>>41509
>>41511
>>41512
Thank you very much for your feedback!
Well, I tried to modify my code to make it easier to read (I tried). At least, for me, this code is useful for my needs. (I didn't know about the overlapping, is it a good idea to have different information in the same array?)
(Dang it, "flood detected")
void str_cpy(char* str, const char* src, const size_t str_max) {
/*
this function does not handle overlaps;
both str and src must point to different memory addresses
*/
/* check invalid data for this function */
if (str == NULL) {
printf("str is NULL");
return;
}
if (src == NULL) {
printf("src is NULL");
return;
}
if (str_max == 0) {
printf("invalid size\n");
return;
}
size_t i = 0;
/* copying procces */
while(src[i] && i < str_max-1) {
str[i] = src[i];
++i;
}
str[i] = '\0';
}
Hagbard Celine · 2025-03-25 23:20
>>41517
>I didn't know about the overlapping, is it a good idea to have different information in the same array?
It can certainly be useful. E.g.
char string[50] = "foo remove this bar";
puts(string);
memmove(string+4, string+16, 50-19);
puts(string);
return 0;
As the other lain said, you should return an error code rather than printing. The user of your program has no idea what str, src or a valid size are and can't do anything about it, unlike the calling function.
Shogun · 2025-03-26 04:27
>>41517
overlapping is kind of a corner case, and some strncpy/strlcpy do not allow it. it is really up to you and your needs if you want to either assume it won't happen, specify it shouldn't happen, let it happen or actually check for it in the code (which can be wasteful)
push · 2025-03-26 12:26
This is only tangentially programming related, but how can I censor my name from a git repository? Is it possible to change the name in my .git folder locally? What can I do to be 100% sure that there is no data left, which refers to my old user name? Should I just make a new repo and lose all my commits or is there some way I can retain the old repo, but with my old name effectively censored and replaced?
And no, I'm not trying to do fraud and claim somebody else's work.
dictionary · 2025-03-26 12:54
>>41525
https://stackoverflow.com/questions/750172/how-do-i-change-the-author-and-committer-name-email-for-multiple-commits#answer-1320317
Tyrell Wellick · 2025-03-26 13:05
one detail with that so answer is that you can change the local config (no --global) if you only need to do this with a particular repo
St. IGNUcius · 2025-03-30 09:36
I would like to learn a functional programming language. But I want to learn something that's not a Lisp dialect (I will learn one later). Should I bother learning Haskell?
>https://learnyouahaskell.com
>https://www.seas.upenn.edu/~cis1940/spring13/lectures.html
Erik Johansson · 2025-03-30 10:02
>>41538
>Should I bother
you don't have to do anything if it bothers you
haskell is fine but it has a lot of syntax, ocaml is easier to learn but it isn't as pure
Agent Richard Gill · 2025-03-31 06:52
hello, i need a simple text editor in html for my phone and i'd like to run it from within chrome, but android's chrome blocks me from writing within textarea and input text fields whenever i open the html document locally because it goes in offline mode. is there a meta attribute to override the restrictions imposed by offline mode? apparently it disables js too.
the href is only here to download the document, since android's chrome does not have the option to save the page as html, like desktop browsers always have done.
<html>
<head>
</head>
<body>
<textarea></textarea>
<a href="text.html" download="text.html">download textarea document</a>
</body>
</html>
John Rain · 2025-03-31 13:32
>>41542
nevermind, it was some gay google service i had disabled, after reseting all app settings, the hanging stopped
Eldon Tyrell · 2025-04-03 11:18
Are the /dev/snd/* devices documented anywhere? alsa-lib seems to be the only way to interact with them. Did I miss something?
Jim Hilger · 2025-04-10 16:03
>>41538
I absolutely love haskell, i really don't recommend LYAH though.
stack · 2025-04-11 02:10
>>41538
>>41624
LYAH + haskell.mooc.fi is working out well for me. once I'm done with both I'll probably read something more in depth and maybe try to get familiar with the math/theory behind haskell.
what problem do you have with LYAH? I guess I could see it being very lacking if not paired with something else.
Erik Johansson · 2025-04-12 08:55
are unsigned variables represented at twos complements at the memory level or only signed variables are?
if only signed variables are, cant this cause ambiguity once you're sending streams of bytes somewhere? or do protocols always strictly define which parts of a stream of bytes are supposed to be signed or unsigned?
The Plague · 2025-04-12 10:39
Everything depends on the architecture. The same C program is big endian numbers on one platform, little endian on the other. There could be architectures that aren't even binary.
Which is why we have wire protocols and serialization.
Trinity · 2025-04-13 17:10
How do I use IRC anonymously? Internet here is zogged as hell. Is there a way I can use pidgin or hexchat or some other client through tor?
Netrunner · 2025-04-13 18:19
>>41643
Yes, configure your client to use the SOCKS5 proxy of your Tor deamon. Keep in mind that most, if not all, clearnet IRC networks block Tor exit nodes and open web proxies.
renames · 2025-04-13 23:19
>>41643
Literally just
> torsocks hexchat
Cutter · 2025-04-14 19:40
>>41639
2's complement is only used for signed.
the type's usually defined somewhere. in most cases it's unsigned.
Linda Lee · 2025-04-16 07:18
Hey, beginner in assembly here, I'm a python main and wanting to get into ASM.
Can anyone give me a course that'll get you woken up on ASM? I prefer x64 with Linux syscalls since that one seems the easiest to me.
I think I know the main premise of asm, correct me if I'm wrong but it's basically moving values to registers, creating variables that hold values, and pointing to them.
I saw Wikipedia's page on assembly, read all of it, and quickly made a simple program:
[code=asm]
section .data
msg db "hello lainchan", 0xA ;found out that \n in python is actually hex 10
len equ $ - msg ; length of msg (idk if its required)
section .text
global _start
_start:
mov rax, 1 ; syscall number for sys_write
mov rdi, 1 ; file descriptor 1 is stdout
mov rsi, msg
mov rdx, len
syscall ; invoke the kernel to write the string
mov rax, 60
mov rdi, 0
syscall ; invoke the kernel to exit
[/code]
I wanna know how I can do more stuff, like interacting with files, getting CLI args etc...
I'm using x64.syscall.sh as a reference
Koos van der Merwe · 2025-04-16 10:00
>>41696
linux syscalls are just posix <unistd.h> for the most important part. you essentially use the same functions as in a c program, so all the c docs/headers/guides apply. ("man 2 read"). you can do anything with syscalls only, even a gui program.
cli args are on the stack initially. read x86_64 systemv abi doc.
>length of msg (idk if its required)
write() needs length to work
>course
x86 came naturally to me after the pain of learning snes 65816 programming.
osdev wiki is also good.
Sprendschlogniskier · 2025-04-16 10:54
>>41696
take a look at the courses of pwn college, their focus is on hacking and at the computing101 course you start learning assembly and techniques of reverse engineering
also it's all free
https://pwn.college/
The Phantom Phreak · 2025-04-16 12:12
python
print('test')
Cypher · 2025-04-16 14:25
>>41701
>>41699
thank you both!! I'll use all resources provided to me
Hacker · 2025-04-18 12:27
>> 41538
I am currently reading this book about OCaml, and it has been amazing so far:
https://cs3110.github.io/textbook/cover.html
I am also new functional programming
Wintermute · 2025-04-18 17:24
>>41766
The annotation system they use is kinda cool. It's my first time seeing it.
https://web.hypothes.is/
byte · 2025-04-20 15:09
hello i want to learn php and mysql for this 2025, do any of you have a learning path (i already know a little about the language but only a little) to make it easier for me to learn more and DB too.
gluint · 2025-04-20 20:11
>>41795
I learned PHP and MySQL trying to prototype an small social network/forum. Just start with a simple login system, and then add more and more stuff (posting w/file uploading, comments, improving the login system, even an admin panel)
imo, it is quite effective and progressive, the php/sql logic is not really complex. idk what other users think
The Oracle · 2025-04-20 21:09
>>41795
with PSRs (php-fig.org/psr) it's just like java. that plus strong typing with PHP 8 I can't ever go back to PHP 5 style code. but if you're still learning, just write it like individual scripts until the structure appears
termite · 2025-04-21 06:19
where do i start hacking in 2025 can anyone give me a path
Nanashi No Gombe · 2025-04-21 10:19
I've never used Mumble before so maybe I'm doing something wrong, but how do I find the hackathon that was held yesterday? I could always use some good programming exercises. When I joined the server I was the only user online and I was denied entry into every room.
list · 2025-04-21 15:57
>>41819
Step 1 abandon the idea that you need a "path" laid out and spoonfed to you in order to do things.
Morpheus · 2025-04-22 05:09
>>41819
read either Structure And Interpretation of Computer Programs, or Computer Networking A Topdown Approach.
Marly Krushkhova · 2025-04-23 10:24
it took me almost 10 years to get decent at understanding code and actually contribute code, it is however a very rewarding thing, I do recommend it.
Tomohisa "Tom" Kanezaki · 2025-04-27 10:34
What does lain think about this path to learning cs? is there anything you would change about it?
I wonder if there are some project ideas that would be good at different stages, since you can't really learn without doing.
https://teachyourselfcs.com/
Nanashi No Gombe · 2025-04-28 21:26
>>41940
>dozens of books
Find a tutorial or intro book you can stomach. Program a lot. Try to learn some math and digital electronics as you go. You cannot—as you pointed out—learn without doing projects.
Project 2501 · 2025-04-29 00:31
During the recent upset at the you know which chan I started being interested in modifying KurobaEx for my needs. I never did any Android dev before. I'm just a dumb Python monkey in real life.
I wanted to start by just building the app from unmodified source, but I hit a wall here. What I did so far:
- Installed Android Studio, Gradle and some Java. environment (not sure if even needed to be honest).
- Set up a few device emulators.
- Imported KurobaEx project and code from github.
I thought it would be easy, but when I try to build it, or even run it in the emulator, nothing happens. Just Executing > Execution Finished immediately after clicking the Run button.
I feel like I'm missing some critical step here. I searched, but all basic guides only seem to say to do the above. Can someone spoonfeed me the steps for how to get from pasting github link in Android Studio, to an apk that I can execute? I think I'll be able to pick up and start messing with code from there.
Lord Nikon · 2025-04-30 05:43
Should I read Concrete Mathematics before, after or simultaneously with TAOCP? Or is it better for me to choose one or the other?
Unidentified · 2025-04-30 20:15
hello, i like to go as low level as i can, without having to fight against the OS for interferring with its usage of computing resources; playing with registers obviously makes the OS angery and it will zap the process out of existence, so for this reason, i don't touch assembly, but i want to use the OS APIs directly, without wrappers.
with that in mind, which programming language should i pick for iOS, objective-C or swift? i have asked elsewhere but there are so many programmers who are so for the money and not out of passion, that they find me weird for seeking such a thing. the kind of guys who would be easily found in IRC and imageboard seems to be dying out or leaving the internet entirely and this saddens me.
Roger Pollack · 2025-05-01 07:39
>>41945
I've had a terrible experience getting Android SDK to work in the past. You're just going to have to keep fighting it. IIRC, `adb` was needed to connect to the virtual phone but `adb` is garbage that can't see the phone half the time. Good luck.
Otto Normalverbraucher · 2025-05-03 17:13
>>41975
>playing with registers obviously makes the OS angery
It shouldn't under any reasonable operating system, as long as you comply with the expected ABI contract when calling out to external resources.
>with that in mind, which programming language should i pick for iOS, objective-C or swift?
I assume by "without wrappers" you mean you want to ditch things like UIKit and crank as much of the OS' rendering/event processing/whatever mechanism by yourself as possible? I guess the language won't matter too much as long as you can call onto the relevant interfaces anyway, though Objective-C code tends to be lower level than Swift overall.
I'll say though that iOS does sound like a terrible target for this sort of exploration, so good luck with that.
Spooky · 2025-05-03 20:43
>>42022
I don't disagree, windows does have exceptions and it makes sense why it is that way, I am just giving up punching bits directly onto the registers because I don't want to deal with such exceptions, or the abi contract
I'll stick to swift I guess
Moore · 2025-05-03 22:35
Is it ok to place code and read-only data in the same section? As I know, the Delphi compiler has always done that. But not anything C/C++. Cache issues only happen when writing, right?
Hong, Guil Dong · 2025-05-04 18:01
>>42027
The processor won't care, but then some of your data is going to be mapped onto executable pages, which might help an attacker in carrying out later stages of an exploit if some of that data happen to be interpretable as CPU instructions in a manner that's convenient to the attacker's specific scenario (though the likelihood is low, and executable data by itself isn't a vulnerability).
cond · 2025-05-05 03:22
>>42040
Yeah, knew about this. But they must have a reason to be this persistent: I've seen executable data in Delphi apps both from 2003 and 2021. Is there an advantage, despite the possible exploits? I doubt it's just to keep the compiler/linker simple.
stack · 2025-05-07 01:06
I work in a small company as a SQL / C# developer (my first job after university). The state of our company is that everyone is busy with their deadlines and they give me almost no work (maybe because I'm autistic and socially awkward too). I think I can use this time for self-education. So, data engineering and C# backend development sounds good for me. Any ideas what kind of study / pet projects I can do in these areas? I can use real data from my work to make it more like real projects
Agent Richard Gill · 2025-05-08 13:26
>>41962
I'm not familiar but my advice is that you not go for the most rigorous book on a subject immediately. What's probably going to happen is that you burn out. Read the more chill book, if you want to go through it again, do the hard book then.
Imo starting with SICP is a bad for this reason. I'd just start with a C or C++ textbook, or automate the boring stuff with python.
I have never met someone irl who finished SICP for instance, they recommend the book despite only having finished a few chapters.
Kay · 2025-05-08 13:36
>>41819
BS CS is the path of least resistance. You could also just cover the topics they cover and skip some of the continuous math like calculus or physics. Go off your local university and see what books they use if you self teach.
I remember asking how emulators are made in the pcsx2 discord before I had begun programming. I got incredibly bad advice "it's reading a lot of manuals", etc. While this is true, the reality is that you already need to know basic programming, oop helps, and computer architecture to begin programming an emulator.
Before you begin on a harder project like pcsx2, you should have already done several easier ones like a CHIP-8 emu, a NES emu, etc. You should have written some assembler as part of that computer architecture book, etc.
Further, you know so little right now that you don't even realize that cybersecurity is not a single, discrete job. There are many roles within cybersecurity, a lot of the good ones involve having the equivalent knowledge of a BS CS grad.
I'm not pushing a degree program, but you will have to know about as much the guys with a degree for security research, application security, etc. Generally these people have many years of experience as software developers. Other cybersecurity jobs involving certifications are easier to get into, but they're generally a lot less competent. Figure out what you actually want to do by talking to people who do these jobs in extended conversations.
If you want a starting point read a book on Computer Networking as the other lainon suggested, but try to find someone to mentor to you asap.
Unidentified · 2025-05-09 17:36
what are some good resources for learning how to organize and structure programs from a bigger picture pov?
if · 2025-05-09 18:31
>>42087
Looking at how big, existing projects are structured can be helpful
Terzibashjian · 2025-05-10 01:36
>>42059
>I can use real data from my work to make it more like real projects
To make this realistic, try to make something that could be useful for the people you work with. Is there some chore or inefficiency that people have to deal with at work that could be (partially) automated away?
Marly Krushkhova · 2025-05-17 12:58
I want to measure the efficiency of a function, and I understand that one of the ways to do this is to measure how long a function takes to return.
Doing some research, I found these two posts from stackoverflow:
https://stackoverflow.com/questions/1688133/how-can-i-test-the-performance-of-a-c-function
(the QueryPerformanceCounter() function is mentioned)
https://stackoverflow.com/questions/1739259/how-to-use-queryperformancecounter
(how to use QueryPerformanceCounter())
Based on this information, I made a small code with two algorithms that have the same purpose:
calculate the sum of the first n natural numbers.
#include <stdio.h>
#include <windows.h>
/* measuring functions */
double freq = 0.0;
__int64 CounterStart = 0;
static void StartCounter() {
LARGE_INTEGER li;
if (!QueryPerformanceFrequency(&li))
printf("Problem with QueryPerformanceFrequency\n");
freq = double(li.QuadPart) / 1000000.0;
QueryPerformanceCounter(&li);
CounterStart = li.QuadPart;
}
static double GetCounter() {
LARGE_INTEGER li;
QueryPerformanceCounter(&li);
return double(li.QuadPart-CounterStart)/freq;
}
/* algorithms */
static int sumf(const int n) { /* algorithms 1 */
int sum = 0;
for (int i = 1; i <= n; i++) {
sum = sum + i;
}
return sum;
}
//static int sumf(const int n) { /* algorithm 2 */
// return n * (n + 1) / 2;
//}
int main() {
int input = 100000; /* value to send to sumf() */
StartCounter(); /* time starts */
int result = sumf(input); /* execute algorithm */
double total_time = GetCounter(); /* time stops */
printf("Time: %f\n", total_time); /* print the time it takes for the function to return */
return 0;
}
I understand that I must execute several times the function (the amount is arbitrary, I suppose, but it must be a high quantity) and from there get an average, which could make the function to measure to be executed inside a loop and after that loop and then do the respective calculation of the average.
But I have doubts if I'm doing it right or if I'm missing something.
Linda Lee · 2025-05-17 14:40
>>42124
The main thing you're missing is inhibiting compiler optimizations.
Right now your algorithm will almost certainly get fully constant-folded. In fact, the result doesn't get used and sumf has no side effects so it won't get called at all: https://godbolt.org/z/9GKKPvfea
One trick is to assign the result to a `volatile` variable. The compiler must assume that loads and stores to a volatile address may have side effects, which prevent it from optimizing it out.
Ditto for the input value: assign to a volatile variable first, then read out of it.
Still, in this case you'll likely see no difference between the two algorithm since the compiler is likely smart enough to recognize the form in the first function and transform it into the second form.
By the way, sumf with n = 100000 is 5000050000, which exceeds 1<<31 and hence is UB due to signed integer overflow.
Technician · 2025-05-18 11:23
Is there any One Time Pad (OTP) inplementations that people could share like software or scripts?
I'm looking for a good way to send OTP messages to frens, and a way that is seemless or easy (saves me less steps)
Masami Eiri · 2025-05-18 12:32
>>42133
Stream ciphers like ChaCha20 are essentially PRNGs used to generate OTPs.
>I'm looking for a good way to send OTP messages to frens
Not OTP (why OTP specifically?) but https://github.com/FiloSottile/age seems the simplest:
$ age-keygen -o key.txt
Public key: age1dmalw8r5pf4vv5wme2k89a0e6tj8e0g8wcprc24jdygtr9hz6gyseqfu5r
$ age -r age1dmalw8r5pf4vv5wme2k89a0e6tj8e0g8wcprc24jdygtr9hz6gyseqfu5r <<EOF > message.txt.age
Hello Lain!
EOF
$ age --decrypt -i key.txt message.txt.age
Hello Lain!
Yet Another Lainon · 2025-05-18 12:47
>>42134
>From 2018 to 2022, I worked on the Go team at Google
>Before that, I was at Cloudflare, where I maintained the proprietary Go authoritative DNS server which powers 10% of the Internet, and led the DNSSEC and TLS 1.3 implementations.
lol not a age rec again lol
Nell · 2025-05-19 16:39
Do calls to POSIX sleep() guarantee ordering? I.e. in
c
A();
sleep(1);
B(); Do I have a guarantee that B() will execute atleast a second after A() (assuming no signals are triggered during the execution of sleep())? Or is the compiler free to move around functions as it normally is allowed to do?
Technician · 2025-05-19 18:00
>>42133
OTP are extremely simple. You could do it yourself after a week of studying python.
Nobody special · 2025-05-20 11:42
Can Intel Arc B580 run any open source LLM?
SHODAN · 2025-05-22 12:57
What do you think about Babashka?
https://github.com/babashka/babashka/blob/master/examples/README.md
I never bothered skewing through Lisp-like languages because i struggled to find them a pragmatical use i could integrate them into my creative process. However, a script-like language with some practical tools for everyday tasks sounds more like my jam.
Sipho Nkosi · 2025-05-24 09:05
>>42141
In general: anything with (observable) side effects are guaranteed to be ordered. Anything without (i.e. pure) can be transformed by the compiler in any way it likes.
So if e.g. A prints "x" and B prints "y" then "y" will appear a second later than "x".
But if you have e.g.
x = A()
sleep(1)
y = B(t, u) and B() only performs some computations without any side effects then the compiler is free to rearrange B() before sleep() or even A().
H.R. Giger · 2025-05-25 17:23
>>42141
Depends on if the implementation of sleep is an interruptable wait or not. In most cases the answer will be yes, but there are some cases like in the linux kernel with specific uninterruptible sleep functions (e.g. usleep_interruptible where this is not guaranateed. You need to read documentation to know what the sleep implementation does. If its regular POSIX sleep you're probably safe.
Nameless · 2025-05-26 05:59
Extremely noobish question, as I am trying to learn how digital life works.
Saw a recommendation to learn Forth and build Scheme from Forth.
I do not understand the phrase - how do you build a language from another one?
Y.T · 2025-05-27 00:01
>>42204
Researched a bit and it is more complex than I thought.
I will play with/in Forth for now, and read about interpreters and compilers. Have a good day :)
Backus · 2025-05-28 10:20
>>42208
Yeah, implementing Scheme in Forth is not beginner level stuff. Even experienced programmers would be quite challenged by that.
Unsigned · 2025-05-29 05:44
>>42204
If you want to learn how computers really work, you should read Nand2Tetris and Programming From Ground Up. Basically you need to learn basic logic and assembly language. If you want to read about retro-computers, I suggest the book Mapping the Commodore 64
Alternatively, you can learn Zilog Z80 CPU or some other simple CPU.
>http://www.z80.info
> how do you build a language from another one?
Basically, you make a program that knows how another programming language works. These kind of programs are called interpreters, transpilers and compilers but note that each of these is a bit different. Don't bother trying to write a compiler until you know how a simple interpreter works. You should also read about self-hosting compilers/interpreters and bootstrapping an interpreter/compiler. Read the classic paper Reflections on Trusting Trust, too (what if your C compiler is inserting malware on all executable you build?).
I suggest you try Racket. It's a lisp/scheme that's optimized for programming language research. You should also read SICP and learn about meta-circular interpreters (it's the easiest way to start!). Use either MIT/GNU Scheme or Racket's sicp package for working through SICP.
>https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/index.html
>https://www.youtube.com/watch?v=-J_xL4IGhJA&list=PLE18841CABEA24090&index=1
There are also other books like Crafting Interpreters or Writing An Interpreter In Go
⍕ · 2025-05-31 06:09
>>42204
Programming languages are just descriptions of instructions for a computer.
Implementing a programming language is just creating something that processes the instructions into a form that can be recognized and thus executed by a processor.
Implementing a programming language in another language, is similarly creating something that processes the instructions into a form that can be understood by the parent programming language.
blowfish · 2025-06-01 04:30
I would like to learn how to program to then become an OS dev. I know that I have to learn C first, but I am not sure about what would I have to do next. I have seen people recommend getting into OpenBSD, becuase of it's relatively small code base compared to something like the Linux kernel. People say that it is very clean and easy to understand. I have also seen people say that NetBSD's code base is even cleaner. So, what should I do after I learn how to program? Get into OpenBSD? NetBSD? Maybe something else?
I really like OpenBSD's philosophy by the way.
Agent Jones · 2025-06-01 06:20
>>42230
>Get into OpenBSD? NetBSD?
You don't need to know how to use OpenBSD or NetBSD. They are talking about the source code itself. I suggest you study it.
>So, what should I do after I learn how to program?
Learn basic algorithms and data-structures. Also, start doing simple projects and read APUE or The Linux Programming Interface.
>OS dev
Read the Minix book or the book about design and implementation of FreeBSD. Read about Plan 9. But I recommend that you don't make another Unix-like operating system (but you can if you want to)
Nameless · 2025-06-01 06:47
>>42230
>I know that I have to learn C first
You need to learn to program first, regardless of language, then (or simultaneously) learn assembly and the distinction between an abstract machine and the actual machine.
Kay · 2025-06-01 13:50
>>42204
>>42215
The book you are looking for is called "Code - The Hidden Language of Computer Hardware and Software" by Charles Petzold. Its very easy to follow and builds up from absolute basics of electric switches to how computers work in under 500 pages. Good explanations and diagrams. It may be in a share thread.
>>42230
If you want to build an an entire computing system including the language, the hardware, and the OS, I recommend project Oberon. Its the magnum opus of Niklaus Wirth who you should know. I have been reading the books and they are incredible. He implements a CPU, a compiler for a high level language, and an entire GUI operating system in under 10,000 lines of code spread over two books. And its simple enough for the reader to follow. He avoids complexity at all costs.
https://people.inf.ethz.ch/wirth/ProjectOberon/index.html
Also the NetBSD codebase is pretty good.
null · 2025-06-01 16:38
>>42230
You should go to college and get an education. Nobody is going to trust you to write software that can crash a user's computer without prior experience. At least you've identified that C is the place to start. OpenBSD has no real world use case and drivers are 99% of the time supporting some chink hardware device.
Agent Jones · 2025-06-02 03:28
>>42230
all 3 major BSDs have mostly better code quality than linux (and where it isn't it's often because it's GNU stuff that is needed, like gcc or DRI). but there's difference between them too. see this audit made in 2017 that showcases more or less their different approach to security and development practices: https://youtube.com/watch?v=rRg2vuwF1hY
It's mostly things like checking malloc returns or overflows, race conditions...and also how and how quickly each one responds to security reports.
i won't tell the clear winner of the three since people are not going to watch the video and just reply angrily whatever OS i say.
>>42241
>OpenBSD has no real use case
in your opinion.
list · 2025-06-05 19:15
when does the stack overflow?
by that i mean, i know that it usually happens when you run some long recursion, i've had it happen to me.
what i dont get it: what's the "limit"? because when i've seen it happen to me, i certainly wasnt out of memory, i had plenty still.
Vasya Pupkin · 2025-06-05 20:01
>>42284
In most languages, the stack has a fixed size that's set when the program starts. It's usually not that big relative to the total memory of a system. What language are you programming in?
overriding · 2025-06-05 21:39
>>42286
The stack size is usually determined by the OS (usually 8MB on modern Linux), not the language (unless it's interpreted or run in a VM, obviously).
You can check the value in KB on your system with ulimit -s , and change it with ulimit -s 64M .
Linda Lee · 2025-06-05 21:52
>>42288
>unless it's interpreted or run in a VM
There are a lot of those out there. For example, in Elisp, it's controlled by max-lisp-eval-depth which is distinct from Emacs' ulimit. Perhaps it's good to know that both kinds of stacks can exist simultaneously in the same process.
medical malpractice · 2025-06-05 22:13
i wanna use rpg maker xp to develop a simple rpg and it uses ruby. im new to programming and i've never heard anybody say much about it. how is it?
Mitnick · 2025-06-05 23:38
>>42292
https://www.rpgmakerweb.com/products/rpg-maker-xp
Judging by its system requirements, it looks really old and Windows-only. At the very least, you should probably look for something newer. Is there any reason you want to use XP instead of their newer MZ?
https://www.rpgmakerweb.com/products/rpg-maker-mz
Project 2501 · 2025-06-06 03:00
>>42286
>>42288
>>42289
i've had it happen to me mostly in C#, which is indeed ran in a VM.
Nobody important · 2025-06-06 03:09
>>42286
>>42288
>>42289
anyways, i've made some research and it's set to a fixed size of 1.5MB on modern .NET, though it can be changed by editing the executable's headers
Void · 2025-06-07 09:17
>>42240
>project Oberon
just read about this, very cool. bit of a shame it requires custom hardware to truly run, i'm not quite that special.
car · 2025-06-07 09:55
>>42312
He did say "including the hardware". You don't need to be "special", you can get FPGA boards for decent prices nowadays. I can't exactly say cheap, but you can most likely run that design on a $100 board.
over · 2025-06-08 01:07
How exactly are API keys stored on a webserver? I can't think of a good way to do so, without using another server. What are all those big sites that use APIs themselves do? Certainly they can't store them in plain text in some file, because otherwise everyone who has access to the webserver could do his shenanigans with the API keys. The best solution is probably to prevent somebody accessing the server in first place, yet it stills feels inherently insecure to put them in just a file. So, what is the proper solution to this? I'm using Flask/Python if that helps, maybe there is a library specific to Flask or Python to solve this, who knows?
Unidentified · 2025-06-08 04:30
>>42317
>Certainly they can't store them in plain text in some file
For personal projects that's what I do every time. If I'm lazy I might embed it directly in the program too.
I presume larger companies would use multiple sets of keys: some for development only (or per developer) and a separate set for production.
>because otherwise everyone who has access to the webserver could do his shenanigans with the API keys.
You'll inevitably have to entrust someone with the keys. Only those you trust will have access to (relevant accounts on) those servers and nobody else.
Trinity · 2025-06-08 11:33
>>42318
Yes, but I'm planning on doing automated payment processing (i.e. using the Paypal API to process payments) and I feel like there is a lot of room for trouble when having the keys laying around on the server to snatch for everybody with access to the server. I know i should learn the basics of backend programming before making something with money involved. It's just that I had a very specific idea and want to make it real. I get what you're saying in regards to having to trust somebody being inevitable at the end of the day. My setup would be me as the only person having access to a VPS, where you can only login with SSH-keys, thus probably having more security than when more people would work on the project, though there probably still is a way to get access to that VPS if one would really wanted to.
vector · 2025-06-08 12:21
>>42322
You could store only hashes of the keys, like you would with passwords.
Undisclosed · 2025-06-08 14:45
>>42324
Eventually, he'll need the actual key. The hash won't do him any good when he needs to talk to the PayPal API. For key storage, I'd just do what ssh does.
- Put private keys in a directory with 0700 permissions (similar to ~/.ssh).
- Let that directory be owned by the Unix user that will be running the processes that talk to the PayPal API.
- Write functions to fetch keys from this private location.
- Carefully vet who has access to the machine that stores the key.
Molly Millions · 2025-06-11 10:45
>>42317
they store them in the database or in the environment variables of the web server's executable
Unknown · 2025-06-19 14:39
how is there a lambda sign in my url and its in my bookmarks
how is it in the url
how is it in the bookmark
how is it in the http request
neither of these things support lambda last time i checked (2001 ngl)
is it a vuln?
Trinity · 2025-06-20 05:14
>>42394
>is it a vuln?
Yes if you don't enable the "show punycode" setting in your browser.
Netrunner · 2025-06-20 05:36
>>40486
Is there a way to automatically generate diagrams (UML or something else) for your programs? Bonus points, if I can edit the diagram and it can automatically apply the changes to the classes. The language is not important but I would prefer if it's available for Python or Common Lisp. But I'm still interested in hearing if any language has a tool like that, and the tool can output any kind of diagrams, not just UML.
Armitage · 2025-06-20 11:43
>>41419
>>41420
Does a lainon know any good websites, books, or other learning resources for learning Go? Specifically for web development?
Yet Another Lainon · 2025-06-21 10:53
Is there such a thing as a more sophisticated markov chain, which is still simple enough to implement by somebody without a CompSci degree (roughly speaking)? I want to generate text that has normal words and sensible structure, but learning faster (i.e. with smaller sample text) than a markov chain. I would look it up in a search engine if I had the search terms/vocabulary to search with. Any clues?
Knuth · 2025-06-21 18:40
>>42412
it's 2025 gpt exists and you can run it locally or in a vm or whatever
Dox · 2025-06-21 20:45
>>42412
Depends on what you mean by "more sophisticated," you can make higher order markov chains which may meet your needs. Neural networks might be a good option and neural networks + first order markov chains can get quite complex outputs without much know how.
It somewhat difficult to offer advice without more information regarding what you are trying to accomplish and what programming language you are working in.
>>42413
GPT is not the answer for everything.
Special Agent Bob · 2025-06-21 21:03
>>42325
Just call whatever decryption protocol/program you need to.
>program wants to talk to gayniggers.com
>program needs API keys for such, but are hashed
>program calls other program (or function, routine, w/e) and captures it's output
>program uses the decrypted key
Seems simple to me but I've never worked with API keys so maybe I am missing something?
renames · 2025-06-21 23:24
>>42414
My plan was to write it in Common Lisp, since I didn't expect that to be much code to write and I still want to understand the code I'm using anyway. If such a thing is completely unattainable or unrealistic without some specialized library, I would also be fine with Python or C++. Regarding the project itself, my idea was more or less a joke, where the program parses a small website for content (a subboard of a textboard for example) and learn to form sentences that use the same word as e.g. used in the board culture of the text board. I'm aware that it needs more elaborate machine learning stuff to actually form sentences that make sense, it's more about the particular words and maybe idiosyncrasies in that board culture. This is what I mean with a "sophisticated markov chain", maybe there is something in-between a markov chain and GPT which I can implement in a week or two.
The Plague · 2025-06-23 09:35
>>42412
>I would look it up in a search engine if I had the search terms/vocabulary to search with. Any clues?
I would grab the book Artificial Intelligence: A Modern Approach and have a look at the TOC [1]. Granted, it's a huge book, I would not read it all, just the relevant parts, I would start right at Chapter 23: Natural Language Processing, jumping back to the relevant chapters on probabilistic programming and Machine learning as needed.
I offer this as methodological advice to find the terms of your search, not as a solution to your concrete problem.
[1] https://aima.cs.berkeley.edu/contents.html
bit · 2025-06-30 18:54
>>40486
before you read this please note that i am not very good at communicating like a normal human being and may come off strange and like a bunch of incomprehensible rambling, i apologize if you dont know what i'm talking about, believe me, i don't either. i am extremely unskilled at anything computer related and not confident in what i say
i was afraid to start a new thread for this because i don't know if this inherently qualifies as its own thing but i wanted to ask what kind of simple "tutorial programs" (the kind of things you don't really use but just make to learn with) are decent to help a beginner get the hang of a given language? right now i'm starting work on a very barebones simple word processor in C# that exports to a custom encrypted filetype called Project Enigma, but i seriously doubt i'd ever use it for any actual message encoding or anything. what kind of stuff like this should i write in the future to get better at this sort of thing?
progn · 2025-06-30 19:36
>>42498
you can try your hand at making a few project euler programs
Hagbard Celine · 2025-06-30 19:43
>>42498
https://projecteuler.net/
sorry forgot link. if you can do all of these youre a master problem solver and programmer
>>40617
i'd argue for learning a scripting language with good libraries like perl, ruby, python, or lua. as well as learning C and/or C++ for lower level stuff.
as far as ways to learn go, start with a top down approach, dissecting source code from a game or whatever you like- for example minecraft, modding the game yourself to implement a feature you want. then read up on stuff like graphics, game design, UI, ETC and modify other stuff, maybe eventually writing something from scratch.
Frank Garza · 2025-06-30 19:48
>>42499
>>42500
>project euler
>master problem solver and programmer
i did a bit of digging and i'm going to be completely honest while i appreciate the advice there is nothing on that website that makes any sense to me - not sure if it's just because i was terrible at math when i was in high school or because this involves programming that i don't understand
if you want me to be honest the only programming knowledge i have is in c# winforms utility apps that do oddly specific things like randomly generate a pallette of colors or allow you to type with your mouse (these are some of the ones ive made)
Haruyoshi · 2025-06-30 20:57
>>42501
you know what im starting to think this project has actual value since it seems fun to play around with i might release it to the public, its WAY bigger in scope than any of my previous projects.
it's a shame that i don't know soykaf about github and how to release things on it
Koichiro · 2025-07-01 00:15
>>42502
you can just make an account and drag&drop your project on the website to upload. Skips the whole versioning system you supposed to use git for but just publishing quick is trivial
JARGON · 2025-07-01 01:44
>>42503
ok that doesnt seem too hard
Tak_0 · 2025-07-02 08:10
>>40617
Start with low lvl programming. Some C, for example. Mb go for rust or, if you feel extra niche - try nix.
Gyula Kovacs · 2025-07-03 14:42
>>42515
enigma anon here; do you think starting with C# (almost exclusively for the purpose of winforms) was a bad idea? i seem to be learning and functioning just fine with it, but did i bite off more than i can chew?
Debbie Charteris · 2025-07-08 06:45
div can be moved with
>div.style.translate = '0px 50px';
is it the only way? would like to avoid the browser parsing a string on every. single. update.
Linda Lee · 2025-07-11 11:17
You guys probably get this a lot, but would anyone be so kind as to explain to me exactly what is POSIX and how I would go about making my programs POSIX-compliant?
Ivan Petrov · 2025-07-11 13:15
>>42579
POSIX is a standard that defines various utilities an OS should have. If your OS is POSIX-compliant, it means you can safely make assumptions about how it will behave. For example, you can safely assume that readdir will work the same way on a Linux, BSD, or OS X computer. Unlike the similar getdents , which isn't standardised. Basically, an OS claiming POSIX-compliance is making a promise to implement all specified functions as specified.
"Making a program POSIX-compliant" usually means "only depend on POSIX-defined functionalities", and not system-specific ones. The advantage is that your program will run on many different systems. The disadvantage is that your program cannot use system-specific features. Depending on your program, that may or may not be a problem.
Note that the "OS", as defined by POSIX, doesn't refer only to the kernel but also includes the shell, standard libraries, and command-line utilities (hence the GNU+Linux copypasta).
>how I would go about making my programs POSIX-compliant?
Before using an OS function, check whether it is defined by POSIX. Linux man-pages typically include the information in the "STANDARDS" section.
For shell-scripts, you can test them with yash that sticks close to the standard and doesn't add extensions.
Zuse · 2025-07-11 14:30
>>42579
One way to get a quick summary of what POSIX provides is to look at the documentation for POSIX.pm. It's a Perl module that wraps most of the POSIX functions and constants, and the docs for it provide a good summary.
perldoc POSIX https://metacpan.org/dist/perl/view/ext/POSIX/lib/POSIX.pod
Sabo Engle · 2025-07-11 16:36
Is the cock.li SMTP server down? Can't check, the receiving works well, but the sending fails.
Zero Cool · 2025-07-12 13:24
>>42581
>>42582
much obliged
Technician · 2025-07-12 13:38
>>42583
I just tested sending via cock.li's SMTP, and it was fine. I received mail from cock.li seconds after sending it.
Demeere · 2025-07-15 07:09
>>42582
perl such a wonderful thing, thank you for this anon.
Zuse · 2025-07-16 15:10
I tried reading The Art of Computer Programming since it's in my college's library, but the mathematical preliminaries are giving me headaches and I'm starting to get really frustrated. I wonder if I should giver up or maybe learn some calculus first; maybe skip the first chapter entirely?
Hitomi · 2025-07-17 04:52
>>42515
This is incredibly bad advice. Beginners should start with something beginner friendly. Low-level programming languages are notorious for NOT being beginner friendly. If all you want to do is learn they are fine, but as a beginner for anything practical you don't want to start there unless you expect to stay there.
>>42526
C# is essentially java. If you want to become a good programmer and you've already created a few functional programs I would move to something like Python or C++. Also learn the fundimentals before doing anything else.
Language hopping is something you should do right around journeyman level. Or at least after you've learned enough to pump out more than "Hello World!".
Cereal Killer · 2025-07-17 17:18
>>42620
You can try reading Knuth's Concrete Mathematics first, instead. Also, you can skip the mathematical preliminaries, you might not be able to follow some arguments later on, but you can always go back for reference.
Don't feel as if you need to understand everything in the book, but do make your best to understand as much as you can. Later you can go back and give it a second read, maybe after you have covered some gaps in your first reading.
You can also learn some calculus first, it will develop your mathematical maturity somewhat, but it's a bit of overkill, moreso for learning programming where you have nearly no use of calculus whatsoever. Better to read Concrete Mathematics instead.
cond · 2025-07-31 17:52
I found that low-level programming languages were actually easier to grasp when I first started out, mainly because newer languages involve a lot of abstraction. For instance, C is often much more straightforward to understand and work with compared to languages like Java or C#.
It's much easier to fully comprehend and implement a C compiler within just a few months of learning programming. On the other hand, creating something like the JVM (or better yet, something even more properly OO like smalltalk) typically requires a few more years of expertise and knowledge—unless you happen to be above average in intellect. it's on par with writing a medium-sized AA- game engine.
So, why am I bringing this up? It's crucial to understand how the tools you use work in order to utilize them effectively. and while any beginner can write basic programs in these languages, they can't exactly properly utilize them for anything major unless they have a deeper understanding of how these languages work.
typedef · 2025-08-01 15:36
Would it be a stupid idea to write an important project with an obscure language like smalltalk?
nibble · 2025-08-03 01:57
Are there any concrete books to teach you about writing allocators &/ memory management in general? I looked through the books thread, but didn't really see anything obvious. And general searches don't really yield anything useful either.
vector · 2025-08-07 10:06
>>42701
If it's up to your discretion and you think it will make the project successful, do it. I've written code in Common Lisp under similar conditions.
Tank · 2025-08-07 10:12
>>42715
I don't know of a comprehensive book, but I'd recommend the following:
- Read some blogs and guides on how malloc works internally.
- Implement a simple malloc. (Common CS project.)
- Create an object pool in a garbage collected language.
- Implement reference counting.
Jane Doe · 2025-08-22 01:49
How does one get started with development for high frequency trading? i tried researching about it and I got a lot of different answers, I'm not sure if I'll be able to dedicate myself to all of it.
Church · 2025-08-25 03:31
Hi Lain. I have a question about webapp architecture.
I would like to build a web application which does not require Javascript on the client, but at the same time has a REST backend with all the domain logic so that other frontends (CLI, mobile app, etc) can interact with it.
I have two solutions in mind:
1. A core REST backend and a second webapp backend that interacts with it over HTTP and generates server-side rendered HTML pages for the client
2. A core domain+infrastructure library which is imported both by the REST backend and a classic webapp backend, that are deployed independently and do not interact.
I prefer option 1, since there is only one service that interacts with the DB, potentially Kafka, and other services. However, I have never heard of this design, and maybe there is a better option that I have not considered. What do you think?
Colmerauer · 2025-08-25 05:52
>>42854
I fail to see the advantages in option 1. It has overhead (webserver sends an http request to the backend, requests will be cached on both servers), and I don't see how it makes development easier.
I would prefer option 3. Have a single applications that serves either json/xml/other structured data or html depending on what the client requests.
Zero Cool · 2025-08-25 07:01
>>42855
Thanks for your answer. The main advantage would be avoiding a monolith, separating and decouping the core and presentation layers in different services, which can potentially scale differently. The overhead is there, I agree, however it may not be the bottleneck, and if it is one may try different protocols like gRPC or mitigate it differently. I agree that developement woule be just as easy if instead of getting data from HTTP I called a function in the same process.
Regarding your solution, I imagined a situation where the REST API may have different endpoints than the application webpages. For example, an accounting webapp may have a Accounts page that needs information from different sources (for example, the name and profile image of the user to show on the top, the user's preferences, and other things), while the /accounts REST endpoint simply returns a list of accounts with no additional information. So one one hand it feels wrong to me to put them under the same endpoint. On the other hand they are in fact different representations for the same resource.
I will need to consider it more, thanks for the insight. I have never done anything like this, being just a backend developer, and I don't want to "invent" solutions that do not solve any problems and actually make the project more complicated to work with.
BloodCat · 2025-09-04 22:42
any book recommendations for learning lambda calculus? not from a programming perspective but from a formal perspective
Agent Jones · 2025-09-05 18:53
>>42898
Barendregt is second to none.
Joey · 2025-09-18 11:03
>>42898
type theory and formal proof: an introduction
and formalize the stuff you've learnt from there in Coq
Special Agent Bob · 2025-09-30 04:00
gamedev isn't quite /tech/ i guess it fits more here.
i want to implement rm2003 autotiles. but first reason about them. pic related. how is 47 the final number of combinations. how my manual generation is so irregular. looks more complex than it should be. maybe no one will ever reply me. maybe it's supposed to be complex. maybe i'm being dumb even posting this.
(the tree top is the top-left tile, 2nd level is top-right, 3rd is bottom-left, 4th is bottom-right)
Cypher · 2025-09-30 05:42
>>43250
The way I would enumerate these would be something like that:
Helper function:
possible_sides(temporary tile, side) -> set of tiles
1. If side is past the last side,
2. Then return {temporaty tile}
3. Else, if both corners of side are filled,
4. Then return the union of possible_sides(temporary tile, next side) and possible_sides(temporary tile with side filled, next side)
5. Else, return possible_sides(temporary tile, next side)
enumerate_tiles -> set of tiles
1. Enumerate on the set of wall/empty corners (2^4=16 possibilities)
2. For each set of corners,
3. Create a temporary tile with the corresponding corners filled and the sides empty
4. Append to the output the result of possible_sides(temporary tile, first side)
5. End for
That would generate something like this (O denotes the center of a tile)
1.
O
2. ┏
O
3. ┓
O
4. ┏ ┓ ┏━┓
O O
5.
O
┗
6. ┏ ┏
O ┃O
┗ ┗
.
.
.
16. ┏ ┓ ┏ ┓ ┏ ┓ ┏ ┓ ┏ ┓ ┏ ┓ ┏ ┓ ┏ ┓ ┏━┓ ┏━┓ ┏━┓ ┏━┓ ┏━┓ ┏━┓ ┏━┓ ┏━┓
O ┃O O ┃O O┃ ┃O┃ O┃ ┃O┃ O ┃O O ┃O O┃ ┃O┃ O┃ ┃O┃
┗ ┛ ┗ ┛ ┗━┛ ┗━┛ ┗ ┛ ┗ ┛ ┗━┛ ┗━┛ ┗ ┛ ┗ ┛ ┗━┛ ┗━┛ ┗ ┛ ┗ ┛ ┗━┛ ┗━┛
Kay · 2025-09-30 10:27
>>43250
nah i'm done with algorithms i just took pen and paper and wrote the look-up table by myself. looks neat and probably computable, who knows.
>>43253
sorry i don't get this
cond · 2025-09-30 10:48
>>43255
looks a lot more regular now. how do you call these binary patterns that emerge?
Cereal Killer · 2025-10-01 05:28
>>43255
>i don't get this
NTA, but it's kinda basic. What part confuses you?
J.C. Denton · 2025-10-01 09:45
>>43253
>>43255
I kind of brainfarted, the recursive part is a useless complication. You could just enumerate on all possible tiles (with each possible mix of sides and corners), and eliminate the bad ones. The result is pretty much the same, and probably not even slower.
>>43256
I have no idea what that table is about. Idk if that pattern has a name. What are the numbers?
Random · 2025-10-01 12:25
>>43265
It would look more regular by enumerating corners (and sides) in "amount" order.
0001 0010 0100 1000 0011 0110 ...
Instead of the regular binary counting order. I'm not redrawing that table though
Drifter · 2025-10-01 21:55
>>43265
each tile has 8 neighbours, represented by 8 bits. diagonal neighbours are the lower hex digit, immediate are the higher (iirc). the most significant bit is the upper-left and top, but i have probably messed up the endianness variously in the process so the table may be buggy. i need to map the invalid/redundant/non-unique combinations to valid there're only 47 of. this is what the table is about. i want to prerender just 47, not 256.
it's still an open question for me how to get the 47, each of them, not just by brute force, but algorithmically. i have something in mind to try eventually, thanks. prob no help needed anymore.
the binary patterns i'm asking about are also used in bytebeats extensively. e.g. the 42 melody. experiment with Z in the x & Z function (with bitwise &), pic related.
Boole · 2025-10-01 22:01
>>43268
forgot the pic
also i want to generate the table as well, if possible, besides the 47. that's why i'm interested in the patterns.
Fred Nurk · 2025-10-03 05:27
>>43268
there was a sierpinski triangle all along, having found the regular pattern i can calm down now. generating the graphics proved cumbersome due to the weird chipset data with multiple variants for almost everything and 11 of the combinations being completed right there, so i guess, in the end a couple of manually written tables is not that bad...
Dozer · 2025-10-07 09:44
c
// interp.c
#include <stdio.h>
int main(int argc, char **argv) {
puts("hello world");
if (argc > 1) puts(argv[1]);
return 0;
}
plaintext
$ clang interp.c -o interp
$ patchelf --set-interpreter /tmp/interp any.dynamic.elf
$ ./any.dynamic.elf
Segmentation fault
$ dmesg | tail -n1
[43178.023511] Code: Unable to access opcode bytes at 0xffffffffffffffd6.
I guess the problem is clear here? Debian 12 x86_64
Koos van der Merwe · 2025-10-07 11:54
>>43287
The interpreter cannot be any executable. In particular, it cannot rely on dynamic libraries being loaded (puts and exit are libc functions), because it is its job to do so.
Consider (assuming x86_64 calling conventions)
// interp.c
void _start(void) {
const char *msg = "hello world\n";
// write(1, msg, 12)
asm volatile ("syscall" :: "a"(1), "D"(1), "S"(msg), "d"(12) : "rcx", "r11", "memory");
// exit(0)
asm volatile ("syscall" :: "a"(60), "D"(0) : "rcx", "r11", "memory");
}
$ gcc -nostdlib interp.c -o interp
$ patchelf --set-interpreter /tmp/interp any.dynamic.elf
$ ./any.dynamic.elf
hello world
Moony · 2025-10-13 23:17
What do I do with my imp of perversion?
I want to code. I want to have at least one cool skill before I die. Problem is: I don't know what I want to code. Another problem: It for whatever reason has to be in assembly even though the language is severely outdated and easily replaceable in all its functionality with a few tricks and doodads in any other language. I don't really care about how fast it compiles or anything like that. Give AI a few years and... well. My imp is that it has to be assembly. Without the imp I have no need to code. It's my only means of attack.
Am I 'trying to be advanced' seeing that the language is low level? Are there alternatives other than going ape soykaf on some esolang? Should I go easy on some other language and try to create my own language? Should I treat my imp with care or should I 'get real'?
setq · 2025-10-14 13:00
>>43319
>I want to have at least one cool skill before I die.
Pick something much cooler than 'coding' then. It's boring as hell over here. Why not buy a skateboard?
Hagbard Celine · 2025-10-14 23:10
>>43319
Do you need money? Assembly won't help you, learn something useful instead (welding, web programming, medicine, ...)
Do you just want to have fun, by all mean learn assembly and do something cool with it. Don't learn (modern) x86 though, it is like kicking dead whales down the beach.
Shogun · 2025-10-15 00:45
Rate my fizzbuzz
The first one only took 4 hours
The second one took 15 whole minutes
#!/usr/bin/perl -w
use strict;
for my $num (1 .. 100) {
my $mod3num = $num % 3;
my $mod5num = $num % 5;
my $result = "";
if ( $mod3num == 0 ) {
$result .= "fizz";
}
if ( $mod5num == 0 ) {
$result .= "buzz";
}
if ( $result =~ /z/ ) {
print "[$num] $result\n";
} else {
print "[$num] $num\n";
}
}
#!/usr/bin/perl -w
use strict;
for my $n (1 .. 100) {
my $nm3 = $n % 3;
my $nm5 = $n % 5;
print((!$nm3 && !$nm5) ?
"[$n] fizzbuzz\n"
: (!$nm5?
"[$n] buzz\n"
: (!$nm3?
"[$n] fizz\n"
: "[$n] $n\n")))
}
Moony · 2025-10-15 01:54
>>43321
>>43322
I'm slaying the imp. While failing to find any books at my local library about assembly I found a ton of self-help books about coding. Hopefully I'll find a bit of a more realistic language if I finish a couple of these. Code academy has a course but it costs a billion trillion dollars.
Otto Normalverbraucher · 2025-10-15 04:15
>>43324
Well of course local library won't have anything good.
A fun book was 'x86-64 Assembly Language with Ubuntu' by Ed Jergensen. Do all the exercises, they're all quite fun, I don't remember if this was an exercise or something I did myself but I remember writing a 'bubble sort' algorithm with assembly. Was very proud of my mole hill of a program.
Trinity · 2025-10-16 02:35
I just realized that brushing long hair with a fine comb is basically a merge sort.
Start with a thin lock. Carefully brush it tip to root. Drop the sorted lock, it will retain the ordering. Repeat with another thin lock. Merge both and brush lightly into a medium lock. Repeat recursively.
You could start with a single strand instead of a thin lock. The algorithm will technically work, but will take an unreasonable amount time. Instead once the number of strands n drops below a threshold you switch from an algorithm with slow growing f(n) and large C to an algorithm with fast growing f(n) and small C.
Judge Fang · 2025-10-31 05:13
If you're making a desktop, GUI application, how do you handle settings? Is just a text file acceptable? Is making a whole interface, that edits a configuration file anyway, worth it? Does it depend on how complicated the settings are?
A terminal UI for setup might be a nice compromise, but if it's not a terminal app otherwise, it doesn't really work well. You can't reliably open a terminal emulator, from a GUI, in a cross-platform way.
But if the application only has a text file, users have to read something to figure out how to set things up, and I'm not really targeting developers. But GUI programming is such a pita, so if it could be avoided...
Dr. X · 2025-11-01 13:20
>>43324
>I'm slaying the imp. While failing to find any books at my local library about assembly
Programming From Ground Up is good. So is Motorola 6800 ASM or Zilog Z80 asm. Or asm for your favorite retro console (* be sure to pick a console that has large homebrew scene, I recommend C64).
>https://download.savannah.gnu.org/releases/pgubook/
You should also checkout Forth programming language.
>http://www.forth.com/starting-forth/
>http://thinking-forth.sourceforge.net/
>https://vfxforth.com/arena/ProgramForth.pdf
Boris Grishenko · 2025-11-08 08:19
This probably doesn't qualify as a programming question, at least not directly, but I'm doing it anyway. How do you guys deal with sitting posture problems when programming? Do you use more than one monitor (if so, how do you deal with discomfort)?
>already have an extremely comfy set up where you don't even need to move your elbow while programming
>force yourself to have static perfect posture
>adjust constantly because of the pain (my case)
>don't mind about it
My neck and lower back hurts so much and I'd like to know if anyone here has the same problem. My posture isn't bad per se, but I keep having to adjust the chair all the time.
XERXES · 2025-11-09 10:44
>>40486
When compiling C with clang I get this 'warning: unsafe buffer access --> buttonstate[button] = (uint8_t)bDown'.
I tried putting in an if statement to check the array index but the warning still persisted.
I then used a switch case, which seems to solve the warning.
Are these two approaches identical in solving the buffer access?
Which I think is when you input a index larger than the size of the array?
I read somewhere that switch cases are assembled differently by the compiler compared to if statements.
C
void HandleButton( int x, int y, int button, int bDown ){
//int arrlen=sizeof(buttonstate) / sizeof(buttonstate[0]);
//(button < arrlen) ? buttonstate[button] = (uint8_t)bDown : printf("buttonstate out of bounds");
switch (button) {
case 0:
buttonstate[0] = (uint8_t)bDown;
break;
case 1:
buttonstate[1] = (uint8_t)bDown;
break;
case 2:
buttonstate[2] = (uint8_t)bDown;
break;
case 3:
buttonstate[3] = (uint8_t)bDown;
break;
case 4:
buttonstate[4] = (uint8_t)bDown;
break;
case 5:
buttonstate[5] = (uint8_t)bDown;
break;
case 6:
buttonstate[6] = (uint8_t)bDown;
break;
case 7:
buttonstate[7] = (uint8_t)bDown;
break;
default:
printf("buttonstate out of bounds");
}
lastbid = button;
lastbuttonx = x;
lastbuttony = y;
if( bDown ) { keyboard_up = !keyboard_up; AndroidDisplayKeyboard( keyboard_up ); }
}
Also can't seem to use this code[github.com/cnlohr/rawdrawandroid] to display anything in an android app.
I had a look at the test.c which runs OK, took out parts that I thought were mandatory, but nothing shows up just a dark screen. Logcat has some warnings but no errors.
https://zerobin.net/?bbe4cbe94fe9d601#ubdiLbijbqP69B4XMIlgO1MZgVW+WQ0WS+wxaKtgP0M=
Cowboy · 2025-11-09 11:29
>>43478
button can be negative.
If you know that button is never out of bounds, you can just put a pair of asserts before the assignments. assert has no overhead in a release (with NDEBUG defined), but will suppress some warnings and helps with debugging.
C
assert(button >= 0);
assert(button < 8);
Agent Smith · 2025-11-10 01:14
>>42075
>skip some of the continuous math like calculus or physics
Yeah, true if one is interested only in pure software. But if one gets interested in electronics and radiowaves or some deep control engineering or any physics-related stuff, I wouldn't skip.
>>42579
> what is POSIX
It describes a system loosely based on UNIX system V by AT&T. Due to historical reasons, unixes were the most spread out operating systems. But everybody was making their own version of it. US gov't was/is a big unix customer and wanted at least some kind of standard.
You would think that one simply asks AT&T, but they kinda dropped the ball big time.
>>43471
Lift free weights if you can. If one is very weak (aka normal modernly living person), even static comfy holds can start to hurt. If one gets stronger, the submaximal work your muscles do while sitting get much more submaximal.
Jim Hilger · 2025-11-10 05:08
>>43471
i started paying attention to this when i got my first job at 18 and experienced first neck pain because monitor was below my head and i had phone posture looking down. Putting the monitor higher solved it immediately. Next came neck pain from sitting to far and hovering hands in front, sitting closer fixed that.
Outside of that i started reading studies etc, in summary:
shifting posture regularly > static posture, standing up and move frequently to give a break. If you cant maintain good posture force it: buy a gym ball for ~$20 and start sitting on it. Don't sit on it permanently but treat it as a exercise. It really works surprisingly well to get a good posture and since its a ball you constantly shifting posture on it which is why its more like exercise as muscles have to work to maintain balance. When i got pain from sitting too long in bad posture i sat on gym ball and it went away. Nowadays i dont sit bad and dont get any pain anymore so i stopped using the ball but gym ball was cheapest best help i got.
And to avoid any confusion: https://en.wikipedia.org/wiki/File:Weighted_sit-ups_on_an_exercise_ball.jpg this is what i mean with gym ball.
Just make sure its big enough to sit on and reach desk comfortable.
Hiro Protagonist · 2025-11-10 10:10
Not quite a beginner question but I could not find an appropriate thread for this is in the catalog: does anyone here have experience in programming a brain-computer interface (BCI)? To be more specific, I am talking about BCIs in an O&P (orthotics and prosthetics) standpoint.
If you have programmed a BCI so that, say, an artificial hand follows instructions, what tutorials or resources did you use to learn how to write your code properly?
Hopper · 2025-11-11 13:04
>>43490
Thanks, anon. I'm kind of strong though. I can bench press 150 kg (PR) without defecating my intestines out (but almost). The thing is my neck and back. When I'm sitting, those two starts aching like hell, I get stiff necks all the time and I'm very tense.
>>43491
Awesome, thanks! I'm going to try the gym ball asap. Putting the monitor higher helped a bit, but still. I guess it's just natural to shift posture though, it's just annoying.
() · 2025-11-13 12:51
>>43497
what do you mean BCI? theres many ways to pick up a signal from the brain via a Biotransducer (the scientific term ig), be it muscles AP (Action potentials) by EMG, FSR (force sensitive resistors) to measure muscle contraction, ultra sound, electrical impedance measurement, infrared (although if you send energy into the body for a sensor it might be harmful/might cause cancer), or you measure nerves directly either intrusive or non-intrusively. I had a course in uni about limb prostetics where they loosely gave a summary about both the robotics and mechanics and forward kinematics as well as the interface between the human and the prostethics.
A fun exercise was when we were given an EMG signal in a matlab .mat file and we needed to process the signal. EMG signals correspond to small voltages between MU (muscle units) and the surrounding flesh (reference signal), and you can have a whole array of electrodes on the skin. Our signal had 32 channels so 32 or 33 electrodes if you need an extra for the ref signal. I used python and loaded the file with scipy.io.loadmat, reshaped the signal data and then plotted the signals and the RMSE over 50ms and 200ms from a convolution (root mean squared error is basically the average variance) and cross correlations of the mean signal against the ref signal, which is obviously high since the voltage is between the measuring electrodes and the reference electrode so theres a high correlation.
Yet modern solutions usually use very simple algorithms like that instead of ML because nobody is williing innovate or dumdum regulations.
I bet you need a lot of knowledge about electronics, anatomy and biosignals for sensors; mechanics for prostetics; machine learning, stochastics and python or whatever for signal processing if you want to make a BCI system.
Theres also something called human machine coadaptation, the human must also learn how to send the correct signals, and its good if its not only intuitive and quick to learn but the successrate is also consistent (low variance over time ig).
Hope this helped.
Von Neumann · 2025-11-13 15:11
>>43523
>what do you mean BCI?
I actually made an oekaki demonstrating the type of machinery I was talking about, but it disappeared when I hit the 'Post' button. Not sure why but it would have cleared things up so I made a new one.
To more concretely answer your question, I am talking about non-invasive tools like a headband which will read what electric signals a person is sending and then make the intended prosthetic respond appropriately.
>Yet modern solutions usually use very simple algorithms like that instead of ML because nobody is willing to innovate or dumdum regulations
Actually, there was recently a young guy who used machine learning to decipher the electric signals: https://youtu.be/qCneHcGlZTY?si=aUaO1MBNZttGP0aV (sorry for directly linking to y*utube)
Maybe I will do something like this as well since there's really no valid reason not to, but for now my main concern is gaining knowledge on programming instructions for the BCI once the signals come in.
>python for the BCI system
The first thing I saw about this stuff was indeed python, but I want to do any and all of the required programming in C. If that's not possible then I'll cope.
>human machine coadaptation
I haven't heard of that before so I will surely look into it.
>Hope this helped.
It certainly has! I have been checking on this thread daily for a reply, so I was happy to see there were multiple paragraphs instead of a single incomplete sentence. Thank you!
JARGON · 2025-11-14 04:13
>>43525
I wouldnt make a headband but an armband. Maybe youve seen the elon musk neuralink video of him hooking up a monkeys brain with electrodes. They trained him to control a game with conditioning and showed the signal data of probably less than a hundred channels. But I bet the brain signal the monkey has to send out are very unintuitive, like it has to force its brain to think or concetrate in a specific way. Its unlike when you move a muscle and you will probably never become as proficient as with moving a real hand as a baseline, with the kind of sensors we have for brains. If the amputation is transradial you can just pick up the muscle activity in the forearm, otherwise if its transhumeral or more proximal (learn anatomy ig) you probably want to pick up nerve signals albeight I dont know much about that. Its probably something invasive if you want high resolution nerve signals.
The bottleneck for now is the control system/the sensors. Robotics are mostly possible even if motors are quite loud because of the need of gearboxes to increase the torque of conventional motors.
In the video you clearly see, hes having trouble sending the correct signals xD
Also as I see it you are already coping if you think you can just "program" a BCI. At the very least you need a bunch of sensor data.
Dujour · 2025-11-14 05:26
>>43525
Ive been looking through my lecture notes again and saw this book mentioned "Biosignal and Medical Image Processing By John L. Semmlow, Benjamin Griffel". Have skimmed through it, and seems the lecture was using a few images from there like picrel.
Random · 2025-11-14 07:13
>>43529
Well then it would appear that my original question was wrong. It's not the BCI that I'm programming but the prosthetic itself once it receives the signals. The BCI would have to, like you said, provide an immense amount of data that can be interpreted accurately, which would require either taking data from someone else or training the BCI on my own using multiple people.
I'm glad you made that distinction because I was about to approach the task entirely incorrectly.
>>43530
I'll have give that book a read myself. Thank you for bringing it up!
limited · 2025-11-14 07:17
>>43531
>Well then it would appear that my original question was wrong. It's not the BCI that I'm programming but the prosthetic itself once it receives the signals
youre so hopeless
push · 2025-11-14 08:50
>>43532
>youre so hopeless
What the hell are you talking about.
Naomi Nascimento · 2025-11-14 12:17
sorry if this is a repeat post but anyone have any ways to like stay motivated to learn
i have been wanting to learn C for a long time and ive downloaded like several courses and books and stuff (for free ofc) but everytime i try to get into the groove of learning it all seems so much and i end up just browsing lainchan or playing videogames or some soykaf what do lainons reccomend?
Hopper · 2025-11-14 13:11
>>43534
>anyone have any ways to like stay motivated to learn
You need to have personal project idea(s) and goals. You need to then start learning for a reasonable amount of time each day (if you can). I suggest starting with 1 hour each day but make sure to do it the same time each day. You can also try switching the language but make it a rule that you can only change it once. The reason for switching to another language is that you can get results faster and more easily (which keeps you motivated). I suggest Python but other "scripting" languages work as well (examples: Lua, Perl).
Mitnick · 2025-11-14 15:35
>>43534
also remember that soon youll have to make money or be living on the streets.
Yamaoto Toshi · 2025-11-14 19:57
>>43535
iim like married to C but that may be my downfall i just like dont know soykaf abt programing so its like from scratch two
Vasya Pupkin · 2025-11-19 14:48
>>43534
>>43537
It's a meme, and not entirely without reason, but if the most daunting part of task is to merely begin, its coding challenges really are a good starting point.
For >>43534 specifically, you need to avoid distractions. When programming, make sure that you are only doing things directly related to programming.
t · 2025-11-19 21:13
>>43534
Same here.
Literally looking up books right now.
I could make something by burning myself out and have done so before but it never translates into actually getting and enjoying programming,
It's a mixture of trauma. fugue state and dissociation. i start seeing programming as bad and end up fighting myself to get back at it.
Even though part of me enjoy it. it still have to tackle myself quite violently to even consider keeping the interest.
>>43535
Doing a little everyday doesn't work either in my case because it's not just programming, i have trouble forcing myself to brush my teeth. i also starve myself if i am not careful, people label that as ADHD but i am not sure i agree.
Constructing a routine is itself an impossible project an immense stressor. how can you build a pyramid when you didn't figure out how to not get eaten by crocodiles ?
>>43534
I think limiting stress is key keep the scope very small. do not learn everything at once, don't do anything out of obligation or because something bad will happen.
It should be fun and natural and not grunt work in the heat,
With that being said i am gonna do a bottom up approach and see how it goes this time,
Tank · 2025-11-21 05:53
sh
#!/bin/sh
printf 'content-type: text/plain\r\ncontent-length: 132\r\n\r\n'
echo 'loading 0%'
sleep 1
# truncated. your request looks automated. post discarded.
sleep 1
echo 'loading 90%'
sleep 1
echo 'loading 100%'
python -m http.server --cgi
Expectation: browser displays parts of response as they arrive.
Reality: browser shows nothing for 10 seconds. curl is alright though.
Is there nothing I can do to ensure the expected behaviour?
Zhora · 2025-11-21 10:35
>>43551
It seems like firefox waits until has received 1kiB of data until it will display anything. I don't know whether that amount is hardcoded or not.
sh
#!/bin/bash
printf 'content-type: text/plain\r\n'
printf '\r\n'
for i in {1..64}; do
printf '0123456789ABCDEF'
done
for i in {1..10}; do
echo 'loading '"${i}"'0%'
sleep 1
done
Mitnick · 2025-11-21 11:44
>>43552
Hm.. This works on chromium as well. I just didn't send enough. Thank you. Time to test over Tor.
Dozer · 2025-11-24 05:39
Is text-decoration hardcoded for links in Firefox? The screenshot isn't accurate because
>It’s impossible to override text-decoration due to :visited restriction.
But on unvisited, :link etc. it's that way as well. Probably fighting with my own privacy settings...
Switch · 2025-11-24 06:48
>>43560
I don't know what you're up to, but things work fine here
quote · 2025-11-24 07:51
>>43561
thanks for a site I never knew of
x<->y · 2025-11-28 11:13
>>43513
Holy smokes, you are stronger than me. I guess you should listen to other posters.
I suggested free weights precisely because they also train small muscles used for balance, but the gym ball thing anon mentioned also does that.
Anyway, I sit a lot in front computer and my pains were greatly reduced when I began to lift and run.
>>43534
Learning C can be a grind. Lower expectations and start learning for the love of the game. Aim to learn C in 10 years, not 10 months.
Maybe it's best if you also stop videogames or any other addictive behaviour. I'm IT student rn and I can't play any vidya, because I get these feelings that I should be doing something more useful. To be fair, I also browse lainchan from time to time.
Learning programming is fortunately also very satisfying.
The Phantom Phreak · 2025-11-28 11:45
>>43573
> Maybe it's best if you also stop videogames or any other addictive behaviour.
Also please stop touching yourself, for the love of Holy Redeemer enthroned in glory, One who bore the cross for us, Lamb who reigns forever, Eternal Shepherd, Savior who hears even the faintest cry, Almighty Christ who watches from on high.
Acid Burn · 2025-11-28 11:54
>>43574
He may have borne the cross, but I will keep crossing the dress.
Mentat · 2025-12-01 07:54
I wrote a very simple program, which reads a config and does stuff. However, I don't know whether parsing the config each time is actually good. Would caching the config structure on disk be better? It might be, but I would still need to read the original config file to compute a checksum to decide if I can load the cached version.
Splicer · 2025-12-01 15:53
>>43594
It's probably faster to read a serialized object/struct than parse whatever your config file is, but that's not guaranteed. Java's native deserialization, for example, is very slow and can be even worse than parsing XML or JSON. The good news is it should be trivial to implement and profile to see which is faster. And even if your language's native serialization is slower, you may be able to find a fast serialization library to use.
But my opinion is you should profile your entire program first to see if loading the config even takes up enough of the run time to be worth optimizing. Premature optimization is the root of all evil.
cond · 2025-12-10 02:16
How do you get users for an open-source tool on GitHub? I've made something I think is kinda nice, and it would be great if people could use it, but I'm not sure how to get users. For reference it's a TLS proxy server that's faster than stunnel but much simpler and lower attack surface than nginx
x<->y · 2025-12-10 02:23
>>43573
>don't play videogames
>don't watch meaningless videos
>don't watch sport
>everything is meaningless
>only thing i do
>is gold grind irl
>yes need more xp need more money
>thats all that matters
>im at it student
Unnamed · 2025-12-10 14:49
>>43666
Hustle on HN and similar platforms at the right hour (with regards to the US and/or EU timezones). https://github.com/briefercloud/layerform/blob/main/blog/hn-launch-notes.md
Yu-ichi · 2025-12-24 00:25
>>43667
so sad this mindset. i love my computer. I love software. I enjoy software others write. that includes games, social media, imageboards, code editors :)
John Titor · 2026-01-15 13:28
>>40617
Python or Javascript, but I would not know, I agree with anon who recommended you the project euler for logic and problem solving training.
let · 2026-01-22 02:37
>>40486
Data question.
Let's say you have a dataset with 5 labels, 4 of them works with lineal regressions, but the first label has really distant values, lets say [2, 170, 32, 5].
There is no possible way to make a linear regression on that specific label right?, I think I should use a polynomial regression but, is it possible to make a facetgrid with one type of regression and then other?
>pic not related
word · 2026-01-22 13:15
>>43848
so I basically solved my question today by trial-and-error method and learned that it's like trying to measure the weather with a school ruler, linear regression won't be the right tool to use with that kind of data, but a poly regression with a grade 2 curvature works perfect with almost no overfitting. Also it is possible to use a facetgrid with 1 kind of linear regression and then 4 other kinds, I don't have the code here but you can trick mplotlib to do that. I'm answering this because it was a stupid question + perhaps someone else in the future could use it.