/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: se porogaramungu rangarage.png (1600x1200, 383K)

Other urls found in this thread:

amazon.com/Waterpik-Accepted-WP-660-Aquarius-Flosser/dp/B00HFQQ0VU/
github.com/doitsujin/dxvk
blog.basedkaf.com/post/pleroma-1.0/
fediverse.party/
fediverse.party/en/fediverse/
pawoo.net/
wedistribute.org/2019/05/gab-is-forking-mastodon-and-joining-the-fediverse/
wiki.libsdl.org/SDL_GL_SetAttribute
twitter.com/NSFWRedditGif

Flossing my teeth. Keep your teeth clean, everybody.

>flossing teeth instead of programming
user

Just a threadly reminder that modern C++ and Javascript are the only white male languages in 201x

>this indentation()
{
style;
}


null op, someone please remake

Have you ever impressed a girl with your programming skills?

Attached: 1561741429480.jpg (700x950, 66K)

what are you using? i am considering buying this amazon.com/Waterpik-Accepted-WP-660-Aquarius-Flosser/dp/B00HFQQ0VU/

She's using :set list

Attached: 2019-06-28.png (1120x712, 20K)

>What are you working on, Jow Forums?
I was going to work on a SDL2 and Vulkan project but it turns out my graphics card doesn't support Vulkan. AMD 6870 HD, I don't know it works for what I use it for.

I haven't brushed in 2 months, it's bad, real bad....

you can get 570s for 150 burger coins
probably even cheaper in a few weeks once people dump them to upgrade.

go brush your teeth, user

I'm too depressed though.

Hmm, I guess I will have to put aside some of my burger money. It's all so tiresome.

Attached: 1496168812046.jpg (540x876, 48K)

Actually yes. Stats professor used to give hws and tests that had the data in excel. Wrote a program that read the data from excel and solved it. She was quite impressed with it, but she got a different professor who didn't put the data in excel like that.

Still friends with her though.

Brush your teeth, user.

Attached: me making sure anon brushes teeth.png (1280x720, 518K)

It's too late. Even my tounge smells like fried, dried, and burnt black tea leaves.

rip roli

Can OpenGL be implemented over vulkan?

yes. Steam Play is using dxvk, an implementation of directx on top of vulkan.
github.com/doitsujin/dxvk

Brush your teeth, now!

Attached: 1558967716086.jpg (1016x1024, 78K)

You're so cute!

I thought I would like Land of Lisp but I just can't. I fucking hate games. It's boring as shit and distracting. Moving on to Practical Common Lisp.

I've been using flossers, but that waterpik device does look pretty cool.

Attached: flossers.jpg (1500x1500, 174K)

You know what to do.

Attached: sicp.jpg (700x849, 280K)

user...

Attached: 1541598279006.jpg (1280x720, 182K)

Wanting to some C++, but woke up too late to do anything. You guys got any ideas for ezpz projects?

nononononnono, not yet user, I am not ready!

I'm learning Golang for a new project, maintaining and updating a current one with python and actually doing work at my job. I'm happy, yet I keep coming here.

>haven't brushed in 2 months
I'm not fond of brushing either, user, but pic related makes it a lot easier by taking out most of the work. The vibration takes a little getting used to, but you will. All you have to do is position it over your teeth and it will do the actual brushing.

Attached: toothbrush.jpg (386x450, 28K)

>suggesting vibrating toothbrush
>on /dpt/
subject to misuse.

Pleroma 1.0 has been released!!1!

Fediverse unite!!!

blog.basedkaf.com/post/pleroma-1.0/

Attached: gqgdjjxpgps11.jpg (1024x579, 116K)

is lisp a maymay?

your link triggered the word filter

top kek blog.basedkaf.com/post/pleroma-1.0/
then type in your browser url bar
javascript:atob("aHR0cHM6Ly9ibG9nLnNveWthZi5jb20vcG9zdC9wbGVyb21hLTEuMC8=")
(you can't copy/paste the "javascript:" part due to safety reasons, you have to type it manually).

Is this clever? I often want to see the code of a function when I run help(func) in the Python repl. I wrote this just for my .pythonstartup file.

def ls():
'''pp(sorted(globals().keys()))'''
exec(ls.__doc__)

logging library

>tfw my puppers won't stop licking me and I can only type with one hand and can't concentrate.

Attached: 1511156506008.jpg (600x800, 133K)

On Monday I am heading to a job interview for PHP + C++ developer for a corporation that develops smart cards and ticket boxes for traffic.
Any ideas what kind of topics could the interviewer be interested in? I would appreciate your thoughts, especially around C++.

Can you invert a binary tree?

well I didn't even get to pointers, yet. No I can't, but I have been programming some atmegas at highschool and did the main OOP work in it.
guess I will look into it, thanks

I went years without brushing and when I went to the dentist, I only had one cavity

You may already have a lisp installed on your machine as a dependency, e.g. guile. Try it out.

>i have a c++ interview on monday
>i didn't get to pointers yet
user...

Attached: 1560968581962.png (369x369, 162K)

I'm normally an assman but if you keep posting ripe peachy tits like that... i'll be forced to become titsman...!

Lisp is the most powerful programming language.

I still have got what like 48 hours left, right?
no worry little man, we are gonna make it

>ripe peachy tits
Now _this_ is the /dpt/ I come for.

What the fuck is this fediverse?

fediverse.party/
fediverse.party/en/fediverse/

tldr:
The fediverse is a bunch of social network protocols (diaspora, ActivityPub, ...) being implemented by frontends (mastodon, pleroma, gnu social, ...).
People are free to host their own instance of a frontend. instances are connected to other instances.
If you can't host your own instance, there are many public ones.

Fediverse became popular in Japan after Twitter started banning lolicon; Pixiv host its own mastodon instance: pawoo.net/
Even Gab is part of the fediverse now wedistribute.org/2019/05/gab-is-forking-mastodon-and-joining-the-fediverse/

Kill them, you don't need them.

>Not liking both
faggot detected

Starting next year, it will be 202x for 10 years.

I gave puppers a bath and then out in the sun for a bit. Now puppers is sleeping at my feet like a good pups. Back to OpenGL boilerplate programming fun.

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpragma-pack"
#include "SDL.h"
#pragma clang diagnostic pop
#include "GL\glew.h"

SDL_Window *window = NULL;
SDL_GLContext *glContext = NULL;

bool InitSdl()
{
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
fprintf(stderr, "[-] %s\n", SDL_GetError());
return false;
}
return true;
}

bool CreateSDLWindow()
{
window = SDL_CreateWindow("sdl2", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, DEFAULT_WINDOW_WIDTH,
DEFAULT_WINDOW_HEIGHT, SDL_WINDOW_OPENGL);
if (window == NULL) {
fprintf(stderr, "[-] %s\n", SDL_GetError());
return false;
}
}

bool SetupGLEW()
{
#ifndef __APPLE__
glewExperimental = GL_TRUE;
if (glewInit() != GLEW_OK) {
error("Failed to initialize GLEW");
return false;
}
#endif
return true;
}

void SwapBuffer()
{
SDL_GL_SwapWindow(window);
}

void ClearBuffer()
{
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
}

bool CreateGLWindow()
{
if (!InitSdl()) {
return false;
}
if (!CreateSDLWindow()) {
return false;
}
if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3)) {
return false;
}
if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2)) {
return false;
}
if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_CONTEXT_PROFILE_CORE)) {
return false;
}
if (SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1)) {
return false;
}
if (SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24)) {
return false;
}
if (SDL_GL_SetSwapInterval(0)) {
return false;
}
if (!SetupGLEW()) {
return false;
}

ClearBuffer();
SwapBuffer();
}

Attached: 1480279859302.jpg (761x960, 117K)

requiem for user

What's with all the checks on setattribute? Does that function return 1 if it fails?

Returns 0 on success

wiki.libsdl.org/SDL_GL_SetAttribute
>Returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

I don't need those checks but I added them so they are there.

>Go forces opening bracket on the same line

Attached: 1570276963324.png (612x459, 300K)

even though go is trash, i do think forcing a style is a good thing.
bike-shedding and format tools are a plague on programming.
I hope to make a lang someday where style deviation is a compile error.

int CreateGLWindow()
{
if (!InitSdl()
|| !CreateSDLWindow()
|| !SetupGLEW()
|| SDL_GL_SetSwapInterval(0)
|| SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24)
|| SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1)
|| SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3)
|| SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2)
|| SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,SDL_GL_CONTEXT_PROFILE_CORE))
return 0;

ClearBuffer();
SwapBuffer();

return 1;
}

if you have to force one, don't force K&R for fucks sake. Fuck go and fuck that. Just for that reason I'm not using go.

forcing a style may be a good thing but enforcing _your_ style on everyone isn't. you should be able to choose the style you want to enforce on your project/code base.

Thanks. That would be shorter. Would probably want some sort of error message associated with it. I moved the SetAttributes to their own function with logging if something fails.

bool SetGLAttributes()
{
if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3)) {
error("Failed to set GL_CONTEXT_MAJOR_VERSION");
error(SDL_GetError());
return false;
}
if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2)) {
error("Failed to set GL_CONTEXT_MINOR_VERSION");
error(SDL_GetError());
return false;
}
if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_CONTEXT_PROFILE_CORE)) {
error("Failed to set GL_CONTEXT_PROFILE_MASK");
error(SDL_GetError());
return false;
}
if (SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1)) {
error("Failed to set GL_DOUBLEBUFFER");
error(SDL_GetError());
return false;
}
if (SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24)) {
error("Failed to set GL_DEPTH_SIZE");
error(SDL_GetError());
return false;
}
if (SDL_GL_SetSwapInterval(0)) {
error("Failed to disable vsync");
error(SDL_GetError());
return false;
}
if (!SetupGLEW()) {
error("Failed to set up GLEW");
return false;
}
return true;
}

bool CreateGLWindow()
{
if (!InitSDL()) {
return false;
}
if (!CreateSDLWindow()) {
return false;
}
if (!SetGLAttributes()) {
return false;
}

ClearBuffer();
SwapBuffer();

return true;
}

nah, the future is FP-style syntax anyway.
curlies for scope is outdated.
But python fucking poisoned the well for whitespace and baby C ducks refuse to budge.
Nah, i think languages like Nim waste time and cycles giving too much freedom to style choices.

>I hope to make a lang someday where style deviation is a compile error.
if (x) return 1;

if (x)
return 1;

if (x) {
return 1;
}

Which one is correct style?

>curlies for scope is outdated.
literally no one, never

They are all correct user. I use the last, because I like to be extra safe.

Pretty sexy my dude.

this
if (x)
{
return 1;
}

me just now
- me
t. me
curlies are shit
you people shit on Lisp all the time for (((((((()))))))))
but turn around and defend
{
{
{
}{
}{}{
}{}{
}{}{
}{}{}
}
}

You don't get to sit with us.

Attached: aspergers table.jpg (1200x675, 110K)

linux kernel style baby

>if true returns
absolutely shit

>c style shit
that's the problem
You're too attached to outdated syntax and grammar

except that is a false example
opening bracket on the same line
>}{
should be illegal

the only valid choice is

if (x)
{
return 1:
}


This is more readable that any format you use or will ever use.

bool SetGLAttributes()
{
if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3)) {
fail("Failed to set GL_CONTEXT_MAJOR_VERSION", 1);
}
if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2)) {
fail("Failed to set GL_CONTEXT_MINOR_VERSION", 1);
}
if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_CONTEXT_PROFILE_CORE)) {
fail("Failed to set GL_CONTEXT_PROFILE_MASK", 1);
}
if (SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1)) {
fail("Failed to set GL_DOUBLEBUFFER", 1);
}
if (SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24)) {
fail("Failed to set GL_DEPTH_SIZE", 1);
}
if (SDL_GL_SetSwapInterval(0)) {
fail("Failed to disable vsync", 1);
}
if (!SetupGLEW()) {
fail("Failed to set up GLEW", 0);
}
return true;
}

bool fail(const char *msg, int op)
{
error(msg);
if (op == 1) {
error(SDL_GetError());
}
return false;
}

if (x) return 1;

if (x) { return 1; }

if (x)
return 1;

if (x) {
return 1;
}

if (x)
{ return 1;
}

if (x)
{
return 1;
}

Pick your poison, /dpt/

Attached: 1560724508517.png (1280x720, 604K)

if (x) {
return 1;
}

is not fucking unreadable in complex code god damn you have to move you eyes to the right to see the curly brace opening then back to left and down. And if you have nested scopes it is completely unreadable, you don't know when shit starts or ends. Writing the curly brace in a new line makes everything symmetrical and nice, everything is readable and easily identificable
absolutely 1 and 6

PR accepted

sorry Im a bit drunk meant to write not fucking readable, not not fucking unreadable

5 is superior because you get brace alignment without wasting a line.

whats for dinner? im having long john silvers (fish+fries+hush puppies)

What's the best library for parsing URLs in Python? Should I just use the stock urllib?

5 is ugly, harder to read than 6, and lines do not add any cost to the program.

urllib.parse

>lines do not add any cost to the program.
They cost screen space.

that worked fine back when I was doing python. it should still work fine.

t. laptoplet
don't call me again until you have a 32 inch 4K monitor

I stopped using curly brace languages to avoid this question.

I meant this question:

Went from never looking at Python to writing a script that does calculations with an excel spreadsheet with 60,000 rows and makes graphs from extrapolated data from the workbook. Python is really easy to learn and the support/documentation for it is pretty good.

9/10 great language

Welcome to the snek side.

burg

Attached: 1531047203663.png (874x805, 706K)

>small brain: big screen
>normal brain: 1080p shitter
>galaxy brain: 80x24 terminal

All within a week, too. snek gang

Attached: 2019-06-28 18_40_33-Window.png (375x209, 26K)

Python really is a handy tool. I wouldn't use it for really big or complex problems, but for a lot of problems is the right tool for the job.

i want to be a japanese girl


what language is best for programming my own vagina from scratch???

>japanese
>faggot
probably ruby

dis

Now you're a "Pythonista".