[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1718580376832423.png (712 KB, 1160x1413)
712 KB
712 KB PNG
What are you working on, /g/?

Previous: >>103230980
>>
File: 1616065595790.png (1.43 MB, 850x1200)
1.43 MB
1.43 MB PNG
>>103244490
Working on getting Reimu pregnant OP
>>
I want you to understand the importance of using the same kind of quotes used for strings every time.

In javashit if you use backticsk (`) every time, not only do you get all strings ready to be interporlated

let name = `Stupid ${nick}`


Using backticks has no effect on performance.
Using backticks consistently also has one big advantage: ctrl+f
Now you can rest assured your grepping is finding stringy things since you don't have to also account for cases for strings with ' or "
Use backticks every time anon, for your own good.
(Unless you don't use javashit, then you're fucked)
>>
File: 1722898861862958.png (2.08 MB, 3444x2336)
2.08 MB
2.08 MB PNG
working on cunnibre, a calibre ebook fork.
>>
Trying to nudge our lead engineer away from committing crimes on the codebase (microservices)
>>
>>103244708
backquotes are fucking ugly and lame
use perl
my $name = "Stupid $nick"
>>
>#include <std2.h>

YOU CAN'T MAKE THIS SHIT UP
>>
Does it really matter that much that I have a spinlock in my program when most people have a multicore system and the estimated spintime is quite low? Should I bother rewriting my implementation?
>>
File: images (1).jpg (10 KB, 197x255)
10 KB
10 KB JPG
Is it even worth it to learn C noawadays only for "learning purpose"?
I bought pic related out of curiosity but it's all written in C (obviously, I should've known).
I'd rather learn C++ though.
>>
Why do people like python so much? It is like the roman numerals of computer programming.
>>
File: 1723354247544957.png (163 KB, 753x216)
163 KB
163 KB PNG
decent book to pirate to learn cmake, took a few days but eventually the retarded syntax and project structure clicked
>>
>>103245108
It's fine if you don't hit it very often. You may have a problem if you port to certain platforms though, for example the nintendo switch has a scheduler that will never preempt a thread on its own, so if you use spinlocks there's a chance you'll deadlock if one thread tries to lock a lock held by another thread that's running on the same core. Something to keep in mind if you're aiming for maximum portability.
>>
>>103245161
If you don't come away from C++ feeling like you've also learned C, you're not learning C++ correctly.
>>
>>103245216
it's comfy as fuck
>>
>>103245558
>will never preempt a thread on its own
Does it have any safety measures that stops threads that have been spinning for a long time? If you use up all your cores with spinning threads will it just be deadlocked permanently ?
>>
why isn't everyone just using zig? it's as fast as rust and you don't have to worry about borrow checker constraints
>>
>>103245881
and by restrictions i mean it doesn't force you to choose a ridiculously bloated program structure involving arc<refcell<blah<blah<blah>>> to avoid borrow checking restrictions. or alternatively having to go with something that doesn't involve cyclic structures
>>
File: Clipboard01.png (424 KB, 1165x431)
424 KB
424 KB PNG
>>103245460
>pirate
it's in 1 euro tier C++ book bundle on fanatical.
cmake is still trash, but it actually works when you're know what you're doing.
>>
>>103245900
find it very weird that people spend 6 hours reverse engineering a crack for a pirate version of some software instead of just paying $10
>>
>>103245900
I'd rather just go on [redacted] and download the pdf than have my credit card info in even more databases. Plus 99% of books are shit that you immediately regret buying 10 pages in.
>>
>>103245912
I don't think people who make cracks even use software they are cracking. it's about scratching their autistic itch.
>>
>>103245934
I pay with paypal. it's literally the only site I've given my card info.
>>
>>103245811
It does not, so if you use up all the cores yeah the program just eats cpu until you terminate it. As a dev you're expected to just not do that. It does reserve a core for the system UI so at least you don't have to reboot the whole device.
>>
>>103245934
>buy paper books
>give up after 10 pages
>use them to line the shelves of my massive library
>people come to my house
>everyone is impressed
>girls want the D
>"oh wow so many books you must be smart tee hee"
>just kidding nobody comes to my
>because i don't have any friends
>and i'm a virgin
>>
>>103245944
Paypal is one of those sites I would never trust with my cc info.
>>
>>103245944
he's coping obviously. nothing is going to happen to your money because you made a payment online. what century is he living in
>>
>>103245881
Because C is better.
>>
>>103245599
And what's the correct way to learn C through learning C++?
>>
>>103245898
because it forces you into a ridiculously bloated program structure
.{}{}.{}
_ = foo;

and the build system kinda sucks... they are just re-inventing the problems with C
>>
File: next_level_pajeet.png (8 KB, 990x466)
8 KB
8 KB PNG
>write small tool that is trying to wipe all deleted files off of a device (HDD)
>does so by writing NUL bytes into a file
>lots of NUL bytes
>initially set allocation size of 200 GiB for NtCreateFile (because people say it allows the kernel to preallocate shit)
>takes four hours and thirty minutes
>probably because of the roughly 1,800,400 write operations it takes the driver to bring 109 GiB to disk
>also can't CTRL+C it because the application is eating glue in the kernel
>next version
>set allocation size to 0
>allocate 4 MiB of zeroes and write them out with NtWriteFile, max size of 100 GiB this time
>50 GB written after 12 minutes
>100 GB written after 24 minutes
>total of 26,612 write operations

In a just world there would now be treason charges against Microsoft's kernel developers.
Just keep that in mind next time you hear someone praise Microsoft, or NT.
>>
>>103244490
I've been building a minimal textboard in JEE 10. Java is nice.
>>
noob question:
how does desuarchive's view same image function work? the it pulls up all the posts with the images/videos attached regardless of filename. i need to replicate it for a project.
>>
>>103246513
Hashes.
>>
>Day ?? of learning Python (supposed to be day 7 but I was busy doing life things)
>Getting filtered trying to write a simple Hangman program
I'm so glad I'm not trying to do programming as a career
>>
>>103245599
>If you don't come away from C++ feeling like you've also learned C, you're not learning C++ correctly.
And if you do, then you are not learning C correctly.
>>
Can anyone recommend some ai related projects for someone wants to get their toes wet in the field?
>>
>>103246642
>>103246513
if you do replicate it, don't be lazy and do a simple hash. There are hashes that work by hashing blocks/sections and while match even if there is a slight crop/color difference/different encoding etc
>>
>>103247154
>>103246642
thanks
>>
>>103247020
What's filtering you?
>>
Ive learned more from one book so far than i did on my own by googling for years
>>
>>103247425
How much time did you spent googling gay porn?
>>
>>103247481
i use duckduckgo
>>
var i = 0

const run = true
while run {
println(i)
if i == 9 then run = false
i = i + 1
}


next up: for loops
>>
File: formula.png (11 KB, 631x549)
11 KB
11 KB PNG
I need some CS bros help here.

I need to find the W and L values from the CI variable.

The CI is the craneal index, which is the medical measurements of a skull.
And that is the formula to derive it.

But I need to width and height measurements.
So I can properly draw it.
Because It's much easier to draw a skull using box measurements instead of the circunference.

Not a homework BTW, I want to draw skulls properly.
>>
>>103248186
You can't, it's a ratio. 2/3, 4/6, 6/9 all have the same ratio.
>>
>>103248186
You cant solve a multivariate equation for every variable with a single measurement.
Given CI, you need a W to solve for L or an L to solve for a W
>>
>>103248543
>>103248500
I have the adult lenght, width and CI data.

I have the age chart CI.

I need to find the width and leght of that chart.
>>
need to make a local build server to compile project that takes few hours to build.
Which automation server I install to it, is jenkins still the goto?
>>
for OPFS what's the best way to deal with absolute paths?
>>
I just started learning programming, but there's so much to learn and so little time. Maybe I should just shut up, dive into programming, and resurface when I reach a certain point. I guess it's pointless to overthink it right now. I'm not used to learning this much.
>>
>can get tray icon for gnome with extensions and using tcl/tk tktray
>can't get any events bound to it
the absolute state of GUI programming in 2024
>>
>>103245697
We need a CapitalistType
>>
>>103250901
Tray items are weird; you're really providing suggestions for something else to render.
>>
>>103251027
>2024
>gay homo DEs can't still do proper trays
normalize punching gnome developers
>>
>>103250456
Incremental progression.
>>
The latest version of chatGPT runs and tests code in real time, and you can watch it work.

Is this the beginning of the end?
>>
>>103245161
c is pretty small language compared to c++
you'll basically learn all of c studying c++, minus a few common idioms maybe, but all the fundamentals about the language you'll naturally learn.
>>
>>103251040
>normalize punching gnome developers
I can agree to that. Or using a studded bat to get a bit of a swing in.
>>
>>103245697
it's not Halloween anymore, stop scaring people
>>
I mean not to be a fag and pester. But can someone help clear up the concept of semaphores in context of thread waits? I understand the concept of a binary semiphore for a normal mutex lock, and even how by setting it to 0 initially you can even make it so it calls back to the parent. But what about setting it past 1? I was told you can somehow use it for counting or something. Like here is what I am confused on going forward sem_init(&thesemaphore, 0, 7). What can you do with this?
>>
>>103251574
it's typical to use this when implementing a message exchange of 1 receiver and N senders
where semaphore count indicates message count waiting in queue
>>
>>103251316
>Is this the beginning of the end?
Have OpenAI fired all their developers yet? If not, why not? Maybe because it's a dumb gimmick?
>>
>>103247857
const run = true

if i == 9 then run = false

War.
War never changes.
>>
>>103250901
>using tcl/tk
based rejecter of modernity
>>
>>103252816
ye I'm retarded I noticed only after posting I forgot to typecheck the interior of the loop. All fixed up now (:
>>
enough bs, i'm "upgrading" sepples from 20 to 17
header bloat is too much to be bearable
>>
File: u.jpg (468 KB, 666x761)
468 KB
468 KB JPG
>>103244490
>>
>MSVC does not support variable array length
>even if the C standard is set to C11
fucking why
>>
>>103252268
Same person different device. Thanks.
>>
>>103253475
because they're an anti-pattern and implementations mandate tradeoffs that aren't worth it
>>
Why is GCC shidding and farding on Clang when it comes to AVX?
>>
>>103253819
because you're using the tools wrong
>>
>>103253829
https://www.phoronix.com/review/gcc-clang-eoy2023/
>>
>>103248186
>>103248639
>I need to find the W and L
>I need to width and height
>I have the adult lenght, width and CI
>I have the age
>I need to find the width and leght
The help you need is beyond the ability of anyone in this thread to give.
>>
File: compilers_are_garbage_3.png (104 KB, 1920x2140)
104 KB
104 KB PNG
>>103253819
Terminal prolapse. There's nothing you can do for GCC.
>>
File: music-from-scratch.png (273 KB, 821x472)
273 KB
273 KB PNG
https://youtu.be/ly5BhGOt2vE
Have you guys seen this? On a C64 he quickly writes a basic program to poke machine code routines. An interrupt routine to configure the SID to output sounds, then he reads melodies from screen RAM to make an instant interactive editor.

I recommend watching from the start, it's enthralling, but if you're impatient here's the bit at the end where he adds the high-hat sound to the program and finally starts jamming:
https://youtu.be/ly5BhGOt2vE?t=1901
>>
>>103245460
Why not just use something like Xmake?
>>
>>103253205
Haskell!
>>
>>103245697
ngl, that looks gross.
>>
>>103245697
Who thought __this__ was a good idea
>>
File: effect.png (32 KB, 1230x231)
32 KB
32 KB PNG
any svelte anons know a less hacky way to do this? simply running a function when a components props change?
>>
>>103254728
sir the webshitting general is this way >>>/g/wdg
>>
>>103255106
sorry sir i did not know there was a designated webshitting thread
>>
>>103254038
God Commodore BASIC is ridiculously primitive compared to BBC/Amstrad BASIC.
>>
File: srsly.jpg (64 KB, 862x752)
64 KB
64 KB JPG
>c2x and c23 means same thing but if you want to support more than one compiler, you have to go through humiliation ritual of checking the version and supplying either -std=c23 or -std=c2x
>>
>>103255444
billions must #ifdef
>>
>>103255495
So when was the last time you opened stdlib.h?
Just curious.
>>
>>103255495
except I can't ifdef this garbage, I need to pollute my makefile with this slop for no fucking reason
(except I won't, I will upgrade to gcc 14, anyone below that version is beneath me on existential level, update NOW)
>>
>>103244490
technical design docs, UML class diagrams and estimating how much I need from investors in order to make this work. I hate docs so much it's unreal but at least I finished the MVP (Blender but for AI). everything is on the line and I have to make things work for the sake of my friends in the ml field that got burned too many times by greedy corpos. I really want to vomit because of the pressure but I have to do what's right for everyone and open source. plz pray for me
>>
>>103247411
I guess applying the concepts I've learned? For example I'm learning for loops and I found them very simple and wasn't certain how people have trouble with them. Then it came time to put it to use and it's like "Use a for loop to loop through each of the letters in the chosen word" and I'm like uuuhhhhhhhhhhhhhhhhhhhhhhhhhh. I guess I'm getting IQ-filtered.
>>
File: 1727667194612869.jpg (84 KB, 750x617)
84 KB
84 KB JPG
huh, between clang and the windows standard library implementations, you have almost full c++23 support on windows
>>
File: 1706862450646650.jpg (23 KB, 255x222)
23 KB
23 KB JPG
>>103256482
>c++23
It took them 40 years to implement
std::print("{0} {2}{1}!\n", "Hello", 23, "C++");
>>
>>103248186
Just estimate either the length or the width and go off of that
>>
>>103256160
When ever I get stuck on something like that I find it best to stop trying to code the solution and to write out the physical steps in plain English.
So in your example, to me, it would be
>I'm struggling to loop through a word
>What does looping through a word mean
>I start at the beginning and look at a single letter, I then look at the next
>Why am I looking at the letter?
>To check against a submitted letter to see if it matches
And by doing dumb shit like that you identify what concept you're falling on instead of trying to brute force a code solution. And now that you have four concepts
>What is my word as a data types
>How do I look at an index of that data type
>How do I compare a date type
>How do I go to the next letter (and at what point do I stop)
You can break the problem down and identify what part of that you're getting stuck on and then read about that concept.
>>
>>103256497
>std::print("{0
Lmao
>>
snake_case > camelCase
>>
>>103256497
it's like when you refactor your monolithic function only to discover that you can accomplish the same thing in 3 lines of code
>>
How are miniled monitors for programming? Seems like it'd be easier to stare at for hours since there'd be less backlight overall in darkmode?
>>
>>103256587
This is the way. snake_case for everything except maybe template arguments.
>>
File: standards.png (24 KB, 500x283)
24 KB
24 KB PNG
>>103254127
>>
>>103256587
I use both. snake_case for public APIs (basically Boost naming convention), and camelCase for local variables and private members. I admit it's kinda retarded, but that's how I like it.
>>
Java gets too much hate
>>
>wow dynamic typing is so good i don't have to specify types
>shit goes wrong
>adds types through additional library

every time.
>>
>>103257074
I can explain the Java situation. Java has a very low barrier to entry and makes it very easy to write efficient code that works even if you're a shit programmer. It's really a double edged sword because it attracts shitty programmers, who then go on to write bloated disgusting codebases, and if the product ever takes off, better programmers have to fix the problems created by the shitty ones, even though the language itself could be used well from the start.
>>
>>103257136
what are even benefits of using dynamic typing? why is it a thing?
>>
>>103257151
Eh, It's mostly because people run the JVM with generational GC, huge pages and 12 GC threads enabled and wonder why It's using so much memory. It's kinda worrying when modern day programmers understand less about GC than 12 year old kids from the 80's programming in QBasic.
>>
File: domain.renewal.jpg (43 KB, 447x680)
43 KB
43 KB JPG
>got the email from namecheap
>>
>>103257223
Faster iteration, free type polymorphism, lower learning curve, hot-loading/patching.
>>
File: 1700920370932602.gif (511 KB, 840x488)
511 KB
511 KB GIF
I have never used version control
>>
>>103255300
If I'm developing on an 8-bit micro I'll use a Forth over a BASIC any day. Absolutely bonkers BASIC was so popular.
>>
File: 1732138072846378.jpg (80 KB, 326x364)
80 KB
80 KB JPG
>>103257323
commit() { tar -czf .vc/snapshot.tar.gz .; }
>>
>>103257273
literally me yesterday
>>
>>103257309
How is it faster when you spend more typing adding type checks and dealing with runtime errors

actual time spent = development time + debugging time

Dynamic language users never count the second component
>>
>>103244490
>#include <studio.h>
>>
>>103257445
https://stackoverflow.com/questions/70819505/fatal-error-studio-h-no-such-file-or-directory
>>
File: me irl.webm (757 KB, 374x666)
757 KB
757 KB WEBM
me when the haskell program compiles
>>
>>103257366
I'm more of a BCPL person myself, people believe it to simply be the precursor to C but It's so much more. Funnily enough BCPL's O-Code is very similar to Forth.
>>
>>103257453
WHY would you want to use stdio anyway? Just use javascript
>>
>>103257442
We don't count the second component because we don't do it, debugging? haven't heard of her, we're going live the second I commit this to trunk.
>>
>>103257035
But Xmake is compatible with many build systems including Cmake
>>
>>103257570
yes, I am sure it's a great universal standard that covers everyone's use cases
>>
>>103256497
explicit this is probably the funniest one, it's like they're evolving into... C
>>
File: print.png (93 KB, 1280x973)
93 KB
93 KB PNG
>>103256497
huh...
https://godbolt.org/z/c6nebh71s
>>
>>103257466
>haskell
what do you use it for?
>>
I require ffmpeg binaries for my python project. Should I download all of the three binaries for windows, linux and macos in order to properly bundle it with my code?
>>
>>103258025
You should use the ffmpeg python API and package it as a dependency.
>>
File: 2024-11-21_09:43:31.png (64 KB, 1917x416)
64 KB
64 KB PNG
>>103244490
Barebones lisp interpreter. Little guy can't even add or define yet.
>>
>>103257886
Project Euler/LeetCode. It's nice but I have no idea where I would use it in production. It's no good for web development because of lack of ecosystem. Too slow for systems programmer.
>>
>>103258112
>primative
kek. turn of spellchecker brother.
>>
>>103258237
>of
kek
>>
File: 1689134427378071.png (500 KB, 628x694)
500 KB
500 KB PNG
>>103258237
>turn of
I see what you did there.
>>
File: 1732162811763406.jpg (32 KB, 640x360)
32 KB
32 KB JPG
>>103258112
>(<symbol>#f) (<symbol>#t . <symbol>#t)
we must ask ourselves if #f is truly equal to ()
>>
What the hell does an "AI Engineer" do?
I see so many job openings for it but I am not really sure if they mean a web dev who knows how to use APIs or if they mean a computer scientist who understands how to design a neural network
>>
>>103256587
goFuckYourself
(Personally, I use PascalCase for public members/functions, and camelCase for private ones.)
>>
File: 1694708303358974.jpg (153 KB, 718x717)
153 KB
153 KB JPG
>>103258555
I think a lot of managers bought the lie that AI can code their programs for them, but when they try to do it themselves they can't make any sense of it. "AI engineers" are supposed to make sense of the nonsense.
>>
File: IMG_20190317_111005.png (275 KB, 710x897)
275 KB
275 KB PNG
>>103257411
>>103257323
BEHOLD! https://pastebin.com/6xTAczcs
>>
>>103258616
Bottom one is how developers see the IT guy AND the users
>>
File: superior_to_both.png (8 KB, 262x262)
8 KB
8 KB PNG
>>103258647
>>
>>103258697
Yes. *gigachad grin*
>>
File: 1732142809826655.jpg (164 KB, 1438x2048)
164 KB
164 KB JPG
>>103258636
>python
>zip
gooooood morning sneksirs
>>
>>103258711
It's actually morning here in midwestern murica, so yeah, thanks, it is a good morning indeed
>>
>tfw when you spend more time drawing the mascot than writing the code
>>
File: 1732209997-533x306.png (27 KB, 533x306)
27 KB
27 KB PNG
>The procedure i n s t ( σ ) {\displaystyle inst(\sigma )} specializes the polytype σ {\displaystyle \sigma } by copying the term and replacing the bound type variables consistently by new monotype variables.
Anyways, why do people only talk about algorithm W? I thought J was supposed to be the better version.
>>
>>103259067
[Lie] I understood all of that.
>>
>>103259095
I have read many primary and secondary sources about this algorithm for months before the pieces started to come together for me desu.
>>
>>103259067
[Int] You made a mistake integrating the derivative of the polynomial.
>>
>>103259067
[Luck 7] Ice cream.
>>
>>103259067
Nobody actually remembers the name and everyone thinks about it as basically the same thing
>>
>>103259216
>You made a mistake integrating the derivative of the polynomial
I hate that that actually sounds like some "high int" dialogue they'd write in the fallout games
>>
File: 1705905057340495.png (87 KB, 741x1051)
87 KB
87 KB PNG
>>103259354
>>
>>103259522
>that last paragraph
chat gpt has surpassed NPCs
>>
>>103259067
what is this? type unification?
I forgot how to read this shit but I was able to wing it when doing my implementation
Can't find any official "W" and "J" algorithms
>>
>>103259522
>chatgpt spends time generating verbose statements that are instantly obvious to anyone who understands calculus.

Many such cases!!
>>
grinding leetcode for a codesignal asessment. Is there a better way to prepare for it?
>>
>>103259645
hindley damas milner type inference
>>
>>103258988
why are mascots even a thing in programming? this isn't some type of gay sport
>>
>>103258112
Hi Froggy, did you finish you're text based game?
>>
>>103260705
why are mascots even a thing in sports? this isn't some type of gay advertisement

Idk, soul or something
>>
>>103260817
NPCs like to rally behind a mascot.
Yes, it's stupid.
>>
I find Python harder to read than most languages
>>
>>103257821
chat that isn't real...right?
>>
>>103259697
Eh, it's only obvious to you because you already learnt it. All sorts of things are obvious once you've learnt them.
Midwit.
>>
async primitives challenge

heres some PHP
$p = SM\Promise::Row([# row/line runs concurrently
SM\sleep(1000),
SM\Promise::Func(function(object $r): ?object {
static $N=0;
$N++;
echo '['.$N.']';
return $r->promiseDelay(200);# repeat in 200ms
})
], 0, 1);# stops when: 0=breaks, 1=finishes
echo "> example #1: ";
$t = hrtime(true);
SM\await($p);
echo " in ".((hrtime(true)-$t) / 1000000)."ms\n";


and heres some JS
// NODEJS implementation
const sleep = ms => new Promise(r => setTimeout(r, ms));
async function nums(signal) {
let n = 0;
while (!signal.stop) {
n++;
process.stdout.write('['+n+']');
await sleep(200);
}
}
(async () => {
const signal = { stop: false };
const p = nums(signal);
await sleep(1000);
signal.stop = true;
await p;
})();


first, try to guess the output. second, propose a better variant in your superior language of choice :]
>>
premature optimization really is the root of all evil.
>>
File: Clipboard01.png (109 KB, 1280x1044)
109 KB
109 KB PNG
>>103261290
I was expecting some meta-programming magic with everything optimized-out to a single function call at the end. technically, that's what's happening, but the amount of additional bloat shook me to the core.
>>
>>103261871
I've always wanted to be evil
>>
>>103261871
stupid saying
>>
>>103261882
>bloat
you need to read up on calling conventions, retard
>>
>>103260806
No. The last thing I did for it was make a runtime entity-component system. I've been working on other projects instead.

>>103261498
It's obvious because it's one of the fundamental theorems of calculus. In other words, one of the most basic things calculus teaches you, that it still does a sloppy job with that. You don't even have to write out the expression for a polynomial, the statement is more generally true.
>>
>>103261666
JS with generators
function *nums() {
let n = 0;
while (true) {
console.log("[%d]", ++n);
yield* sleep(200);
}
}
function *sleep(ms) {
const end = Date.now() + ms;
while (Date.now() < end) yield;
}
function race(...gens) {
main: while (true) {
for (const gen of gens) {
const s = gen.next();
if (s.done) break main;
}
}
}

race(sleep(1000), nums());
>>
File: IMG_20241121_235417.jpg (1.01 MB, 1867x1080)
1.01 MB
1.01 MB JPG
I'm learning programming via a game my friend gifted me that makes you program a drone so it farms autonomously. Different things you can plant have different rules, for example Trees grow very slowly if other trees are planted in tiles adjacent to them, so you have to figure out a way to work around that. In my case, I made it so that it checks the coordinates of where the drone currently is, and then it plants a tree if both x and y are even number coords (via % operator and leftovers) and also if both x and y are odd number coords, but not if one is even but the other is odd. It also plants carrots or grass depending on what I have, waters the ground if it's below a certain water threshold, and tills the soil if it hasn't been tilled yet. This game's language is apparently similar to python.

My question is, does it actually look like I'm learning to program with this, or is this not "real" programming yet?

https://files.catbox.moe/21zy8d.mp4
>>
>>103259067
Maybe because W is purely functional and therefore more appealing to nerds willing to implement it.
Or maybe because it is purely functional it is easier to extend and prove that the extension is sound.
>>
>>103262004
what does it have to do with generating a gorillion of local constants and labels?
>>
>>103262124
I was able to find some reasoning about why W is more popular even though its author pointed out that J is superior in practice. It pretty much does come down to its purity and the fact that it's provably sound.
But in practice I think you would still utilize some kind of stateful effect to generate new type variables in both W and J and just using even a pure state transformer for both that and a disjoint set for unifying types doesn't really seem like such a huge compromise of purity that functionalfags wouldn't adopt J over W. I at least am using Haskell and just skipped to J because I figured why not?
>>
>>103261871
reformatting your data files from a meme format to something clusterfucked like
ID=918273918273
{
//json data
}

is much worse.
>>
>>103262113
Sorry, you're not a true programmer if you're not creating servers from scratch
>>
>>103262212
>muh server
>>
when using cmake and building your project for 2 targets (x86 & arm for example) how does it match the correct version of a library for the purposes of find_package? does the library expose some variable that it checks the compiler it's using against? I know I've dumped an elf file before and seen the platform in the header
>>
Is there any plug-and-play memory profiler that you can use that will visualize allocated memory blocks based on internal C/C++ object types?
>>
have you implemented wifi -> ip -> tcp or are you a fake programmer?
>>
>>103262234
i'm a fake programmer
>>
>>103262234
My policy is to never touch kernelspace.
>>
>>103262225
the feature_test_macros manpage is related but it wont help you if the usecase is cross-architecture compilation, make a package for whatever the systems are running on and compile through that
>>
>>103262113
it obviously has its limitations but looks an alright way to get a feel for programming, sure
>>
>>103262253
it's not a question of I can't get it to work it's working and I want to understand why. I thought there would have been a conflict as I have the same library twice just for different architectures. I add both of them with CMAKE_PREFIX_PATH and then I can swap freely between my toolchains and it just werks
>>
>>103262113
this looks fun desu
>>
Okay, the book that the slut from the OP is pretending to read. The introduction to arrays.

while ((c = getchar()) != EOF)
if (c >= '0' && c <= '9')
++ndigit[c-'0'];


I do not understand why do we have to write [c-0], instead of simply [c].
>>
>>103262379
What is the type of c and what is the type of c - '0'?
>>
File: ASCII-Table.png (43 KB, 800x600)
43 KB
43 KB PNG
>>103262379
'0' is the ASCII character whose value is 48.
(x - '0') turns the ASCII character into an integer, which is then used as an index for the array.
>>
>>103262379
it's not JavaScript, 0 and '0' are not the same
>>
>>103262405
Integers. It's a program that counts every occurrence of a digit. So if getchar is 5, it one-ups the fifth index in the array ndigit.
>>
>>103244490
Grill my FizzBuzz please.
>>
>>103244490
What are you listening to, /g/?
>>
>>103262450
>do check
>assign constant based on check
>check constant
>print output based on check
You can skip two steps here.
>>
>>103262471
Why?
>>
>>103262472
Okay so like this?
>>
>>103262450
i'm a proponent of solutions where you compose Fizz and Buzz outputs over explicit "FizzBuzz"

>>103262472
preemptive optimizations are the root of almost all shit code
>>
File: compilers_are_garbage_3.png (413 KB, 1920x9040)
413 KB
413 KB PNG
>>103262507
>preemptive optimizations are the root of almost all shit code
Bullshit. A little bit of preemptive optimization goes a long fucking way.
>>
>>103262507
>preemptive optimizations are the root of almost all shit code
If you're not continually shortening your faggot lines of code, you're doing something wrong.
>>
>>103262409
>>103262414
Ohhhhhhh, I'm starting to get it.
>>
>>103262507
>>103262507
>i'm a proponent of solutions where you compose Fizz and Buzz outputs over explicit "FizzBuzz"
Right, actually that's what I've been trying to figure out for the last little bit here. This is the closest I've gotten so far but it does spew out extra newlines, obviously.
>>
>>103262534
code terseness hurts readability

>>103262528
to waste time while avoiding real work, maybe
>>
>>103262579
the usual "composing" approach is to have something that accumulates your outputs for hit conditions, then check if any conditions were hit (if yes, print the accumulated output; if not, print the default, ie. the number)
the advantage to this is that you can add more rules with almost no change to already existing conditions and outputs
>>
the code's height being more than twice the height of my screen at 11px font hurts readability.
>>
>>103262632
is this you https://github.com/tinygrad/toonygrad/issues/1
>>
File: xkcd.png (494 KB, 1027x900)
494 KB
494 KB PNG
>>103258697
>>
>>103259697
Is there a way to make ti be more direct instead of being too verbose?
>>
I want to make a 2D game, would learning GML and using GameMaker or learning lua and using Defold be easier? I'm new to programming.
>>
>>103244490
Figuring out that strtoll/strtod only returns endptr and doesnt care for it on input was a rude awakening.
Is there any function in libc to give a binary limit or do i have to inject another stupid file into my makefiles?
>>
File: unsure_pepe.png (73 KB, 600x576)
73 KB
73 KB PNG
>>103261871
This can be a legitimate criticism in some cases, but far too many retards will write code like:
if (getThingFromRemoteDatabase().flag) {
doSomething(getThingFromRemoteDatabase().values);
}

and if you suggest refactoring this to
var thing = getThingFromRemoteDatabase();
if (thing.flag) {
doSomething(thing.values);
}

then they'll be like "No Anon, don't you know premature optimization really is the root of all evil? Did you profile to see if fetching from the DB is really a bottleneck there? You shouldn't change what isn't broken."
>>
>>103262750
>>>/g/gedg/
>>
>>103262754
iirc plain C doesn't have any standard function to do this (which is absolutely retarded, terrible design) - you must roll your own conversion, or copy the portion of the string you care about to another buffer and null terminate it. C++ only very recently got around to adding these functions. One of the newer C standards that nobody actually uses may have added them idk.
>>
>>103244490
Starting the 6502 assembler for my 6502 simulator.
Writing a png decoder/encoder library for Standard ML.
Writing a server/client to connect a client in Standard ML to a C server running SDL so I can do graphics stuff in SML.
Writing a subset of SML in 6502/Z80 to run it in C64/MSX (I need to see if I can use C/Forth for most stuff and ASM for the most time consuming parts).

I feel like not working as a programmer allows me to have a lot of fun in this area.
>>
File: you.png (556 KB, 1027x900)
556 KB
556 KB PNG
>>103262722
>>
>>103262722
Lmao.
>>
>>103262722
didn't other webcomics back in the day make fun of xkcd for being so obtuse
>>
>>103262492
I want to listen to some good music
>>
>>103263038
Better buy your cakes in bulk!
>>
File: uglygirl.png (25 KB, 533x711)
25 KB
25 KB PNG
>>103263038
Yep
https://explosm.net/comics/rob-uglygirl
>>
>>103262722
I hate Randall Munroe so much.
>>
>>103262736
By the First Fundamental Theorem of Calculus
https://www.mathsisfun.com/calculus/fundamental-theorems-calculus.html
the indefinite integral of the derivative of some function f(x) is f(x) + C where C is a constant of integration.
>>
>>103263242
>Excuuuuuuse me? That is SO rude!
>>
>>103262632
>making good code is just avoiding work
And that's why everyone always ignores you.
>>
>>103263169
What makes you think 4chan of all places listens to good music? Most people here are completely fucked in the head.
>I listen to the Persona 2 IS opening movie track on loop
>>
>>103262471
Mostly jazz and maidcore sometimes post punk as well
>>
>>103262043
classic
>>
i'm writing a script that generates some files corresponding to metadata for a bunch of audio files.

i've got a huge folder with a ton of wavs in it.
i've got a function that gets the file paths and the sample rate, and makes a tsv with that data.

then i've got a second function that takes the file names and generates unique labels based on their names and makes a CSV, and then maps those labels to the file path in a tbl file.

these are two functions. the csv and tbl generation make sense to me to have together, because the index generation is needed for both.

i have these two functions and they work, but i'm doing two passes through the folder in order to generate these files, because i'm calling the two functions one after the other.

i could integrate all of them into a generate_metadata function, but that would require me to take apart this already working "generate_tbl" function.

and then i just have one huge function which is more efficient in terms of operations, but i think is more of a mess to look at and understand.

i'm conflicted. maybe i should split up the csv and lbl function into two separate ones? i don't know which smells better.

and i've got
>>
>>103265371
>and i've got
Yeah, me too.
>>
>>103265382
thanks
>>
how many hours are you supposed to use for personal project at work?
>>
>>103265371
time to learn SQL
>>
File: 1726892105513906.jpg (68 KB, 912x869)
68 KB
68 KB JPG
I am sick of the constant shilling can you fags just work on your toy projects in silence please? Nobody cares what type of buttplug you use.
>>
>>103264313
and yet you replied
>>
>>103265371
in my experience, for batch jobs like that it's better to have very distinct stages of processing, even if you end up iterating through things multiple times
one advantage is that you can then easily implement a break/restore functionality, eg. generate your metadata as stage 1, then if something fucks up in the later stages you can restore starting from stage 2 with your previous run's stage 1's output

if your concern is going through the filesystem twice, you could do one pass to get a list of files, cache it and reuse it instead of reading files again
>>
>>103265858
that makes sense to me. it's meant to be a one-off thing to process all this audio, so doing it in steps feels better. if i want to change how one step up the chain operates, i don't have to untangle some enormous function. i just have to fuck with that one section.
yeah that feels better. and i ultimately did end up storing the relevant data from the first pass, and then broke up all the file generation into 3 distinct functions that i pass the data into.
>>
>>103262755
I would argue correctness. Someone else might change the thing, and it's better to doSomething with stale but sensible values.
>>103265371
csvs() { for f in fs csv(f) }
tbls() { for f in fs tbl(f) }
both() { for f in fs { csv(f); tbl(f) } }

I wouldn't call the last option a huge function yet.
>>
>>103244490
Trying to refactor some util module bullshit while thinking about wanting to be a woman, how do I fix this issue
>>
>>103266111
>rust astroturfing intern
>>
>>103266130
I don't do this and I'm not a troon
>>
they really are not sending their best.
>>
>>103256561
This must be my good karma for helping someone on /sqt/. Thanks brah
>>
I want to learn a lower level language, so I've started messing with rust. I may be a complete braindead ape, but having to explicitly and constantly use references so variables don't lose ownership and become useless is just annoying and having the code filled with "&**&*&**&*&(***my_vector[0])" is complete lunacy. Also, the documentation keeps showing snippets of code that won't compile for some reason.
>>
>>103267108
Rust is bad. In other news water makes things wet.
>>
>>103266111
>Thinking about wanting to be a woman
What's you argumentation? Because there's a lot of arguments against it, and if you'll consider them you won't be thinking about it. It's a not a complex issue. So are you really thinking or just brooding?
>>
God help me I'm taking the .NET pill
>>
>>103267397
>What's your argumentation?
There isn't any, it's probably a mental illness, it's still ruining my life though
>>
>>103267419
If it's not rational, it's emotional. Maybe a response to pressure. Try removing its source.
>>
>everybody tells you to avoid capturing this in a lambda
>everyone captures this anyway
why
why would so many people preach something that absolutely nobody actually does
>>
Uncle Bob goes yikes when he sees a function that is 5 lines long. What's his problem?
>>
>>103267834
A good idea (code should be readable and coherent, don't mix things you shouldn't inside a single function, etc.) taken to religious extremism levels of zealotry
His Clean Code book is good if you realize you're dealing with a nutjob with some good ideas. Take what's reasonable and discard the rest
>>
I'd like to write an XML parser in C as an exercise. What books and/or resources are out there that'd help me with this task?
>>
>>103267926
"XML parser in C" by I. P. Freely.
>>
>>103267926
Copy the libxml2 source code
>>
>>103267926
https://en.wikipedia.org/wiki/XML
>>
Big Code doesn't want you to know this but big functions are free you can put them in your code. I have functions with 458 lines.
>>
so if I have atomic int and I do this
if(var) {
var++;
}

Is this ok or am supposed to use atomic_compare_exchange_strong?
>>
>>103268757
that is not okay to do

I would just use a mutex, but I'm a [C]hud
>>
>>103268817
this is C and I changed to mutex but c11 thread API is literally designed by Indian interns from Microsoft.
>>
>>103268643
>big functions are free
Wrong.
>>
>>103268929
could you do everyone on /g/ a favor and use a trip so we can all filter you? thanks
>>
>>103269063
I like reading his posts
>>
>>103269063
No.
>>
>>103267108
read the book
>>
>>103269182
jokes on you, I have already used LLM to identify your posting pattern and doxed you to the 3L1735
>>
>>103244490
>What are you working on, /g/?
For the first time in my life, I have a desire to make a program to automate a task. I need to conditionally concatenate a bunch of .mp3 files into a bunch of other .mp3 files. I was already doing that via ffmpeg and manually editting a file list text file, but the scale of my task has grown today, so I'd rather remove the tedium. I'll figure out the logic, I just need to figure out how to run a command in a specific folder via C# (my language of choice). Unfortunately, I can only find information on how to run C# programs through the CMD.
>>
>>103269576
Oh no, you might discover that I'm secretly John Doe.
Scary.
>>
>>103244716
calibre is huge, right?
what changes are you making?
>>
>>103269668
>hasn't done AI gf
>hasn't genetically engineered cat girls
>hasn't implemented RISC-V CPU in Verilog
you are a dumb tool
>>
>>103269668
>Feel like I've kind of plateaued
>I'm mostly used to OOP stuff like C#, java
no shit lmao, it's the same language
>>
File: smug.jpg (186 KB, 1369x1183)
186 KB
186 KB JPG
>>103269685
I have implemented multiple pressure testers and sensors, you have plateaued skillwise.
>>
>>103269730
>wanting to go on man
>calling others faggot
got some bad news for you chief
>>
fuck, all my images are on a hard drive at my desk
i don't want to get out of bed
>>
Anyone remembers the game that anon was using to learn programming? It was mentioned not long ago. Something about farming.
>>
how come examples of compile time shit like consteval are always so contrived? "look, this function doubles the value during compilation!" yeah, I can do that already, it's called 2 * 4
>>
>>103269905
It's so that you don't look at the shit they *weren't* able to optimize.
>>
>>103269905
And all OOP examples are shapes or animals because people are supposed to know those. They could say, we're going to call https://www.netlib.org/odepack/opkdmain.f where the work arrays dimensions are constexpr, but it's not good for the audience to not understand the language and the thing expressed by the language at the same time.
>>103269901
This is another one I don't know details though https://byorgey.wordpress.com/2021/09/23/swarm-preview-and -call-for-collaboration/
>>
>>103270212
There's a space inside your link.
>>
>>103270229
It still goes to the right page.
>>
File: 1700598768444534.jpg (153 KB, 1281x1395)
153 KB
153 KB JPG
I've never used a double in my life
>>
>>103270315
>long double
>>
>>103270315
desu that's more depressing than hearing that you have never had sex before
>>
>>103269686
Ha-ha! What a predicament!
>>103270229
FIX YOUR FUCKING LINK
>>
>>103270533
>FIX YOUR FUCKING LINK
why, are you a phoneposter that can't just select text and fix it yourself?
>>
>>103270684
Because it's rude to post broken links :(
>>
>>103244490
let me get this straight
in c++ if i load a bunch of bytes into a buffer (say from the network) and i want to typify it to for example something like a FooPacket object which has meaningful fields and useful methods and such, i am not allowed to simply do this:
char* buf = ...;
assert(readBytes >= sizeof(FooPacket));
FooPacket* packet = reinterpret_cast<FooPacket*>(&buf);

because that would violate strict aliasing rules? what the fuck?

so i am actually forced to copy every single byte into a new FooPacket object byte by byte, i cant simply reinterpret the bytes?

insanity
>>
>>103271122
>&buf
Sir, this is a char*.
>>
>>103271250
forgive me
>>
>>103271122
std::bit_cast
std::launder
>>
I have to learn Java. I'm not liking it.

Anyway, anyone know best I could declare a series of inputs and result?

The input is a pair of integer arrays and the result is a double. Would a Map be possible or something?
>>
>>103271461
public double myFunction(int[] array1, int[] array2) { ... } ?
>>
I have a grievance to get off of my chest
I hate how with the prevalence of LLMs in machine learning, everything is being treated as a sequence. Not everything is a sequence. This is "when all you have is a hammer" territory.
>>
Working on a dashboard in React using an API to do things. Bold, I know. But I don't know React and I was a JS babby until like last week...and now I know more.
>>
>>103271588
can you explain that any further?
what's something which is now treated as a sequence but which shouldn't be?
>>
>>103271588
everything reduces to sequences you dumb tool
>muh hammer
back to >>>reddit
>>
i haven't used these infernal things, to be clear
my dad does though
>>
File: ceiling prisoner.png (274 KB, 564x431)
274 KB
274 KB PNG
>>103271662
i have to be this inflammatory to get a response, don't i?
:/
>>
Building C++ code to work on existing frameworks is at least an order of magnitude more difficult than the actual code. This is madness
>>
File: 1728864737890493.gif (251 KB, 447x415)
251 KB
251 KB GIF
>lvalues
>rvalues
>xvalues
>glvalues
>prvalues
>xlvalues
>xxlvalues
>xxxlvalues
>nonvalues
>unvalues
>universalvalues
>valuevalues
>longvalues
>christianvalues
>value&&
>>
>>103271752
that's why i dropped it for rust
>>
Boris the function was successful 1000 times, surely it will be successful forever, right?
>>
File: 1710378523869170.gif (463 KB, 294x233)
463 KB
463 KB GIF
>>103271752
what's a "framework"? some CIA shit?

captcha: M00XY
>>
>>103271872
once a year, even an unloaded gun goes off
>>
>>103271658
Anything that's representable as a tree for instance. Let's literally imagine a family tree as a data structure. How do you linearize a genealogical tree without sacrificing the intrinsic structure of the data?
There is more to information than what precedes it. There are also things you can exploit with self similarity in some data structure.
That's not even getting into the way LSTM works.

>>103271662
>>103271679
I appreciate the shitpost, but I do think this is a salient thing to point out, and I really don't see it talked about as much as I believe it ought to be
>>
>>103271942
tyty
>That's not even getting into the way LSTM works.
i'll have to check that out

based swimming against the river of the dead
>>
>>103272058
>i'll have to check that out
To butcher the concept, it's a way for data that varies over "time" to have the effects of that shift be differentiable. Time could be literal time like with audio samples, or iterations of a context windows in an LLM. It's great for the applications it's meant for, but again, once you introduce that sequential training methodology to something that isn't sequential, you're sort of muddying the waters.
>>
is there an OS agnostic way to open a file using a text editor?
>>
>>103271789
I feel like all that shit would be easier to explain if they just showed you the assembly.
>>
>>103272284
please os do the needful
>>
>>103272284
I'm sure there's a python script for it
>>
>>103271833
I have no experience with build systems in Rust, but I'm a firm believer that building should not be a more difficult task than programming
For better or worse I'm stuck with C++ so I'll just bitch about it
>>
>>103272284
A txt file with human readable instructions
It's like programming, but instead of programming a CPU you're programming people
>>
>>103271789
Literally bloat that only exists because retards are obsessed with overloading operators
>m-muh custom types need to larp as built-in types
No, they don't
>>
>>103265728
>Nobody cares what type of buttplug you use.
Now we know you're anal-retentive enough to not need one. Don't bother humblebragging.
>>
>>103272519
But you only need to know about lvalues and rvalues and T&& which is like a pokeball for rvalues
Imagine a Charizard, he's a big boy right? So he lives in the heap
If you want to move it, you catch it with a pokeball with Charizard&& and then he's nice and portable
>>
devaluate that expression
>>
>>103272565
Did you just use Pokemon as a programming example.
>>
>>103271789
https://en.cppreference.com/w/cpp/language/value_category
>>
>>103272598
Devaluation sounds like some new feature added in C++26
>>
>>103271789
>numbers
>real numbers
>complex numbers
>imaginary numbers
>irrational numbers
>negative numbers
>gay numbers
>even numbers
>prime numbers
>>
>>103271122
auto packet = (FooPacket*)buf;
>>
>>103272565
sry anon that pokemon was actually a std::vector of bool and now your team won't compile
>>
>>103272658
>devaluated types
Don't tell the committee
>>
>>103272565
struct X { char[10000] data };
>X&&
>>
File: dragonPokemon.jpg (38 KB, 364x843)
38 KB
38 KB JPG
>>103272624
why not? Pokemon is a video game that was programmed after all
>>
>>103272703
I mean, T&& works for any dynamic memory allocation. If you're allocating a big struct like that on the stack that's user error
>>
>>103272700
wouldn't that just be like atoms or something, where you're only concerned if it exists and not what it equals
>>
>>103272735
Well, then do tell the committee because being able to use Elixir/Erlang's atoms would be cash
>>
>>103272731
struct X {
std::vector<X> a[2];
std::vector<Y> b[2];
std::vector<Z> c[2];
};
>>
>>103272735
You'd have to start with something with a value to devaluate though. So if the variable x contains the value 100 you'd devaluate it into the token onehundred.
>>
>>103272777
>calculate some arbitrary expression
>reduce the expression result to an atom
>could even be done at compile time
Holy shit anon, that's genius
>>
File: 1722919206041668.jpg (169 KB, 660x751)
169 KB
169 KB JPG
>atomic mangling
>>
>>103272675
genius
>>
>>103272675
thats illegal, bjarne please ban this poster
>>
>>103272598
deval x = 10;
println(x); // 8
val y = x; // y is now 8
println(y); // 8
println(x); // 4
val z = y + x: // z is now 12
println(y); // 13
println(x); // 2


>>103272787
>anon discovers lisp
>>
>>103272849
Wow I didn't realise they added kosher rounding to C
>>
>>103272867
you hve to use the merchant face operator
( ͡° ͜ʖ ͡°)
>>
>>103272887
So what operator gives me my original value back
>>
>>103272993
cringe
>>
>>103272993
Experimental until C++28
>>
>>103273026
AKA unimplemented until 2082
>>
>>103272731
>If you're allocating a big struct like that on the stack that's user error
Just allocate yourself a new stack that's big enough. Solved.
>>
bread: >>103273421
>>
>>103271492
Nah, it's a variable. Basically in Python I could be like:
[
(input1, input2, expectedResult),
(input1, input2, expectedResult)
]

an array of a tuple with inputs and the result. And then for loop through all of them and execute my functionality with this.

I've done it for a string and a known result with a map, but not sure how to do things when there are multiple inputs, not just a a string input and an integer output.
>>
>>103273589
class Foo
{
public int[] array1;
public int[]array2;
public double result;
};
Foo[] foos;
for(Foo foo : foos) {}
>>
>need to code something in a specialized software
>source code available
>documentation nearly non-existent
>10,000 lines of code in just one file
At this point I wonder if it's possible to make an autonomous agent just for the task of providing documentation with examples, much like Delphi used to have. Man I miss the Delphi documentation, the help files were so fucking good.
>>
>>103273744
try putting the code into chatgpt and ask it questions about it
>>
>>103273761
I might do something similar - although so far such experiments have yielded little if any results.
>>
>>103271942
I think they just add extra tokens that mean the adjacent tokens have a parent-child, sibling, cousin, unrelated etc. relation but it's unclear how redundant it should be. You explained the tree situation without having to draw one.
>>
>>103273857
>You explained the tree situation without having to draw one.
We're thinking beings, LLMs are black boxes that spit out probability distributions based upon an input sequence. At best you could teach one to emulate qualitative discussion about trees
>>
I want to be a probability distribution.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.