[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

[Advertise on 4chan]


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1616721721057.png (332 KB, 600x792)
332 KB
332 KB PNG
Old thread: >>83810801

What are you working on, /g/?
>>
Go.
>>
>>83818640
trying to install and work on craft cms for my personal needs
>>
>>83818659
Where?
>>
>>83818710
Go, home...
>>
>>83818640
damn she's thick and making me horny
recommend some hentai so I can jerk off quickly, probably on nyaa
>>
File: one.jpg (122 KB, 960x758)
122 KB
122 KB JPG
she doesn't write her own drivers, ngmi
>>
>>83818640
If your language was not a language, but a song, what song would it be?

>java
https://www.youtube.com/watch?v=Jv3kQvcQyU8
>>
>>83818851
>PHP
https://www.youtube.com/watch?v=B1eQooBq10k
>>
>>83818851
Rust
https://www.youtube.com/watch?v=ZBjIa6obU5E
>>
File: implications.jpg (70 KB, 1200x630)
70 KB
70 KB JPG
>her
>>
>>83818851
Rust
https://www.youtube.com/watch?v=MADvxFXWvwE
>>
>>83818851
Go
https://www.youtube.com/watch?v=xeYfK9NQyoo
>>
>>83818640
>What are you working on, /g/?
wasting my time trying to understand and make my own implementations of FFT and DCT

idk why i thought this was a good idea i'm too much of a mathlet to truly understand them
>>
>>83818803
magnet:?xt=urn:btih:2256a1fd418618d9b207f53b6dd149993a6a0ecd
>>
File: >λ=.png (679 KB, 10000x7339)
679 KB
679 KB PNG
>>83818851
https://www.youtube.com/watch?v=gCb0q8NL5tQ
>>
>>83818901
I think it's cool how man can become woman and vice-versa.
Tech. is not there quite yet, but we'll get there eventually.
Imagine living in a world where we can transition between man and woman with a single pill or something like that.
>>
>>83819075
die tranny
>>
>>83818945
thanks anon!
>>
>>83818851
>typescript
https://www.youtube.com/watch?v=BZbb5DS9W8U
>>
>>83818851
>Ansi C
https://youtu.be/tr9lMHwcG7c?t=59
>>
>>83818851
lisp
https://www.youtube.com/watch?v=aHk42kDwesM
>>
I don't know what to work on.
>>
I need to draw a bunch of lines for a simulation. I only know OpenGL but kind of want to do Vulkan, how easy is Vulkan to learn?
>>
>>83819202
car cdr eval apply
>>
>>83819204
>vulkan
>easy
Kek
>>
>>83819204
Fairly difficult, but the fun kind of difficult.
>>
>>83819204
Everything is the same, just more things to remember. Unless you're trying to do some autismo stuff, nothing is difficult.
>>
>>83819202
Make a general app on the 4chan api that shows posts in succession and allows one of n actions which categorizes the posts (for example: helpful, shitpost, ...)
>>
>>83819241
test case, I should be able to hit a key to advance to the next post.
>>
>>83819241
I would want something like this and also have posts just pop up like a message so I don't have to constantly check the thread. No idea how I'll get that to work yet though, it wouldn't be smooth at all.
>>
>tfw bills piling up

RRREEEE give me a job you fuckers
>>
>conjuring the spirits of the computer with my spells
feels so good
>>
>>83819205
I've written a lisp interpreter already
>>83819241
and do what with the categorization?
>>
>>83818640
>What are you working on, /g/?
Understanding generative transformers. RIP brain
>>
>>83819275
>and do what with the categorization?
Create an app for creating training set
>>
>>83819287
General purpose. End use, I could use it on /agdg/ to (choosing my own categories) create a training set of questions, helpful answers, progress posts, unrelated posts, bait.
>>
>>83819284
>meme learning
>>
kinda in the middle of learn something new or contribute to existing open-source project?
>>
Reminding anons to use https://github.com/friendlyanon/cmake-init when creating new C++ and C projects!
>>
File: mountain.png (5 KB, 730x61)
5 KB
5 KB PNG
>>83818232
in apl this is just
>>
>>83819316
in haskell this is just
https://hackage.haskell.org/package/cabal-install
>>
How can I make a neural network that can take a decent amount of inputs and outputs yet have very few parameters?
I have 256 bits to fit the parameter into, ideally I'd do 32 parameters at 8 bits each, but I could do 36 at 7 bits or even 42 at 6 bits if I really had to.
If I somehow use less than 32 parameters, that's really good, because any parameters not used by the NN can be used for other things.

I'd want at least 8 inputs for the NN (ideally more), and up to 4 outputs.
>>
File: cost of maintenance.jpg (345 KB, 660x880)
345 KB
345 KB JPG
hmm note that the cost of fixing a fault in a software project increases dramatically if not fixed in the development phase

that means if you fuck up the requirements gathering part and build a piece of software with the wrong requirement, fixing it will be approx 2 to 3 times as expensive as fixing it in the development phase.
>>
>>83818849
girls don't write drivers
unless you're talking about that tranny that works on the asahi project
>>
File: cost of maintenance2.jpg (368 KB, 660x880)
368 KB
368 KB JPG
>>83819559
>>
>>83819559
>>83819571
all the papers this industry is based on for project management are bullshit, unreplicatable, and from the stone age. this field is as bad as psychology when it comes to the literature.
>>
>>83819598
What this guy said.
>>
>>83819598
hmm so after the project is done you have to drag all the devs away from the new project and make them fix the project they just delivered, but that isn't more costly than getting the requirements right and designing it properly the first time?

come on now, anon...
>>
>>83818849
thought about making drivers but also i don't think i'm enough of a hardwarefag to do it
>>
>>83809846
>>83809773
Thanks it works, but it returns IndexOutOfRange when trying any i < X where X is greater than 100. Surely it can't be that limited?
>>
>>83819338
navajo lookin ass runes
>>
>>83819622
>ass runes
Tell me more
>>
>>83819609
the devs and manager leave after the project is done and dump maintenance on the new hires
working but shoddy code now gets to market faster and makes investors happy that you're growing fast and you get more money
>>
>>83819609
all the calculus is different with the internet, globalization, and outsourcing
>>
>>83819338
You can do it in half that many characters. probably even less.
>>
fuck youtube, it had started throttling speed recently, i have to apply the current workaround to my youtube client so that it doesn't throttle
not sure how long it will work though and the "real" solution seems to require a javascript interpreter
>>
I made a .vimrc based off a sample on online, all the lines seem to be working except for
nnoremap <C-L> :nohl<CR><C-L>
. I think it might have to do with syntax since the "nohl" keyword isn't the right color unlike all the other keywords. Supposedly, it makes it so that C and L turn search highlighting on/off, but whenever I try it, it just deletes a character near the cursor and enters the insert mode. I tried this with c, l, C, and L. What's messed up here? Also in case it isn't obvious I'm a total moron so assume basically zero prior knowledge on my end.
>>
oh my god I love computers I wish I was a computer
beep boop beep function girlfriend sigfault(oops)

literally what you sound like
>>
>>83819924
I don't say beep boop beep
>>
File: 1621892714762.jpg (4 KB, 211x211)
4 KB
4 KB JPG
>>83819338
> In the case of a well-known conversational programming language I have been told from various sides that as soon as a programming community is equipped with a terminal for it, a specific phenomenon occurs that even has a well-established name: it is called “the one-liners”. It takes one of two different forms: one programmer places a one-line program on the desk of another and either he proudly tells what it does and adds the question “Can you code this in less symbols?” —as if this were of any conceptual relevance!— or he just asks “Guess what it does!”. From this observation we must conclude that this language as a tool is an open invitation for clever tricks; and while exactly this may be the explanation for some of its appeal, viz. to those who like to show how clever they are, I am sorry, but I must regard this as one of the most damning things that can be said about a programming language.
>>
Quit your job
Make videogames
>>
>>83819969
Dijkstra never learned APL
>>
>>83819990
good decision. one doesn't need to experience eating shit to know it's bad.
>>
>>83819979
Dijkstra never made videogames.
>>
>>83820007
It's his loss
Array programming is unironically the most powerful programming paradigm, and people are only now starting to catch on.
>>
>>83818640
https://bitsavers.informatik.uni-stuttgart.de/bits/Interdata/32bit/unix/univWollongong_v6/miller.pdf

god I'm literally retarded, i shouldn't have smoked weed as a teenager.
>>
>>83818851
>Java
https://www.youtube.com/watch?v=Wfzp4cdcuYc
>>
>>83819559
>>83819571
The software engineering process begins with RAD.

Requirements, Analysis and Design. Love this shit btw.

The requirements gathering phase is the single most important and you should do whatever you have to in order to elicit ALL of the requirements from the customer/stakeholder. If you have to take them to a bar and get them drunk to get them all, then do it. You need to gather/infer the deadline, reliability expectations, and cost ESTIMATES in the requirements phase (how much is big business ben willing to spenn?)

Analysis is the fun part where we take the requirements and build them into something useful for the software professionals instead of the customer, we develop UML models of the software. There is no "specifications document" per se, but a set of UML models and diagrams take it's place. These are also shown to the client and used to avoid being sued for misrepresenting some aspect of the software project. After the client approves the specs, detailed planning and cost estimating begins. Part of that process is getting the UML approved by some SQA dicks and then deciding which implementation team members will do what and how long they have to do it. Can't do that part until the specs are finalized (approved by client). Project Management Plan, milestones, budget, etc. basically finalized.


Design process refines the UML and whatever other form the specs exist in, from the Analysis phase into something implementable by the low-level ant-like programming team (poos). The UML takes on actual fleshed out functions with defined interfaces and some internal stuff before being implemented.
>>
>>83820030
>people are only now starting to catch on.
Array programming has been the way to do scientific computing forever. The languages used are not as terse as APL but the fundamental concepts are still there.

>>83820061
>The software engineering process begins with RAD.
>Requirements, Analysis and Design.
oh my god I'm getting aids please stop
>>
File: pepelaughing23.jpg (33 KB, 373x550)
33 KB
33 KB JPG
>>83820030
>Array programming is unironically the most powerful programming paradigm
any language that's based on a certain data structure is doomed to failure, leaving it's users crying on 4chin about how POWERFUL thier dead lang is.
>>
>>83820061
>>83820068

Note that there is no "planning phase" to begin with, because you can't plan shit without first gathering the requirements. There is no "testing phase" because testing should be conducted during the development, and not be an afterthought of the process. Likewise there is no "documentation phase", it is also concurrent to the development.

>>83819716
Documentation is much more important with a rapid turnover of personnel like that.

And to all the OOP haters, with OOP you can confine work to single classes and avoid introducing "regression faults" or fucking up another part of the code by making changes in a different part. #BTFO
>>
>>83819598
t. never employed in software dev
>>
>>83820079
not many people argue that oop isn't good for master/poo driven development, but that 3 master lispers can match your entire poo army
>>
>>83820105
>ot many people argue that oop isn't good for master/poo driven development
I argue that. If a language allows for bad programmers to write good code, or a language allows you to fire all existing developers and efficiently replace them with new ones, it's a good language. OOP languages aren't good so this doesn't apply to them.
>>
>>83820053
what the fuck am I watching

it's almost not terrible but it's weird as fuck, I can't decide if I should watch it or not
>>
>>83820079
>There is no "testing phase" because testing should be conducted during the development, and not be an afterthought of the process
there's testing by developers as part of the development process (i.e. development phase), and there's testing by end users/the customer as a part of validating fulfillment of implementing requirements by the devs (i.e. testing phase)
>>
>>83820132
yeah well we must call that something else then
>>
>>83818640
what's her name and why are her breasts so big
>>
>>83820156
usually it's called User Acceptance Test
>>
>>83819979
What if making video games is my job?
>>
>>83818640
consensual sex with hifumi!
>>
>>83820053
Greatest morning Sir. In my country this a very popular song, thus I am happy it is posted here. I am so full of hope that many of you will enjoy this song, sir.
>>
Anyone here have any manim experience?
>>
>>83819868
It is CTRL + L, not C + L.
>>
>>83819868
i don't think you can use a <CR> to execute a : command with a macro
>>
>>83820256
Ohh, thanks man I don't think I would've figured that one out. Works perfectly now.
>>83820289
Not entirely sure about all of those words but it's working for me now
>>
I got the job.
>>
>>83820978
writing Haskell, right?
>>
>>83820993
Most likely Rails.
>>
>>83821019
convince them to switch to Crystal
>>
i dont know if its explained in this snippet but

 
x = y
y = yx
(y = yx (y))

yx (y)
y = yx(yx)
and..
>>
>>83821110
 
y = y1
1 = y
x = 1
(or x = y) for >>83821110

and

if 1 (like a single "of") 500 = 500x
(500 = (500 x 1 )
1 = 500 x ) < this
is a correction of (y = yx (y) ...
... then newline here, and )


?
>>
>>83821097
I prefer to collaborate in retard friendly languages, I might try raise the option of Go
>>
>>83821140
statically typed ruby is pretty retard friendly though
>>
>>83821110
>>83821135
then 500 = (500(500)) infinitely?
where every 1 of 500 = 500, infinitely...
is what this is?
>>
File: wow he's literally me.png (181 KB, 443x480)
181 KB
181 KB PNG
>get off work at 8:30pm due to production issue
>no energy left to leetcode
my job has been super cushy throughout the year, why does it have to do this to me now so close to my interview
>>
>>83821190
in theory you wake up early in the morning and do LC before work

easier said than done
t. late sleeper
>>
finally learning how to program and I’m starting with python, could someone tell me when I’d want to use classes and functions?
>>
Biannual reminder to learn Erlang
https://youtu.be/xrIjfIjssLE
>>
>>83821323
already sort of did via elixir.
erlang has bloated syntax though, I get the lads liked Prolog, but they went a bit overboard.
>>
>>83821323
https://youtu.be/rRbY3TMUcgQ
>>
What are the advantages and disadvantages of using linked list of array vs 2 dimension array?
>>
>>83821490
Linked list of array sounds awful, but don't use either. Store your 2D array as a single array in row major order.
>>
>>83821490
A linked list of arrays will provoke divine wrath vs an array of arrays.
>>
>>83821490
>linked list of array
do you mean an array of arrays? i think that's how some languages interpret int[][]
>>
>>83821634
no he means
CL-USER> (loop with n = (random 100) repeat n collect (make-array n)) 
(#(0 0 0 0 0) #(0 0 0 0 0) #(0 0 0 0 0) #(0 0 0 0 0) #(0 0 0 0 0))
>>
>>83821490
a list of arrays is just fine in most languages
>>
How do I multi-thread this? I tried a threadpool but I can't seem to find a way on how to synchronize every row update.

#include <iostream>
#include <thread>
#include <vector>

auto fidx = [](int x, int y) {
return x + y * 64;
};
auto in_bounds = [](int x, int y) {
return !( x < 0 || x >= 64 || y < 0 || y >= 64);
};

int main() {

int nthreads = 4;//std::thread::hardware_concurrency();
int width = 64 / nthreads; // 16

std::vector<int> x( 64 * 64);
std::vector<int> out( 64 * 64);
std::vector<std::vector<int>> kernel = { {0, 1, 0}, {1, 0, 1}, {0, 1, 0}};
std::vector<std::thread> vt;
x[fidx( 64 / 2, 64 / 2)] = 1;
x[fidx( 64 / 2 - 1, 64 / 2)] = 1;
x[fidx( 64 / 2 + 1, 64 / 2)] = 1;
x[fidx( 64 / 2, 64 / 2 - 1)] = 1;
x[fidx( 64 / 2, 64 / 2 + 1)] = 1;


for(auto j = 1 ; j < 64 -1 ; ++j) {
for(auto k = 0; k < width; ++k) {
for(auto l = 0; l < nthreads; ++l) {
auto i = l * width + k;
auto index = fidx( i, j);
for(auto ky=-1; ky <= 1; ++ky) {
for(auto kx=-1; kx <= 1; ++kx) {
if ( index > 64 * 64) {
}
if( in_bounds( i + kx, j + ky) ) {
out[index] += kernel[ ky + 1][kx + 1] * x[fidx( i + kx, j + ky) ];
}
}
}
}
}
}
for(auto i = 0; i < 64; ++i) {
for(auto l = 0; l < 64; ++l) {
std::cout << out[l + i * 64] << " ";
}
puts("");
}
return 0;
}
>>
>>83821490
at the end of the day, these are two extremely different types of structures and you would use them for different things in different situations. 2D arrays are going to be superior for speed and memory purposes, linked lists trade speed and memory for flexibility.

i suppose it depends on how exactly you implement the linked list, but iterating through a naive linked list would probably be 3x or 4x slower at least, and i think that's even being generous, as the major cost of cache misses/indirect branch mispredictions would add up very, very quickly
>>
>>83821490
That's just an unrolled linked list, it's known to be "the linked list with improved performance"
>>
>>83821770
try to make it so that no two threads write to the same location.
Also your access pattern looks sub optimal, I think I would reorder the outer three loops from j,k,l to l,k,j. That might also make it easier to parallelize.
>>
File: only if.png (143 KB, 402x389)
143 KB
143 KB PNG
>>83820105
>3 master lispers can match your entire poo army
it's funny how delusional lispfags are. lisp predates C and yet the only worthy achievement is Emacs.

And here's the funny part, the core of Emacs isn't even written in lisp, it's written in C.
>>
>>83821770
fn main() {
use std::sync::{Arc, Mutex};
let fidx = |x: i32, y: i32| (x + y * 64) as usize;
let in_bounds = |x: i32, y: i32| (0..64).contains(&x) && (0..64).contains(&y);

let nthreads = 4;
let width = 64 / nthreads;

let mut x = vec![0; 64 * 64];
let out = Arc::new(Mutex::new(vec![0; 64 * 64]));
let mut vt = vec![];
let kernel = [[0, 1, 0], [1, 0, 1], [0, 1, 0]];
x[fidx(64 / 2, 64 / 2)] = 1;
x[fidx(64 / 2 - 1, 64 / 2)] = 1;
x[fidx(64 / 2 + 1, 64 / 2)] = 1;
x[fidx(64 / 2, 64 / 2 - 1)] = 1;
x[fidx(64 / 2, 64 / 2 + 1)] = 1;
let shared_x = Arc::new(x);

for l in 0..nthreads {
let out = Arc::clone(&out);
let x = Arc::clone(&shared_x);
vt.push(std::thread::spawn(move || {
for k in 0..width {
for j in 1..64 {
let i = l * width + k;
let index = fidx(i, j);
for ky in -1..=1 {
for kx in -1..=1 {
if in_bounds(i + kx, j + ky) {
let mut out = out.lock().unwrap();
out[index] += kernel[(ky + 1) as usize][(kx + 1) as usize]
* x[fidx(i + kx, j + ky)];
}
}
}
}
}
}));
}

for t in vt {
t.join().unwrap();
}

let out = out.lock().unwrap();
for i in 0..64 {
for l in 0..64 {
print!("{} ", out[l + i * 64]);
}
println!();
}
>>
>>83822058
that code is twice as slow as the C++ version
>>
>>83822058
maybe I'm reading this wrong, but are you putting a lock on the whole destination array? Isn't that unnecessary, since no two threads actually write to the same locations?
>>
>>83822170
the container isn't thread safe so you have to lock it. ideally you'd give the worker threads chunks to modify so there's less of a penalty when updating the output. as written it will be slow because of lock contention so the access pattern would need to be improved.
>>
File: xbnz1i90nr501.png (507 KB, 1070x601)
507 KB
507 KB PNG
>too dumb to implement simple 4-way-handshake in vhdl to cross clock domain in two directions
kill me
>>
In my quest to become more productive, I just finished this tool that tracks how long you've looked at different programs and can play alerts on a timer.

https://tsun.itch.io/timetracker
>>
File: timetracker.webm (1.54 MB, 1280x800)
1.54 MB
1.54 MB WEBM
>>83822531
Forgot my webm.
>>
File: 78263475623.png (52 KB, 960x593)
52 KB
52 KB PNG
>>
(You)
>>
>>83822636 (You)
>>
>>83822660 (You) (You)
>>
>>83821887
>try to make it so that no two threads write to the same location.
which mechanism do I use to synchronize the threads? std::latch or std::barrier or their boost alternative? I have already chosen the x index so that there are at least 14 data points between them and that was my plan from the start.
>>
>Don't miss this week's "The Show" where we'll interview Victor Rentea, Java Champion, and software craftsperson. He'll be sharing tips and tricks on becoming a better developer by creating intricate code.
Is "Java Champion" a higher or lower caste than "Weapon of Java"?
>>
How can I make an sql query not show rows if a value in one of its columns is already being shown in another row? for example
col1 | col2
...........................
res1 | res2
res2 | res1

I only want to see the first row
>>
>>83821490
Linked list of anything has O(N) element access time, for starters.
>>
>>83823215
you cant
>>
File: windowwatcher.png (144 KB, 1167x626)
144 KB
144 KB PNG
>>83822545
Good ol user32.dll
>>
>>83822902
you don't have to synchronize access to the source array if you never write to it concurrently.
>>
File: file.png (101 KB, 2989x638)
101 KB
101 KB PNG
i was trying to make a function that prints the longest sequence in which the elements are increasing
i.e. if I input [1,2,3,4,5,4,4,4,3,2], it should output [1,2,3,4,5], but it only outputs [1,2,3,4]
this is the case with every list, it always outputs the sequence without the last number

also, if I try to input lists which only contain increasing numbers, it outputs false
i.e. if I input [1,2,3,4,5,6,7] it prints False

def secv(lst1):
secv1 = []
el = 1
if len(lst1) < 3:
return False
while el < len(lst1) and lst1[el] > lst1[el - 1]:
secv1.append(el)
el += 1
if el == 1 or el == len(lst1):
return False
return secv1
>>
>want to learn how to do something
>look up guide/tutorial on how to do it
>fully consume guide/tutorial
>remember the general guideline of how to do it
>begin to do it
>seek assistance via google/docs whenever critical information has been forgotten/ whenever aid is necessary

what are your guys' learning procedures like?

genuinely curious on how people learn new things
i've seen a lot of pajeet-tier advice of "just code on your own until you figure it out", but i feel like this will lead to bad habits, ineffective practices, and will require far more time than necessary

seriously, why the fuck would i spend hours trying to solve something on my own, when i can simply look up how it's done, memorize it, and simply learn from applying the knowledge in a dynamic sense while working on my own projects?

grr...
>>
File: 1628317115989.jpg (235 KB, 1062x1218)
235 KB
235 KB JPG
>>83823871
>what are your guys' learning procedures like?
trial and error
>>
>>83823839
try with this [1111, 2222, 3333, 2222]
>>
>>83823896
it only outputs 1 and 2 wtf
>>
>>83823871
I guess I don't program much anyway since I'm just studying CS which is mostly math. But I basically just read thru Stack Exchange and read plenty of tutorials and blogs on a subject until I feel satisfied and if I ever need to actually write something in practice I'll refer back to it.
>just code on your own until you figure it out
This may be fun for sufficiently easy problems but I basically do the opposite: I learn theory and get the pre-made solutions until I basically already know the solution before I write it.
I remember trying to do Project Euler by just figuring it out by myself and hacking together a program, and it was the worst thing ever. Never again.
>>
>>83823839
in haskell this is just
recv xs = take len xs
where inc = zipWith (<) <*> tail
len = length (takeWhile (==True) (inc xs)) + 1
>>
>>83823871
>why the fuck would i spend hours trying to solve something on my own, when i can simply look up how it's done
You will never be more than code monkey.
>>
Actually looking for project ideas
>>
File: 1470676103078.jpg (132 KB, 1280x720)
132 KB
132 KB JPG
>>83818640
Hifumi a cute
>>
>>83824480
why is he seething tho
>>
>>83824469
Booru client
>>
File: 1549893910176.jpg (53 KB, 736x414)
53 KB
53 KB JPG
I'm stuck on getting my frontend to connect to my backend. I'm working on my first fullstack project and I have my login working as it'll only login the right users and redirects off that, but my form data isn't going to my hibernate db. There's something about my servlets and action location that mucking it up
>>
>>83819598
they hated him, for he told them the truth
>>
What is there to program? I feel like the only thing i know how to do is write wrappers to rest api's on the internet...I can do that well, making the library easy to use, but I guess a monkey could too..

Any ideas on what I should try code/learn? Main language is C# btw, thx

Also holy fuck i hate this new captcha (back on 4chan for first time in years, wtf is this)
>>
>>83819598
Perhaps. But the paper is correct.
>>
>>83824403
Based fellow Haskell user. Can you break it down and explain what it does?
>>
File: 93125004_p44.jpg (236 KB, 2048x2048)
236 KB
236 KB JPG
Hi everyone, sorry for the super basic question, but what would be a good JDK to start programming in Java? Need it for a class and they recommend Amazon Corretto JDK 11...but....
Can I just use Atom?
>>
>>83824660
Make a better captcha.
>>
Anyone know how to insert form data into a DB without Spring?
>>
>>83824803
>without Spring
sorry not possible
>>
>>83824698
inc turns a list of integers into a list of booleans, these booleans represent whether the integers are incremented, i.e. list[n] < list[n+1], list[n+1] < list[n+2]
λ> zipWith (<) [1,2,3,1,2] (tail [1,2,3,1,2])
[True,True,False,True]

len finds out where the incrementation stopped by finding the False, i.e. [1,2,3,1,2] = 3
>>
Why Windows UX is so terrible compared to Apple products? Microsoft doesn’t know that using software can be pleasant experience or they just simply don’t care?
>>
>>83822527
The requirements for writing correct CDC VHDL is a bitch. I worked on something where I tried a bunch of synchronization methods and none of them seemed to work, with the only issue being that instead of an enable being inferred on one of the registers a mux was inferred.
>>
are email addresses case sensitive?
>>
>>83824954
yes, how else are you gonna verify it?
>>
>>83824991
verify_email(lower(email))
>>
>>83824954
depends on the provider, most are case insensitive. many have additional little rules like dots don't matter, numbers on the end etc making checking for duplicates a major pain
>>
>>83824954
Read RFC, email's a bitch.
>>
>>83824822
Really? I can get the form data to show up, but I just need help with the action location. Also do you happen to know if a frontcontroller setup would fuck that up?
>>
>>83808224
>Is there an IDE or syntax hightlighter that highlights local variables and member variables with different styles?
Eclipse can do that
>>
File: EFAN7K_UcAUZSFF.jpg (22 KB, 480x480)
22 KB
22 KB JPG
It's incredible how insanely angry my clients make me
>>
File: 1603046503632.png (1.29 MB, 996x868)
1.29 MB
1.29 MB PNG
>have CS midterm
>it's a paper and pencil exam
>have 75 minutes
>everyone is nervous as fuck
>I'm not
>take only 15 minutes to complete exam
>hand to professor
>professor asks if I'm sure
>one guy says "he's just showing off"
>say "yes"
>360 and walk out of there
>go check all the code I wrote
>mfw it all works
>mfw I just dabbed on the entire class and the professor
>mfw the prof had bragged that it took him only 7 minutes to complete the exam
>>
>>83824954
This shit makes zero sense to me honestly. At first I thought it was straight forward, then I realized that you can also not even write the @ part and it'll still work then it made me realize that you can also make an email with the @ part therefore having two @'s in your email address? What the fuck? How does this stupid shit work? How can someone like gmail know it's you if you didn't write @gmail.com? Hotmail specifically makes me write @hotmail.com either that or they tricked me at account creation that I didn't have to put @hotmail.com into my email address, but I do and it's somehow retarded that I need the @ part, but some email providers don't. How does this shit work? How do they differentiate the two? What if the two emails are completely different people? I say this because without the @ part for hotmail, I realized I actually have two separate emails address with very similar names by complete accident.
>>
>>83825652
Why should you have to include the @ on their own website, retard.
>>
>>83825601
>80% done with mvp
>company and client tensions reach boiling point
>company pulls out everyone, but client asks my subteam to stay on
>new folks replace rest of the team
oh. god.
>>
>>83825675
The question isn't whether or not you have to, but how it's even allowed in their code to allow the two to be noticed as the same despite being two different inputs. Now that I've written this post, I think I am beginning to remember but hotmail lets you swap out the @ part with something else other than hotmail.com like your own custom bullshit. I don't know if gmail lets you do that. That might be the difference. In any case, it seems sketch of gmail to perceive the two as the same.
>>
File: 1629585531278.png (569 KB, 730x805)
569 KB
569 KB PNG
>>83825642
>computer science exam
>paper and pencil
>>
>>83825704
We had to hand write algorithms and functions
>>
>>83824403
take (length as) bs is just zipWith const bs as, this can probably be combined with your inc
>>
>>83822009
>lisp predates C and yet the only worthy achievement is Emacs.
Lisp has made more important contributions to the software industry than any other language.
>>
>>83822009
Allegro has made lot of stuff with lisp.
emacs ships with over million lines of lisp.
>>
>>83821770
What does it do?
>>
File: LiMP.png (2.14 MB, 1499x1239)
2.14 MB
2.14 MB PNG
>>83822009
Fool.
https://git.coom.tech/eternal-coomer/LiMP
>>
>>83825714
just like real life
>>
>>83825968
applies a kernel to a matrix. Just a test to multi thread my falling sand game after I failed with rust. This kernel just gets the neumann neighborhood.
>>
About to start learning C++. What IDE should I get?
My current choices are Atom - Code::Blocks - VS Code/Studio but I really can't choose one.
>>
>>83826162
GNU Emacs
>>
>>83826162
notepad++
>>
>>83826162
VSCode for very small projects, Visual Studio for anything larger.
>>
>>83826162
>What IDE should I get?
None, use basic tools when you're starting. If you use an IDE right away a lot of important shit will be completely opaque to you.
Learn g++
Learn make
You'll be better for it
>>
>>83826162
Why would you change IDEs just for learning C++ if you already know other languages?
>>
>>83826184
I doubt there will be anything in my school (4 of my classes requires c++ this semester). Code seems like a better choice
>>83826240
I guess I used gcc and make while trying out linux. Do you suggest that I learn about compilers in detail?
>>
>>83826296
>Do you suggest that I learn about compilers in detail?
It doesn't hurt
>>
>>83826296
You should just use VSCode then.
To use g++ as your compiler, install MSYS2 and then Mingw-w64.
>>
eclipse vs vscode vs pycharm
for python
which one, /g/?
>>
>>83826375
I've come to realise that Python is terrible once it gets to the point that IDLE isn't useable.

What's a good typed scripting language I can replace it with?
>>
>>83826375
GNU Emacs + python-mode
>>
>>83826416
typescript
>>
>>83826375
just use IDLE
>>
>>83826482
how do I use idle if i have to use modules?
>>
>>83826278
I only know entry level C and Python. I'm just a 2nd year computer engineering student, I mostly used Atom but never tested it with actual projects.
>>83826305
But it takes time...
>>83826370
Alright, I'll look into that
>>
>>83826162
>>83826240
>>83826296
>make
Just use CMake and >>83819316
Also, don't bother with msys and mingw, they are just memes. Install MSVC to compile on Windows.
>>
>>83826493
>But it takes time...
So?

>>83826548
>Just use CMake
He needs to learn to walk before he can run
>>
>>83826375
>>83826482
>>83826490
Jupyter lab for dicking around, pycharm for dev. I hate jetbrains but I can't think of a better DE for python
>>
>>83826562
>He needs to learn to walk before he can run
.sh files it is
>>
>>83826562
>He needs to learn to walk before he can run
Poking transistors in mainframes it is
>>
File: 1602971471723.png (453 KB, 500x494)
453 KB
453 KB PNG
>>83826656
>>83826674
>>
>>83826023
>he doesn't code exclusively on whiteboards and google docs
>>
>>83826562
Learning anything about make is utterly useless, when it's merely just an implementation detail when using CMake.
Ninja is also superior anyway and you are explicitly not supposed to write it by hand either.
Just use CMake.
>>
>>83826619
>>83826490
>>83826482
>>83826454
>>83826444
>>83826416
>>83826375
just got pycharm professional for free btw
>>
>>83826562
>So?
Anon we humans mostly have limited time
>>83826674
Kek
>>
>all these anons shilling for command line compilation
daily reminder that 90% of software companies use IDEs
>>
why does cmake detect a build directory that was in a parent directory of a project I am building?
So I have it like this:
-Desktop
|-Project src
|--CMakeLists.txt
--/Project debug
---/build
----CMakeCache.txt
---/install
--/3rd party build
---CMakeCache.txt
For some reason When I configure the project, it is able to detect the folder "3rd party build" without explicitly setting it. Does cmake just recursively scan every folder in the parent directory to see if a /cmake directory exists anywhere?
>>
>>83827019
Once you get out of make/C-land, you realize compiling doesn't have to be so difficult. And CLI can actually be enjoyable when the language does the minimum of actually having a first-class build and package management system.
>>
>>83827019
coincidentally 90% of modern software is also bloated and shitty.
>>
>>83827020
actually nevermind, it doesn't detect it anymore.
>>
>>83827054
>>83827058
That's fine and good but if you don't work with the company's processes as an entry dev you're going to get canned
>>
>>83827085
good thing i don't have to worry about wagiedom, and can actually enjoy programming
>>
>>83827019
They can't be good coders of find a job, let them bath in the false sense of superiority in peace.
>>
Is it possible for a java debugger in intellij to "lose track" of the program or something? When I debug my code sometimes instead of stepping to the next line it just decides to stop debugging altogether?
>>
>>83827308
It's possible for jetbrains to be garbage shitware
>>
>>83827319
it's pretty shit but trying to write java without an ide sounds terrible
>>
wtf
λ> :i (->)
type (->) :: * -> * -> *
data (->) a b
-- Defined in ‘GHC.Prim’
infixr -1 ->
instance Applicative ((->) r) -- Defined in ‘GHC.Base’
instance Functor ((->) r) -- Defined in ‘GHC.Base’
instance Monad ((->) r) -- Defined in ‘GHC.Base’
instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’
instance Semigroup b => Semigroup (a -> b) -- Defined in ‘GHC.Base’
>>
struct Foo {
int bar;
int baz;
};

v.push_back(Foo {1, 2});


Is there anything wrong with this?
I often see things like:

Foo thing = {};
thing.bar = 1;
thing.baz = 2;
v.push_back(thing);


in loops, why name the Foo object?
>>
>>83827405
what anon
>>
>>83827414
Same thing, different style.
>>
Being a dev of actually used open-source > being a wagie > being a dev of obscure open-source > collecting languages like pokemon and only solving Project Euler problems in C, Haskell and Lisp.
>>
>>83827414
v.push_back({1, 2});
v.emplace_back(1, 2);
>>
>>83827429
function is a type
>>
>>83827568
I know nothing about Haskell, but of course, function is a type. It's an object, and objects have types.
>>
>>83827568
wrong, it's a type constructor
>>
>>83827568
It's a type constructor, like Maybe or Either
Either itself is not a type but Either Int Bool is
Also it's wired in so the first 4 lines of documentation are actually bullshit exposition
>>
kino
https://www.youtube.com/watch?v=BovTQeDK7XI
>>
>>83827640
unbased and censorpilled
>>
File: 1600021939843.png (685 KB, 687x849)
685 KB
685 KB PNG
>>83818640
I got bullied for using a global in php on /wdg/.
Context:
So I have a main .php page, it recieves a title and a file. This main calls 2 classes, one Upload and the other DBwrote/read. The Upload one has a constructor as requested by the teacher that straight up uploads to a directory. It has a few custom exception throws within a try catch that handle if everything is ok, and cancel the upload.
In the DBread/write class there is almost the same, except no constructor and everything is a bit more manual, 2 main methods, write and read. Same try catch as the other.
But back to the main.php. I call the upload function and then the write to DB function. BUT I have no idea if the upload file function went right since it MUST return a string with the src/url/path of the image. So I added a getter and an attribute on the Upload class attr->uploadissuccessful, getter->getUploadsuccess (or something along these lines). So after The Upload class does its thing I check within it and set the attribute, in the main, I check for upload success and assign it to a global inside the main page(I know, that's why I'm asking I don't like the solution). So write to DB function checks the global to see if upload was successful and then writes or aborts.

What can I do in PHP (or programming in general for that matter) to avoid this shittery?
>>
>>83827640
>another day another program that is crying out for lattices with lifted over functions instances in base
>>
>>83827678
>php
go back to /wdg/ please
>>
>>83827678
I'm not a webdev, but...

Why you can't return a tuple/dictionary/object/whatever php uses with both success status boolean AND string?
>>
>>83827497
I'm still not convinced open-source isn't a meme.
>>
>>83827731
you can return anything you want within a function, literally. But teacher told me that upload function must return the path+filename to the picture, but I think I don't fully understand your questiong
>>
>>83827308
yeah that seems to happen with intellij sometimes
eclipse does not have this problem

t. member of the eclipse resistance camp of my ENTERPRISE JAVA company
>>
BFS just isnt used.
I have worked as a programmer for 2 years now and never used BFS, but I have used DFS twice.
DFS with a stack is just more intuitive. It's simply superior.
>>
>>83827804
just replace the stack with a queue bro
>>
>>83827804
>using graph traversals at all
isn't bfs useful for pathfinding and flow/cost stuff
>>
>>83827804
seen BFS used in rendering data-heavy tree structures
>>
>>83827785
>my ENTERPRISE JAVA company
all the in house tooling was written for intellij
>>
>>83827804
Brainlet take.
>>
>>83827757
>a couple of open-source libraries literally carry 90% of ML/data analysis stack
>meme
>>
>>83827920
>java debugger is probably broken due to being written in j*va
>>
File: 1634090145712.jpg (151 KB, 2048x1622)
151 KB
151 KB JPG
Any outsystems retard in?
>>
>>83827935
brainlet take
>>
>>83819075
I would work as a woman on twitch in my whirlpool. then I would go back to a man before period hits and when I have money to buy up companys
>>
>>83819202
build something that gives windows users a better transition to gaming on linux.
>>
>>83820061
autist kid. this is /g not your business faggot spurting page give us code.
>>
>>83828634
>/g
dumb newfag
>>
the blue helmet meme but its haskellfags surrounding me with IO
>>
>give up on looking for a web shit job and decide to grind leetcode with anki to make sure I dont forget old questions
>reach 150 questions
it only took 1 minor mental breakdown to get here. 500 by the end of year or bust [spoiler]I'll still be unemployed wont I?[/spoiler]
>>
>>83828846
you get jobs by being pragmatic
>>
>>83828846
>anki leetcode
christ.
i have gotten into faang without memorizing leetcode questions. it seems like they just ask easy/medium questions. i would assume there are a lot of companies that do the same. have you leetcode grinders given up on being able to solve simple algorithmic puzzles? or do you genuinely get super hard problems all the time?
>>
>>83827997
>tfw intellij written in java
>literally have out of memory issues and have to change the jvm configs for intellij itself
pottery
>>
>>83821308
I also started with python. book name Actionable 3 python

I think I learned definitions, formating and other stuff there but can't remember doin OOP. I'm learning java now and will pick up python again after I know java
>>
>>83828983
Haskell language server doesn't have this problem because you have to configure it NOT to use 20GB ram
>>
>>83828910
I just have infinite free time and am a brainlet so figured I might as well try repetition.
I havent even applied to any big tech firms and wont for the next few months
>>
>>83829049
focus on ability to solve new problems before anki-ing
>>
>9.2.1 STILL not released
>hls STILL not fully updated for 9
unbelievable haskell sisters what the fuck is wrong with us
>>
>>83829157
oh and profunctors still isnt in base lmao
>>
hi anons, is there any unique and good project idea for cpp/c y'all have? i already know python,go and javascript which makes making most things very easy and enjoyable. i want to learn and make use of cpp/c as its really old and mature language with lots of power.. no idea where to start because a lot of the thing i might require is already built in cpp/c. having hard time coping with myself. really wanna dig on those pointers and controlled memory management bugs to learn more.. i can always dig dive and make a good android studio but that's too overwhelming for someone trying to learn.
>>
>>83829147
I see nothing wrong with "try 4 new questions a day and then spend the rest of it reviewing"
>>
>>83828846
>memorizing leetcode questions
I hope you're joking.
>>
>>83827804
how are you going to use DFS when the depth is unlimited? e.g. a chess engine.
>>
>>83824424
don't listen to this faggot.
if you at least tried tinkering on the code and tried finding a solution with what you already know and failed. think about a way you want to solve it and google to see if it's possible. if not learn how others did it then tinker on your own code to fix it (don't copy paste! you will learn nothing that way. I personally am doing a course where I don't get spoonfed and I can see that each passing month I can read other peoples code more clearly
>>
>>83828846
Depends if easy or hard question
>>
>>83824702
use coretto nigga
>>
Not sure i'm in the right thread for this so here goes:
I am trying to download the most recent file from a HTTPS address. The url is:
https://iptvm3ulist.com

The file I wish to download is updated daily, so it has a new filename. How do I download the most recent ZIP file from this site?

I have tried uget/curl/wget and I am getting 503 errors.
Help!
>>
File: gimi.jpg (8 KB, 320x180)
8 KB
8 KB JPG
>what are you working on?
some retarded shit for my Data Structures and Algorithms class.
We gotta re-implement Java's StringBuilder using a linked list instead of an array as the underlying structure
>>
>>83823871
you can't be a master in a few months. it takes a lifetime
>>
>>83818640
My cute game developer wife, Hifumi!
>>
>>83828846
you better just become a botseller at some popular online game at this point
>>
>>83821770
From what I can see you don't need to synchronize row updates because no part of the computation depends on the result of another row. You just need to wait for the threads to finish entirely.

Hopefully your real problem is bigger than 64*64, because that's quite small for multithreading.
>>
>>83824424
difference between a script kiddie, programmer, computer scientist:
Script kiddie writes code without understanding the fundamentals of programming. Needs help not only understanding or solving the domain problem, but with using language features itself, using the appropriate data structure, choosing the appropriate algorithm, etc.
Programmer understands his language well, but may need occasional referencing of edge cases or less common features. Can appropriately choose known data structures and known algorithms, and re-implement them for custom behavior. Can be given a specification and code to that specification, generally without assistance (although assistance may result in a better solution).
Computer scientist might or might not understand his language well, but is primarily concerned with creating and understanding known and as-yet-unknown data structures and algorithms.

Poster above seems to be script kiddie tier.

>>83823871
Figure it out on your own. THEN look up other people's solutions. Understand why their solutions are better than yours.
See above -- you're not expected to just magically know that the Sieve of Eratosthenes is an efficient way to find prime numbers, or to just figure that out on your own, but being told to find prime numbers using the Sieve of Eratosthenes, you should be able to look up the english description of the algorithm and implement the solution.

So, being told "find prime numbers," you'll program a naive solution. Then you're going to google "how to find prime numbers," and you'll see solutions using the sieve. You'll be like "Wtf is that" and find the wikipedia page. You'll understand it, do it yourself, benchmark your result. The other solutions are STILL faster than your's. Why? Oh, they're using a segmented sieve which is better on the cache -- let's try that way!
>>
>>83819316
>creating new C++ and C projects

found your problem
>>
>>83830163
What are some good base C++ and C projects to fork off of then?
>>
I tell all my friends that I'm writing my backend in Rust. But I'm secretly using Go, because I'm not smart enough for Rust... Will they laugh at me when they find out?
>>
>>83823871
>look up guide/tutorial on how to do it
This is a great strategy, but it only works while there are guides and tutorials written for what you're doing.

It doesn't take much to get off the beaten path. For example, most jobs will involve working on systems without available guides and tutorials.

For a while you can probably ask the more senior devs, but at some point, and quite quickly, there will be no one more senior to ask.
>>
>>83830188
Any semi useful C project, not C++. At least then, anyone can profit off of it. Better though, pick any project and rewrite it in Rust.
>>
>>83830206
They will laugh at you either way
>>
>>83828910
>i have gotten into faang without memorizing leetcode questions
You're supposed to memorize and then regurgitate solutions. Fleshing out a problem and designing and implementing a solution for it is cheating.
>>
>>83827020
>>83827080
With cmake-init, this is not a problem
>>
>>83827019
>>83827085
Every company worth its salt has a CI process in place and you can't run IDEs in CI environments :)
Also, every IDE worth using just delegates to command line utilities :)
>>
>>83822321
>8
>>83822170
can't you just use iterators to parallelize access or are C++ iterators working with various parts of the underlying memory going to cause thread unsafety problems with the container they're in?
>>
any c++ gods in? is there any way i can improve this stack implementation? new to the language so trying to learn.
#include<iostream>
#include<vector>
#include<stdint.h>

template <typename T> class Stack
{
public:
Stack() = default;
void push(T item);
T pop();
T top() const;
uint32_t len() const;
bool isEmpty() const;

private:
std::vector<T> m_data;
};

template <typename T> inline void Stack<T>::push(T item)
{
m_data.emplace_back(item);
}

template <typename T> inline T Stack<T>::pop()
{
T item = m_data.back();
m_data.pop_back();
return item;
}

template <typename T> inline T Stack<T>::top() const
{
return m_data.back();
}

template <typename T> inline uint32_t Stack<T>::len() const
{
return m_data.size();
}

template <typename T> inline bool Stack<T>::isEmpty() const
{
return m_data.size() == 0;
}
>>
File: bunny aesop.jpg (144 KB, 1030x1030)
144 KB
144 KB JPG
What I'm doing wrong here:

#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <random>
#include <utility>
#include <string>

std::mutex mtx;
std::condition_variable ping_cv;
std::condition_variable pong_cv;

std::mt19937 engine;
std::uniform_int_distribution<int> distribution(1, 42);

unsigned number = 0;

auto refuse(std::string) -> void;

auto main() -> int {
auto ping = std::pair<std::thread, std::string>{};
auto pong = std::pair<std::thread, std::string>{};

ping.second = "ping";
pong.second = "pong";

ping.first = std::thread{refuse, ping.second};
pong.first = std::thread{refuse, pong.second};


ping_cv.notify_one();

ping.first.join();
pong.first.join();

return 0;
}

auto refuse(std::string id) -> void {
std::unique_lock<std::mutex> lck(mtx);
if(id == "ping")
ping_cv.wait(lck);
else
pong_cv.wait(lck);

if(number > 1024) {
lck.unlock();
if(id == "ping")
pong_cv.notify_one();
else
ping_cv.notify_one();
return;
}

engine.seed(std::random_device{}());
number += distribution(engine);
std::cout << id << " " << number << "\n";
lck.unlock();

if(id == "ping")
pong_cv.notify_one();
else
ping_cv.notify_one();

refuse(id);
}


Basically the idea is:
1) Make a thread wait for a notification
2) Print a number with id(for example "ping 7")
3) Increase the number by a random value between 1-42
4) Notify the second thread
5) If the number is bigger than 1024, stop threads and the program.

No matter what I try, the program does nothing after I run it and I have to kill it. Any ideas?
>>
>>83830494
This is less of an implementation of a stack and more a proxy for parts of std::vector
>>
>>83830487
as far as I know iterators should work fine, as long as it's just a normal iterator and not something like a back inserter.
>>
>>83827678
>loads and loads of shit
why can't people ask the question in cs manner - straight to the point?
what is this, a fish market?
>>
>>83830524
yeah, it's a stack in spirit but not totally. i figured doing the nitty-gritty bits like making some sort of half assed std::vector or array from scratch wouldn't affect what i'm trying to do.
>>
>>83828534
>I would go back to a man before period hits and when I have money to buy up companys
this
would totally exploit the social construct or system by becoming a woman
>>
>>83830494
>c++ gods
no such thing
>>
>>83830494
std::move
>>
>>83830506
does the visual studio debugger work for multiple threads yet? I haven't tried that in a long time.

Worth a shot, set a breakpoint in the code in one of your running threads besides the entry-point "main thread"
>>
>>83830585
in the emplace?
>>
File: 347895.jpg (68 KB, 759x1024)
68 KB
68 KB JPG
>>83830581
I am here.
>>
>>83830630
that and pop
try using your vector with unique_ptr then or some non copyable
>>
>>83830627
I don't know, I will use gdb tho if it works.
I will try with that breakpoint.
>>
>>83830494
my suggestions. I didn't write an implementation.
template <typename T> class Stack
{
public:
Stack() = default;
void push(const T& item);
void pop();
[[nodiscard]] T& top();
[[nodiscard]] T top() const;
[[nodiscard]] uint32_t size() const;
[[nodiscard]] bool is_empty() const;
void clear();
private:
std::vector<T> m_data;
};


>>83830524
As it turns out, stl::stack is considered a container adapter in that it adapts an underlying sequence container to behave like a stack.
>>
Im trying to make a 2d platformer. I have a text file with numbers and letters representing the different blocks and entities to spawn into the world. How do I parse the file into a map without using a stupid long switch statement? For example, it reads '1' and then goes to Brick* brick = new Brick(x,y), map.at(y).push_back(brick). How do I make this not retarded like that? All my tiles are their own seperate classes underneath a generic GameObject class. I tried using an unordered_map, but I want to specify the location to spawn in during initialization.
>>
>>83830506
uh, aren't you (attempting) to lock the mutex immediately in both threads then telling them to wait for the mutex to be free?
>>
>>83830506
>refuse(id);
Did you mean to call refuse recursively like that? Because without a stop condition, that thread will never terminate.
>>
>>83830506
the condition variable is only there for signalling a change to an actual variable. You need some variable like 'whose_turn_is_it', which you protect with the lock, and use the condition variable to signal the waiting thread that you have changed it.
Read https://en.cppreference.com/w/cpp/thread/condition_variable for more info on how to use a CV.
>>
>>83830653
>>83830695
neat, i will work on it. thanks.
>>
>>83830794
ignore anon he's dumb
>>
File: 1606693498761.png (267 KB, 678x633)
267 KB
267 KB PNG
Update: I got 100% on my midterm and the average was 86
>>
>>83830864
>only 100%
dumb frogposter
>>
>>83830702
>How do I parse the file into a map without using a stupid long switch statement?
How many types of blocks are you dealing with?

>For example, it reads '1' and then goes to Brick* brick = new Brick(x,y), map.at(y).push_back(brick).
Highly worrisome. I'd have to see code, but that snippet gives me concerns already. The map part seems like it'd be invariant and wouldn't need to be in a switch for determining the block type.

Also, I don't see why you'd go for an associative container instead of something directly suited to a 2D grid, like an array.

>All my tiles are their own seperate classes underneath a generic GameObject class.
I don't know why you did that, but I think you'll get to learn a lot about inheritance this way. And, next time, you'll likely make a single Tile class for all of your tiles.

Does each and every Brick actually have or need the ability to have a different behavior?
>>
>>83830864
B A S T E
>>
>>83825642
>>83830864
Sounds like a good feel, anon :3
>>
>>83830942
It feels like I metaphorically shit all over everyone else in the class
>>
>>83830976
100% is 1, anon. The average was 86.
>>
>>83830887
>How many types of blocks are you dealing with?
Its a mario clone, so like 20?
> And, next time, you'll likely make a single Tile class for all of your tiles.
>Does each and every Brick actually have or need the ability to have a different behavior?
Im kind of confused, if theres only one tile class, how do the different blocks behave differently? You have a brick that can be hit and be destroyed, a question block than can spawn an item, an enemy spawner that spawns an enemy, all those need their own class to have a unique update function.
>>
>>83831029
>how do the different blocks behave differently
data oriented design
>>
>>83830752
No, it doesn't really work like that.
>>83830785
It will stop, there's a "return" in the function.
>>83830788
Thanks, it worked, did you mean to use it like that?
#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <random>
#include <utility>
#include <string>

std::mutex mtx;
std::condition_variable ping_cv, pong_cv;
bool ping=true;

std::mt19937 engine;
std::uniform_int_distribution<int> distribution(1, 42);

unsigned number = 0;

auto refuse(std::string) -> void;

auto main() -> int {
auto ping = std::pair<std::thread, std::string>{};
auto pong = std::pair<std::thread, std::string>{};

ping.second = "ping";
pong.second = "pong";

ping.first = std::thread{refuse, ping.second};
pong.first = std::thread{refuse, pong.second};

ping.first.join();
pong.first.join();

return 0;
}

auto refuse(std::string id) -> void {
std::unique_lock<std::mutex> lck(mtx);
if(id == "ping")
while(!ping) {
ping_cv.wait(lck);
}
else
while(ping) {
pong_cv.wait(lck);
}

if(number > 1024) {
lck.unlock();
if(id == "ping") {
ping = false;
pong_cv.notify_all();
} else {
ping = true;
ping_cv.notify_all();
}
return;
}

engine.seed(std::random_device{}());
number += distribution(engine);
std::cout << id << " " << number << "\n";

lck.unlock();
if(id == "ping") {
ping = false;
pong_cv.notify_all();
} else {
ping = true;
ping_cv.notify_all();
}

refuse(id);
}


There is one more thing now, which I just noticed and I don't know how to really approach: I need to pass the number to the "ping" thread from the main function.

I don't ask for the code, just an idea how I can achieve that, global variable seems like an easy solution to me in this case.
>>
>>83821770
>>83826052
it's worth mentioning that this is the kind of thing GPUs are really well-suited for
>>
Hey fellas, I was planning on becoming a full stack web developer but to be quite honest, I am too much of a brainlet for backend. From your point of view, do you think front end is still viable, or do most web devs do full stack?
I am into React
>>
>>83831165
>>>/g/wdg
>>
>>83831085
>It will stop, there's a "return" in the function.
You should still rewrite it because unique_lock is RAII and would automatically unlock instead of your error prone manual approach.
>>
>>83830864
>Gloating about getting a 100 when the average was 86
>>
>>83831046
So does that mean every tile will now have properties like "breakable" and "spawn_entity"? Seems like the tile update function would be a mess if it has to check all those conditions to determine what functions to run.
>>
>>83831208
Maybe it's golf
>>
>>83831085
yup that's what I meant.
I guess you could pass a reference to the number to both threads instead of using a global if you want.
>>
>>83831183
Like that? Still works:
auto refuse(std::string id) -> void {
for(;;) {
std::unique_lock<std::mutex> lck(mtx);
if(id == "ping")
while(!ping) {
ping_cv.wait(lck);
}
else
while(ping) {
pong_cv.wait(lck);
}

if(number > 1024) {
if(id == "ping") {
ping = false;
pong_cv.notify_all();
} else {
ping = true;
ping_cv.notify_all();
}
return;
}

engine.seed(std::random_device{}());
number += distribution(engine);
std::cout << id << " " << number << "\n";

if(id == "ping") {
ping = false;
pong_cv.notify_all();
} else {
ping = true;
ping_cv.notify_all();
}
}
}
>>
>>83831208
>>83831223
I had a pretty bad week and I needed the win on this one desu
>>
>>83831230
Nice, that works, thanks a lot!
>>
>>83829323
>"try 4 new questions a day and then spend the rest of it reviewing"
if you can handle that without burning out go for it
5 new questions a day is pretty reasonable, but how long it takes to do the question really depends on it's difficulty

quick check though, if you had to regurgitate a binary search right now without looking it up in less than 2 minutes, could you do it?
>>
New thread:
>>83831371
>>83831371
>>83831371
>>
>>83831165
It's fine, but keep in mind that a minuscule amount of skill points in the other end gives you a lot of leverage.

If you can get a shitty CRUD backend up and running, you can make prototypes and demos if not complete projects all by yourself without getting blocked by backend.

Similarly, if backend devs can get a shitty 1997 style web interface going, they can also make prototypes, demos, and developer tooling without being blocked by frontend.
>>
>>83830494
template <typename T>
class Stack
{
public:
Stack() = default;
void push(const T& item);
void push(T&& item);
void pop();
T& top() &;
const T& top() const&;
T top() &&;
size_t size() const;
bool empty() const;

private:
std::vector<T> m_data;
};
>>
>>83831479
>T& top() &;
dubious
also where is the move constructor/assignment? why why isn't it a struct
>>
>>83831529
https://en.cppreference.com/w/cpp/container/stack/top
I mean it as a normal top(), not top + pop in one package like anon did it.
>>
>>83818640
Group is working on a multiplayer browser game for our large project. Don’t quite like Java script so far though.



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.