/dpt/ - Daily Programming Thread

/dpt/ - Rei Edition
actual old thread: What are you working on Jow Forums?

Attached: rei.png (332x332, 138K)

Other urls found in this thread:

varkor.github.io/blog/2019/03/28/idiomatic-monads-in-rust.html
twitter.com/SFWRedditImages

hello sirs

nice render fag

want to make a recurrent neural network for fun but im too fucking exhausted after work

there is literally nothing fun about RNNs though

make a neural network that makes neural networks when you're too tired to

Is everyone code?

Attached: A2018AD4-C8C5-4000-83C5-B462A78F0EDA.jpg (400x400, 19K)

>edition
remove your shitty thread and create one using the proper template

kys asukafag

Previous OP here.
This new thread is fine.
The new OP pic is aliased but we'll survive it.
Look at how hard Rei is trying to put on a smile.
Give her a chance.

kys r*itard

Attached: 005201902.png (530x455, 340K)

Lisp appreciation thread

HOMOICONICITYEASIEST SERIALIZATIONFUNCTIONALPROCEDURALDOESN'T TREAT IO AS DIRTY

you need to use \r\n on windows

i did checkmark unicode but Jow Forums took it out

#include
#include

using namespace std;

int main()
{

vector a {1,2,3,4};
vector b {5,6,7,8};
copy(b.begin(),b.end(), back_inserter(a));
for (vector::const_iterator iter = a.begin(); iter != a.end(); ++iter)
cout

shut the fuck up asukafags

>unicode
yikes use 8bit latin ISO standards only please

>using
c-- come see me after class

Phoneposting, so no code, but
a) try STD::vector.insert instead of copy, it might be faster due to move semantics
b) instead of for, try range based for to iterate through your vector

>come see me after class
hot

int main(void){
int *a = (int[]){1, 2, 3, 4};
int *b = (int[]){5, 6, 7, 8};
for(int i = 0; i < sizeof(a)/sizeof(int); i++)
( i + sizeof(b)/sizeof(int) -1)[b] = i[a];
printf("%p", a);
return 0;
}

>casting

OH NONONONONONONO

Attached: absolute_bloat.png (1226x581, 71K)

broke
class Functor f where
map :: f a -> (a -> b) -> f b


woke
trait Functor {
type Map: Functor;
trait MapFn;
fn map(Self, F) -> Self::Map;
}


varkor.github.io/blog/2019/03/28/idiomatic-monads-in-rust.html

How the fuck do you guys just know what needs done to make a program work?

Anything beyond simple uni assignments I constantly feel underqualified to tackle. For example the DPT roller projects. Looking through them all, I have no fucking idea where to even begin with the majority of them.

>Create an IRC Chat app
>Create a chip8 emulator
like am i retarded for not knowing shit like this? Usually i can brute force it and somewhat cobble together something functional, but that just makes me feel even more incompetant since the final project is just code from various guides/stackoverflow posts that i've managed to somehow make work.

I can read and write code fine and when someone describes a task, i can understand and see the logic in it. What do i need to study/learn though to be able to put together projects and know where to start with them?

Where is the asm result with -O2?

>tranny
the only 'woke' you get is waking up realizing what a terrible mistake you have done cutting off your dick then taking your own life at the age of 30

How do you guys code in your spare time? I'm so exhausted after work

You're supposed to feel unqualified from the whole project, but qualified for each component.

The key is that after you cobble things together you go though all the components (what other parameters does this function take) how can I make it so my programs does x slightly different thing ?

lots of practicing with various things, trying out various libraries, and reading blogs and documentation

>chip8 emulator
easy
>irc chat app
hard

cocaine and espresso, not even joking.

This

The Prodigy makes the best albums to listen to while coding. Prove me wrong. Pro tip: you can't

How the fuck do I learn C++? I know some other languages, and read enough to do simple things like doing coding chalanges in it, but where the fuck do I go from here? I downloaded about 10 books about it and each one had completely diffirent content after the first 2 chapters about veriables and control flow.

I work on passion projects but without caring about performance. It's actually fun shitting out code in high level scripting languages and watching the results instantly. If my boss saw my personal project code he would kill me

Chip 8s really supposed to be easy?

Christ maybe im not cut out for all this. Took me like a week to get that done. And about 80% of it is taken from looking at google/other peoples githubs ;_;

bjarne's book (most recent edition) and scott meyer's essentials series
also the new edition of that concurrency book for learning multithreading and atomics

#include
#include

int main()
{
std::vector all;

std::vector a {1, 2, 3, 4};
std::vector b {5, 6, 7, 8};

all.reserve(a.size() + b.size());
all.insert(all.end(), a.begin(), a.end());
all.insert(all.end(), b.begin(), b.end());

for (auto &x : all) {
std::cout

In comparison to a chat app? Of course it is.
A gameboy emulator can get hard if you want it to be accurate, but a chip 8 emulator has no secrets. Its literally just following the specs to a t and shitting out code

>Its literally just following the specs to a t and shitting out code

You hit the nail on the head with where my problem is better than i could have. I can write code and read code. I can read the specs and documentation, and it makes sense to me. Everything falls apart though the instant I have to convert those ideas and specifications into actual code though.

Its my biggest downfall and has been from the start of my studies, does it just come with practice and seeing a large variety of different programs, or is it like a fundamental skill I need to brush up on?

hmm well you raise a fair point. Consider the following:
There are plenty of people who can read mathematical theorems and accept them (i.e. it makes sense to them). They might even claim they understand it, using some analogy or whatever. But as any professor of math will tell you, you don't understand shit if you can't use it to solve problems or prove other theorems. This is what most Phd students refer to as "grinding". You just do shit tons of problems, which make use of the theorem in different ways, until you develop the ability to instantly recognize where that theorem might be useful.

Unfortunately, programming is susceptible to paradigm cancer, and unlike mathematics, there are many languages and standards. So I suggest trying to do it with pen and paper first, developing pseudocode (protip: it's the most portable code there is).

I don't know what you guys are discussing but the suggestion to use pen and paper should be taken with the utmost seriousness. Like, more seriously than anything else ever.

Attached: p007.jpg (3000x3725, 1.35M)

i'm not even sure zoomers know how to use pen and paper anymore. Do they still teach handwriting?

absolutely based
i love you user
and i love rei
thank you for posting her
you make my day

you're welcome user
I saw the OP and decided to pop in

Attached: p096_i294.jpg (2573x5266, 1.73M)

#include
#include
#include

int main(void)
{
int i,
a[] = {1, 2, 3, 4},
b[] = {5, 6, 7, 8},
n = sizeof(a),
m = sizeof(b),
N = n + m;

char *c = malloc(N);

memcpy(c, a, n);
memcpy(c + n, b, m);

for (i = 0; i < N / sizeof(int); i++)
printf("%d\n", *(c + i*sizeof(int)));
}

thoughts?

i dont think anno even knows how perfect rei is,
i hope she does well in Q4 soon TM. What programming language does Rei use?

compile error

use gcc idiot

int i = 1;
while (i < 9){
printf("i++");
}

thoughts?

I don't know but if the denizens of Jow Forums can learn programming then I'm confident they can learn handwriting too.

I'm using gcc 9.1 retard

: In function 'int main()':
:14:19: error: invalid conversion from 'void*' to 'char*' [-fpermissive]

>error: comparison of integer expressions of different signedness: 'int' and 'long unsigned int'
nice bugged 20 loc snippet cnile

>printf("i++");

Attached: Screenshot from 2019-08-02 17-34-01.png (448x447, 245K)

Wow! That's a really cute Akari!

I never expected they would release that kind of edition.

build with gcc instead of g++ retard

you're using g++

Anno knows exactly how perfect Rei is, which is why he's allowed asuka to be pandered and rewritten for 20 years because asuka is so far behind that no amount of damage control will ever let her catch up

>No optimization
Fucking idiot

#include
#include
#include
#include

//concat strings
using namespace std;

int main()
{
vector s {"hello ", "Jow Forums, ", "thoughts?"};
string p = accumulate(s.begin(), s.end(), string(""));
cout

enjoy your 5000 lines of assembly output

anno is an askuafag
eva has the "death of the author" effect
I don't even want to watch the rebuilds because I feel like they might upset me

Attached: p080_i230_i232_crop.jpg (2502x3615, 1.82M)

you're right
my bad

under GCC 9.1 it compiles

++i or i++ or i += 1

debate

hope you like seeing i++ a lot.

Those are three different things

My best with "modern" c++ is 261 instructions. Still bad

Attached: screenshot.png (3840x1672, 471K)

Stop using std::vector for this you fucking idiot

If he didn't want vectors he would've said so

turn off exceptions
>cout

>wagie problems

stop bringing the board down with your pathetic situation

>move_iterator
>for ints
Please learn C++, this does absolutely fuck all.

C++ is a disaster.

I shall give it a try. Any specific advice to keep in mind when planning out a solution in this way? I'm thinking keeping it as abstract and generalised as possible is the preferred style?

Also other question thats kinda related to my initial: should i be feeling as much guild as i do for having to google so much? the anxiety in me uses it as an excuse to beat myself up and doubt myself, but the rational part of me says thats retarded and that it makes sense to google things and spend a minute or so ensuring I have the right approach

Got given an arduino kit for my birthday today.
Whats some cool projects i can build? Preferrably stuff with more of a coding emphasis is possible

/dpt/ is my personal therapist and tech support.

WTF I was wrong, c++ is bloat shit.
C better even without any compiler optimization flag.

Attached: giphy.gif (480x416, 3.1M)

Apples and oranges. C does not have a "vector" so you'd be doing it yourself either way.

Nice

Attached: Screenshot_2019-08-02_11-51-45.png (1366x651, 123K)

Does this only work for C/C++?

I'd love to see how absolute shit other stuff is

Are there any gotchas on database structure for things like SadPanda's tagging system?
A N:N relationship would be straightforward, but I worry about the performance when you're querying stuff like "items with tags A, B, not C, not D"

do you know how artists draw good art?
they use references.
LOTS AND LOTS of references.
it's basically copying.

if a programmer needs to code something, why should it be different?
of course, if said programmer doesn't know what he is doing then there could be a problem in applying what he finds...
but if he understands it then why not?

the bottom line is that learning from and building upon the hard work of others is one of the things that successful people do.

Use fucking std::array if you want a fair comparison. Fucking idiot.

Definite case of blind leading the blind.

If you're constantly looking up more than function signatures with "man", you have a problem.

>std=c++2a
guys....

Attached: screenshot.png (1786x412, 60K)

I was thinking more about architecture than code.

BASED sepples optimizations

NOOOOOOOOOOOOOOOOOOOO

>tfw constexpr vectors

Post the whole screen you faggot...

Alternate take:

Does it matter? Even if you don't understand shit about what your doing, If you can copy pasta code enough to make it at least work, isn't that enough to live comfortable both as a hobbyist dev and professional wagecuck. As long as it's not a senior role, being able to slap shit together is all thats needed 99% of the time.

>hobbyist dev
Not much of a hobby.

>professional wagecuck
Enjoy being automated within a decade.

He is lying user.

Attached: Screenshot.png (1366x613, 128K)

good post, i'm in the same boat. I will enjoy programming a lot more once I'm past this hurdle. IMO, just making more challenging, large scale shit to completion will naturally make you better at this.

>Enjoy being automated within a decade.
Never understood this. I Get coders automating other shit like manafacturing, but surely coders making self writing software is only gonna cuck themselves out of work no?

We're talking about architecture here though.
I think it would take a special kind of genius to succeed at architecture by copying and pasting without understanding. YMMV but for me, it's easier to understand and then synthesize my own solution.