/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1558301322975.jpg (378x535, 223K)

Other urls found in this thread:

stackoverflow.com/questions/21104476/what-does-the-r-in-pythons-re-compiler-pattern-flags-mean
docs.python.org/2/library/re.html
mmhaskell.com/monads
jdgmiles.github.io/Futoshiki-Solver/
twitter.com/NSFWRedditGif

working on emails with retarded client

nth for Nim!

why does godbolt make you cast the return value of malloc?

you're probably using C++

FUCK

Making a JSON encoder for my operating system.

Attached: Screenshot at 2019-06-17 20-49-04.png (1920x1080, 732K)

>not casting mallocs return value
Are you retarded, user?

Attached: 1436190867256.jpg (266x317, 15K)

>casting mallocs return value
retard

go back to CS101

Neat, user. Any specific need for it?

Empty chars i think, if you use printArr function it prints something like for example arr[0][3]=* arr[0][4]= arr[1][0] = *

i meant that guy

Yeah it's for the UI builder app primarily. So I can put widgets inside widgets. The previous format was "INI file format" which doesn't really do nesting.
But now that I'm making this I'm starting to feel like it would be nice to use JSON for various /proc files (instead of CSV which is what I currently do)

Shit, looks like it's back to cs101 for me

// Lab 1b
// Programmer: user
// Editor(s) used: vim
// Compiler(s) used: g++ (cygwin)

#include
using std::cout;
using std::endl;

int main()
{
// print my name and this assignment's title
cout

Attached: 1424937690025.jpg (500x669, 12K)

okay next stupid question

a little birdy told me that sizeof(type) * num was preferred to num * sizeof(type) when mallocing num items, but it looks like they do the same shit

was this bird terminally retarded?

Attached: Screenshot from 2019-06-17 14-53-21.png (1555x437, 68K)

Any type of micro-optimization like that is not going to be worth it even if it was true. Because I said so.

the birdie should have told you to do int *a = malloc(x * sizeof *a);

>but it looks like they do the same shit
It's a style thing, not a performance thing

thoughts on cs50's recorded classes?

>int
>doesn't return

your future is not looking good

It's technically okay to not return, it is just UB to use the result.

>returning from main
It's optional though, user.

That's actually specifically mentioned in the standard to be okay

Must be fun to reinvent every wheel imaginable on the way.

Wrong, lacking a return statement at all is undefined behaviour for ordinary functions.
Unless it's main. Then it's okay.

do any of you contribute to OSS project (that is developed by anyone else except you)? how did you start?

Grapes sure are sour from down there today, huh? Implementing algorithms is fun and productive.

where in the standard is this behavior defined?

what part of it are you questioning?

It wasn't a purely sarcastic comment.

I'M THE TEACHER HERE! YOU'LL DO AS I SAY OR I'LL YOU GIVE YOU AN F.

See me after class.

it just seems strange that you can use "a" in the same line where it is declared and initialized.

But Professor Khajamala, you are retarded and I can't even understand your lectures. And you smell like DMT

The declaration's already in scope.

It's really fun, although I don't really think of it as reinventing the wheel. I acknowledge and admire the wheel. I'm just trying to build the nicest wheel that I can :)

Attached: cdkydjg.jpg (917x1200, 307K)

>I'm just trying to build the nicest wheel that I can

Attached: 1440070593955.gif (500x500, 2.07M)

>not making a better cpu architecture on an fpga

just a periodic reminder that we, javascript kiddies, are making bank and fucking with hot dudes while yall are arguing about obscure programming languages

>fucking with hot dudes
i'm having a good time just not being a fag

read.d:33:27: error: new can only create structs, dynamic arrays or class objects, not Token[]'s
What the fuck is Token[] except a dynamic array then? d is a heap of shit

>unironically being a boy on /dpt/ in 2019

have gay sex

why are they going backwards?

Most pointless comnent on /dpt/ 2019

I look forward to the day when the world runs on neetOS.

Attached: catcafe.gif (408x303, 708K)

>clockwise
>backwards
You're mad as a hatter

Clockwise is for clocks.

What makes writing optimised stuff like a danmaku engine so difficult?

Are non-japanese indie games bloated on purpose?

it's hard to emulate soul on a cpu

Janitors are for bathrooms

Attached: kali.png (1156x867, 1.43M)

anyone knows what the r means and if I have to write it?
python btw

Attached: rer.png (786x158, 78K)

rawstring

stackoverflow.com/questions/21104476/what-does-the-r-in-pythons-re-compiler-pattern-flags-mean

raw string, often used for regular expression patterns

>The solution is to use Python’s raw string notation for regular expression patterns; backslashes are not handled in any special way in a string literal prefixed with 'r'.
>So r"\n" is a two-character string containing '\' and 'n', while "\n" is a one-character string containing a newline.
>Usually patterns will be expressed in Python code using this raw string notation.
docs.python.org/2/library/re.html

>if I have to write it?
no

Attached: 960.jpg (960x540, 43K)

>vertical tab
Have you ever seen this in use?

No, no clue what it does other than show up in binary data. And it is considered `isspace` in c

thanks

Made for Teletype writers back in the day.

Attached: [HorribleSubs] Yatogame-chan Kansatsu Nikki - 10 [720p] [00:00:25.504].jpg (1280x720, 398K)

How can you tell when you're a good programmer?

How can you tell when someone else isn't a good programmer?

I am a good programmer. You are not a good programmer.

Once you know how to approach most problems and how to go about writing it, you can call yourself a programmer. The good part with experience.

free floating operator overloading

Attached: madness sets in.jpg (340x191, 24K)

me too user. it will be a chill and peaceful future

Guys, I have absolutely no fucking clue about programming, but I know what I want to build.

Basically, I need to be able to build something that pulls data from a database and represents it in nice looking graphs.

It has to have a nice user friendly UI.

What do I need to learn?

I'm guessing SQL and something else, but I don't know what.

Can someone here give/link to a good explaination of what monads are (at least in Haskell)?

a monad is the opposite of a demiurge

First of all: Do you want it to be a desktop program or maybe a web app?

I've been wondering this same thing. No metric seems reasonable. You'd have to judge on a case-by-case basis. What tradeoffs are made and why?

a monad is a type class that specifies the functions bind and return
bind and return must follow the monad laws, which basically are equivalences for what your code should mean when these functions are composed

A desktop program.

>Can someone here give/link to a good explaination of what monads are
No.

Think of some programmers you believe are good. What do they have in common?

mmhaskell.com/monads

obviously you'll want to learn the database you're using as well as a nice gui framework.

monads are a way to connect functions

A monad is any generic type that supports certain list-like mapping and flattening operations. It is a freakishly general abstract concept. That's what makes it useful, and that's also what makes it hard to understand.

Then your simplest and best bet is learning Python + some nice GUI library for it + some plotting library. Also, you have to decide whether you want your database to be on the same computer as the one running the "viewer" program (SQLite) or maybe make it a bit more client-server structured (godtier PostgreSQL, pajeet-tier MySQL)

Thanks user for explaining it properly

>list-like
I question this definition.

Client-server would be what I'd need to do.
This points me in the right direction. Cheers bro this was super helpful.

A monad is just a monoid in the category of endofunctors, what's the problem?

Attached: f24de7124d331fb0dd7c79e057657a31cb3736632cb295fd1d52857805779492.png (196x232, 71K)

It's a starting point, but not a good one, but there isn't a better one I can think of. You can point out that functions are monads, too, and then people's brains just explode and they can't understand what you're saying anymore because they no longer have brains.

yikes

don't call us, we'll call you!

It's more useful to think in terms of "is Jim a good fit for the requirements of project A", and with bigger projects you even think about for for the specific subtasks.
So the question is, good for what?

I just tell them it's a way to connect functions together.

WinForms + any Sequel driver is the easiest option on windows.
>nice GUI library
>for python
no such thing.

>What do they have in common?
They're Indian.

Prototype it with python, sqlite, pyqt. Packaging and distribution is a mess tho.

Attached: DCVnQ-5VYAQ8vo1[1].jpg (600x400, 43K)

Id argue many things are beyond explaining simply, or explaining them simply won't properly convey what they are, or how they work.
Also
>taking advice from a thief

When you grow out of OOP.

Or; you just don't understand it.

Not saying it's wrong, just that it's not absolute.

n-body problem is cpu intensive

Why is python so much slower than javascript if both are so similar

Attached: opvo0s86hq911.png (300x300, 82K)

How do you publish your code online? I was looking for a futoshiki solver and the best I could find is this:

jdgmiles.github.io/Futoshiki-Solver/

Which only works for 5x5 grids. So I wrote my own and it's finally ready, but I have literally zero knowledge of web anything. Mine is a C++ program that reads from a text file and displays the result on console.

but danmaku don't really interact with one another