/dpt/ - Daily Programming Thread

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

Attached: hidamari_dpt_waifu2x_traps.png (1618x1308, 1.95M)

Other urls found in this thread:

en.wikipedia.org/wiki/Maze_solving_algorithm#Wall_follower
gitlab.com/9898287/nixwriter
github.com/gort818/ddgtk/issues/5
yahoo.com
twitter.com/SFWRedditGifs

Reading through course materials that are just openly available online

will be choosing this one

>What are you working on, Jow Forums?
I'm working on my wayland compositor library.
I'm changing the renderer so it can support Vulkan.

Attached: 1420229460495.png (485x354, 300K)

nobody cares

make sure to use session types

good lad.
i want to make my own vulkan backed Wayland DE someday.

Makes me feel good to see anons whose projects I recognise. Keep up the good work. I don't suppose there's anything that can be done? I'm bored as shit.

There is so much that still needs to be done before I can even start actually adding Vulkan in. OpenGL ES and EGL were so entangled throughout everything, most of the effort is in fixing that.

C is the greatest language ever.

it was mostly a shitpost about type systems for concurrency but keep up the good work senpai

Attached: 1533851981396.png (873x1079, 929K)

guess i have to ask for help again because a new thread was made

can anyone help with this problem
(Java) a maze, you only have turn() (90°) and walk() (one step)
the walker class was given to me and i can only walk() and turn()
and everytime you touch a wall, you reset to your start Location

im trying to reach the exit, that is somewere in the maze

so i have to make an arraylist to record all the steps i made right?

im new to programming and i cant figure this out,
also i really need help, its insane how much this would help me
thansk!
my code, pastebin.com/Av8B6WWm

>an anyone help with this problem
no

Attached: kek.png (406x63, 2K)

The project (wlroots) is certainly welcoming of newcomers and drive-by contributors, but I can't think of anything particularly easy/self-contained someone could do right now.
Most of the things I can think of that need to be done really requires a fair bit of domain-specific knowledge.

Do you know when you reset /.when you hit a wall?

yes, when i hit a wall, i reset

thanks anyways

trying to decide how to approach making an emojipasta generator; crytyping and OwOposting were simple, but there were some subtleties involved

thinking about matching words against a prefix tree but it's going to take a lot of tweaking to get the feel right

Do you know the size of the maze and the relative entry point? If not, do you have an upper bound?

It's the only one I know so I agree.

the maze has a size of.. 100
dont know what an upper bound is
probably not

Attached: learn ada.jpg (1600x1034, 986K)

I NEED TO AUTOMATE SOMETHING THAT MAKES ME MONEY


FFFFFFFFFFFFF

Attached: B5634171-A38C-4793-B4B1-6F1A557F298E.png (839x778, 778K)

god how dumb are you
>arraylist
kill yourself

why is everyone shilling ada, why should i learn ada

you can use a 100 by 100 bit array (or more simply and less efficiently a bool array) to represent the maze, setting the bits when you hit walls

it was the Rust before its time except good.

in what way, i'm not familiar with Rust.

you shouldnt.

It focused on safety and was much more test-oriented. And got contracts way back in 2012.

alright, so, what should i do next
how can i write an alorithm to solve the maze

..................

en.wikipedia.org/wiki/Maze_solving_algorithm#Wall_follower

1. while (!foundSolution) { ... }
2. write the rest of the fucking algorithm

i dont know how
sorry
already was on that Wikipedia page, dont really know how to implement it
in really new to programming

gitlab.com/9898287/nixwriter

Attached: 1536410196291.png (264x274, 30K)

>Deadlang
>GTK3

Attached: 1497214889403.jpg (475x530, 47K)

the D stands for dead
lmao

have you considered asking your prof for help? or actually paying attention in class?

It's okay i'm dead inside too.

Someone mentioned ddgtk earlier. I personally made a number contributions(!) to that project too.
github.com/gort818/ddgtk/issues/5

I don't expect anyone to use my project either. I did this entirely to exercise my gtk skills.

Attached: npc1.jpg (640x382, 17K)

>Just use some ragex magik xDDDD
The state of pyjeets.

What cool shit can i host now that i have first world internet speeds in my middle of nowhere village?

Attached: Képkivágás.png (677x295, 63K)

I'm working on a python script that allows me to add a shitty social share button to 100 pages at my mind numbing front-end data entry job.

I'm using a combo of Selenium and BeautifulSoup. I've gotten to the point where I can ID the pages, get in the CMS, copy the textarea, bring it into python, and ID the image I want to paste the button directly after.

The problem lies in adding the button. Right now, I'm trying to splice the image, then add splice[0] + image + button + splice[1], but Beautifulsoup returns the image as vs , so it can't ID the image to make the splice.

I'm hoping y'all can save me - otherwise I'll try to add regrex into the mix.

Elaborate?

Could you please help me with this?
Im just learning shell scripting and what Id like to achieve in this project is to get the sourcecode of a website every hour and keep one copy.
Later on, i will compare them etc, but now, i just focus on the grabbing.
Am I doing it wrong?
Am i using the recursive the right way? Arent I creating some background processes everytime?

1 #!/bin/sh
2
3 URL=yahoo.com
4 OLD=a0
5 NEW=a1
6
7 if [ ! -e $OLD ]; then
8 wget -O $OLD $URL
9 elif [ ! -e $NEW ]; then
10 wget -O $NEW $URL
11 else
12 rm $OLD;
13 mv $NEW $OLD;
14 $0;
15 fi

How do I stop being a mathlet?
Is it even possible to git gud at math if there isn't a bit of Newton in your genes?

Why's biology so unfair!

Be like Newton. Study theology.

You don't need terminating ;s in shell scripts.
Yes, calling it recursive like that is silly, and is just eating up processes.
Write a loop, or better yet, schedule something external to run your loop (cronjob or systemd timer).

come home, white man

Attached: STL.png (1800x1273, 2.74M)

hft algorith

What does it take to build a game engine in C++?

>C++
A lobotomy.

A good understanding of C++ features (including there performance impacts), 3D manipulation (matrix), the graphic pipeline (OpenGL, use of shaders), and a ton of common optimization patterns.

What is the best way to handle multiple blocking function in C?
For example the program needs to read data from multiple sockets at the same time, and performs some actions when any package arrive to any socket and write to the log file.
If the program use non-blocking recv() function, it will consume 100% CPU time, but using multiple threads will result in a really messy mutex for the log writer function

>have to maintain a hacked together a abandoned python webserver that just copy and pastes dcfldd commands SIMPLY BECAUSE MY BOSS DOESN'T WANT TO REMEMBER DD COMM DS

fuck Trump and fuck white people holy shit

>hey just add 3 or 4 features to this piece of trash you've never read before
>oh dear why is it 3am and you didn't start on the real deadline yet user, oh well im going to bed lol

Attached: ryan-gosling-blade-runner-2049.jpg (970x545, 57K)

why don't you just rewrite it in a good language?

Hey Jow Forums, i'm learning c# because i dont know shit about object oriented languages. You guys could recommend me some nice projects to start?

the features he wants to add are utterly retarded and holy shit which language is a webserver that pastes two dcfldd commands supposed to be holy shit
maybe I'll make a gtk2.0 tool for him; he already forces me to maintain another tool be wants random bullshit changed in

probably best, just make a front-end tool for him to add as much bullshit as he wants to it.

Not sure why this made me laugh so much, but thanks.

pthreads

>What are you working on, Jow Forums?
>class is a group project course and I've essentially built the whole thing alone this whole semester
Working on the front end now because they can't even handle basic htmk/css.

Attached: 34306564_2070760463211504_5931417833698230272_n.png (299x265, 144K)

>file input and output to communicate between different applications
That's the unix way.

How to write proper middleware?
What's the best way to make the said firmware communicate between different applications?
As of now, my middleware uses file input and output to communicate between different applications.
Is this a shitty method?

My middleware literally writes shit to a file from one application, and then another application reads it.

FCS > SICP.
Prove me wrong.

FCS?

Lisp is the most powerful programming language.

Foundations of Computer Science

Fuck off back to facebook.

nigge.rs

>when you're a rust programmer with a German name and a personal website

k tard. they have not much in common.

Do you have any experience with backtracking? You obviously need to record your turns and moves so that when you get reset to the starting position you can go back to your last valid position and try a different move (this means removing the last recorded move since that resulted in you hitting the wall). If it turns out that any possible move from your last valid position results in hitting a wall then you have to go another step back, and so on. For this, you need a data structure that supports popping the last element (like a stack), but also supports iterating from the beginning to the last element without popping elements. Such a data structure would be a double ended queue (java.util.Deque). Of course, you could just as easily record your moves in an arraylist, but inserting and deleting the last element of an arraylist is costlier than doing the same with a double ended queue.
>but how do I record my moves?
Do you know what functional interfaces and generics are? If so, then you can make a Deque where R is the return type of walker and insert moves like this: moves.add(MazeWalker::move) or moves.add(MazeWalker::turn). If you don't, then you can just declare some named constants like this:
public static final int MOVE = 0;
public static final int TURN = 1;

and then insert them into a Deque like this: moves.add(MOVE). When you hit a wall, you just do moves.removeLast(), iterate over the deque from its first element to get back to the last valid position, and then do some extra turns before moving again (although you have to make sure you never turn 180 degrees after a move, which can get a little ugly, because that would make you walk backwards).
p.s. I don't think the main function should be a part of the MazeRunner class. The job of the MazeRunner class is walking the maze, not starting the program. I would put it in a separate Main class that's responsible for starting your program.

listening to Green Day in the background is actually pretty comfy

Is a design decision a stupid decision even if it makes my life easier now and in the future?
What I just did is best described as a hack, but it simplifies so much that I hesitate to replace it with a more robust solution.

Just write a comment saying "an elegant solution to deal with problem x". Nobody will ever know.

>tfw "fix" the bug by simply sweeping it under the rug

HEAR THE SOUND OF THE FALLING RAIN
COMING DOWN LIKE AN ARMAGEDDON FLAME (HEY!)
A SHAME
THE ONES WHO DIED WITHOUT A NAME
HEAR THE DOGS HOWLIN' OUT OF KEY
TO A HYMN CALLED FAITH AND MISERY (HEY!)
AND BLEED, THE COMPANY LOST THE WAR TODAY
I BEG TO DREAM AND DIFFER FROM THE HOLLOW LIES
THIS IS THE DAWNING OF THE REST OF OUR LIVES
ON HOLIDAY

Attached: 1541332169056.gif (600x540, 2.34M)

Is this Karel?

THIS IS FUCKING IT /dpt/

I'M GOING TO FUCKING DO IT

I'M GOING TO LEARN HOW TO PROGRAM

AND I'LL START BY LEARNING C

Do you have a link?

JavaScript rocks!

Attached: js-rocks.png (1000x494, 369K)

select()

What's the best second language to learn? I've been using Python but I want to learn a second language sometime soon. I've been thinking of learning either C or Haskell.

ripip

kys imbeciles
kys now

In C++ if you've got a function that doesn't need any info from the class but it's related to the class should you it have a prototype in the header or should it just be a static function in the cpp file?

If you don't need to call it from another translation unit, always give it static linkage.

And keep them out of the header?

Yeah. You only need to put something in the header if it has external linkage in the implementation file.

Neat, thanks.

How would you make a knot program? Something that'd let you tie and untie knots and tangles in a computer.

Attached: hanamusubi-japanese-traditional-knots-flower-260nw-742571530.jpg (390x280, 16K)

lol okay

Did that one guy ever implement multiboot support for templeos?

I'm trying to make some sort of cli game engine but I've run into a small problem that I can't easily search.
How do I time my code to get almost authentic 60FPS? Is there a way to delay without just stopping the program for 17ms?

>I'm trying to make some sort of cli game engine

What does that even mean?

I don't know, I tried using some buzzwords to get my point across.
It's just the graphical part of the program.

>I don't know, I tried using some buzzwords to get my point across.
>It's just the graphical part of the program.
Okay fine, but how are the graphics getting from the program onto your screen?

you want to make a realtime ncurses game?
But why?

Drive around Bosnia with the heir to the imperial throne