/dpt/ - Daily Programming Thread

thread.prev: What are you working on, Jow Forums?

Attached: maid-chan_ep01_01.jpg (1280x720, 82K)

nth for why can't there just be a perfect lang

what is brainfuck

not even the best eso lang

men are imperfect; men design programming languages; men are always trying to optimize their languages for the tasks they find interesting, and they are easily blind to costs that could have been avoided or for which the corresponding optimization is not actually worth it.
Julia is a good recent example. For its purposes it is excellent, but to make a shippable executable with it is hopeless.
befunge is at least a fun and interesting esolang. brainfuck is just "ha ha ha it says FUCK. FUCK, amirite?"

Alright, time for your final niggys. You have to brute force a string. Randomly select a character based on it's ascii value until it is equal to the character at that index of your string. Do this for each of the characters until your string is equal to the input string.

Attached: 2017-08-10 01.38.15.jpg (213x213, 13K)

do your own homework

Can anyone help me I seem to be stuck on what to do
I've taken a few classes at my college and I really enjoy problem solving and I've learned C++ fairly well
I've even won two contests at my college against about 60 people
but now I just don't know what to do or where to go from here

Do it again in C

D is prefect.

idk why people like you think questions like these are homework, it's pretty stupid.

this task is dumber-looking and more contorted than your image.
$ brute() { grep -a -m1 -o -F "$1" /dev/urandom; }
$ time brute hi
hi

real 0m0.004s
user 0m0.000s
sys 0m0.005s
$ time brute hiya
hiya

real 0m9.075s
user 0m0.477s
sys 0m8.586s

How come QT wants you to register for the open source?

Hideous, you fail.

I love D, but it's fundamentally flawed with its GC identity crisis.
It's fragmented between GC, @nogc, and betterC. And Walter doesn't really seem to care as much as I think he should.
The D community are kind of yes-men/apologists to a degree as well. And most don't really want to do anything cool, that's why D's ecosystem is pretty stagnant these days.
And andrei stepping down (for family apparently) is worrying for its future.

an exit bag

since no one is smart enough, I guess i'll post the answer, you all fail
from random import randint
from time import sleep

target_phrase = 'Hello, World!'
build_phrase = ''
i = 0
while i < len(target_phrase):
guess_letter = chr(randint(32, 126))
print(build_phrase + guess_letter + '\r', end='')
if guess_letter == target_phrase[i]:
build_phrase += guess_letter
i += 1
sleep(.005)

Attached: file.png (508x588, 14K)

:- module brute.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module string, random, int, list, char.

main(!IO) :-
random.init(666, RS),
io.command_line_arguments(Args, !IO),
( if Args = [Str] then
brute(to_char_list(Str), [], Res, RS),
io.write_string(from_char_list(Res), !IO),
io.nl(!IO)
else
io.set_exit_status(1, !IO)
).

:- pred brute(list(char), list(char), list(char), random.supply).
:- mode brute(in, in, out, mdi) is det.
brute([], !S, _) :- !:S = list.reverse(!.S).
brute(L @ [C|Rest], S0, S, !.RS) :-
random.random(0, 256, N, !RS),
( if char.from_int(N, C) then
brute(Rest, [C|S0], S, !.RS)
else
brute(L, S0, S, !.RS)
).
as used:
$ time ./brute hi
hi

real 0m0.020s
user 0m0.007s
sys 0m0.013s
$ time ./brute 'hello world'
hello world

real 0m0.017s
user 0m0.007s
sys 0m0.010s
$ time ./brute 'hello this is a really long string but this is still fast because only each char needs to be randomly found'
hello this is a really long string but this is still fast because only each char needs to be randomly found

real 0m0.021s
user 0m0.010s
sys 0m0.011s
honestly the bash is more to the spirit of how stupid this is a thing to do.

Anyone got the programming projects rolling pic?

Go away, Zoltan.

I saw that once I reached downloads but it was always a pop up to register. Thanks.

better:
:- module brute.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module string, random, int, list, char.

:- mutable(failures, int, 0, ground, [attach_to_io_state, untrailed]).

main(!IO) :-
random.init(666, RS),
io.command_line_arguments(Args, !IO),
( if Args = [Str] then
brute(to_char_list(Str), [], Res, RS),
io.write_string(from_char_list(Res), !IO),
io.nl(!IO),
get_failures(Fails, !IO),
io.format("%d failures recorded\n", [i(Fails)], !IO)
else
io.set_exit_status(1, !IO)
).

:- pred brute(list(char), list(char), list(char), random.supply).
:- mode brute(in, in, out, mdi) is det.
brute([], !S, _) :- !:S = list.reverse(!.S).
brute(L @ [C|Rest], S0, S, !.RS) :-
random.random(0, 256, N, !RS),
( if char.from_int(N, C) then
brute(Rest, [C|S0], S, !.RS)
else
trace [io(!IO)] (
get_failures(Fails, !IO),
set_failures(Fails + 1, !IO)
),
brute(L, S0, S, !.RS)
).
as used:
$ ./brute hi
hi
821 failures recorded
$ ./brute 'hi there'
hi there
2189 failures recorded
$ ./brute 'hello this is a really long string but this is still fast because only each char needs to be randomly found'
hello this is a really long string but this is still fast because only each char needs to be randomly found
29359 failures recorded
gaze upon this careful side effect in otherwise pure code, ye Haskeller, and despair.
although I'll grant that the unsafe* set of functions have some pretty funny names.

Ugly but no brackets, you pass

chr(randint(32, 126))
enjoy infinite loops on a huge range of inputs.
sleep(0.005)
what are you even doing anymore.

alph = (32..126).map(&:chr)
ARGF.each_line do |line|
str = line.chars.select { |c| alph.include?(c) }
res = Array.new(str.size) { alph.sample }
until res == str
res = res.zip(str).map { |x, y| x == y ? x : alph.sample }
print "\r" + res.join
sleep 0.1
end
print "\n"
end

Attached: 1549660871680.jpg (625x625, 54K)

it's just so you can see whats going on in terminal.

> :-

Attached: download.png (291x173, 6K)

(defn brute [string]
(map
#(loop [c nil]
(if (= % c)
c
(recur (char (rand-int 256)))))
string))

how'd i do

Too many parenthesis, you fail

string answer
string guess
while guess != answer
guess = answer
return

>always testing chars against nil the first time
>because you didn't want to repeat yourself with the (char (rand-int))
sir without any intent to impugn your character, I must inform you that you appear to be using Clojure.

actually it's because i'm a retard

(defn brute [string]
(map
#(loop []
(if (= % (char (rand-int 256)))
c
(recur)))
string))

sort of sucks you're an actual shill who's ruined mercury for me.

Is QT even worth it worth the opensource version?

>someone else posts code in a language
>yuck. one less language for me to enjoy.
very believable story.

I'm currently working through The Art of Unit Testing book, because school doesn't teach it. Wish they did (together with debugging - at least I already know how to do that)

how tied is the book to C# and OOP?

it’s a very big frameworky set of libraries that can do pretty much everything and then some with well written documentation and a ton of examples whose code you can ape pretty easily
Personally I don’t like some of the idioms they use, but it’s not like there’s anything in the way of alternatives.

But from my understatement I must make everything I use it with open source?

C# not that much. You can easily use the knowledge for Java or C++ (though I'm not sure how you'd use [Attributes] in C++) . It is pretty much connected to OOP though. For Functional Programming take a look at QuickCheck (Property-based Testing) and it's derivatives.

considering making an rpg type of game
i have a main plot, but also side activities for grinding money and what not
also a main character, and a setting
and secondary characters

so i just need to write a screenplay then i'll program around it

Waste of time, don't do it.

nothing else to do at this point
all tasks are either far too simple or far too complicated, and generally everything's already been done 10000 times

might as well go creative

good lad
games are fun.
don't let /dpt/ drag you into their blackhole of leetcode and hackerrank hell.

Are you guys excited for C++58?
auto 0 =: 1
auto n = r _ : *[r] n auto - n 1

>_main =: _il auto 5

In C++61 this is just:
auto main = dev("/dev/brain").interpret_program_idea();

in C++74, auto, int, char, etc cease to exist

predict main = dev("/dev/brain") => think;

well, yea
if you would rather loose out on a fuckhuge library than release your source code, there's other smaller libs like wxWidgets that don't require that

This is a common misconception. You do not have to make your program open source. This is the main purpose of [Lesser] General Public License. It means that you can detach the library from your program, and are not required to open source it. The requirement is that you have to link against the library /dynamically/ (so that you ship it with .dll/.so files - so that a third party can patch the library and drop in a replacement to keep your software running) and that you do not modify the library you use (if you modify the source of the library you use, you are obliged to release the patches/changes you made to the library, not what your software does with it).

Thank god they made another C++74.
I couldn't stand programming in the first one.
GET "LIBHDR"

LET START() = VALOF $(
FOR I = 1 TO 5 DO
WRITEF("%N! = %I4*N", I, FACT(I))
RESULTIS 0
$)

AND FACT(N) = N = 0 -> 1, N * FACT(N - 1)

I want to do programming projects for fun but I have to prioritize other things first. So hopefully I get through those things quickly.

If I've made a truly tiny change to an open source project should I bother making a pull request or just make an issue saying "hey you could fix this like this"? We're talking a diff of literally two lines.

I mean go ahead, it's not like it takes a lot of time to submit a patch and you're more likely to get a change in when you submit the change than if you tell retard maintainers their shit is broken.

I see huge projects accept PR's that only correct minor grammar and typos in the docs.

Why does /dpt/ always die around this time, is this when the bot servers get shut down?

It's late night in the EU and late evening in the US.

/dpt/ is filled with wagies

What programming language’s community has the boys with the cutest, smelliest feet?

Attached: 7D88A5A1-64AE-4F6A-B27C-3FB6C5EC24D1.gif (450x799, 2.89M)

haskell

i just learnt c++ and suddenly my cock grows bigger???

post it on imgur :)

Rust

oh no! how dare people have day jobs that they enjoy doing!

i wasn't even shitting on you, but now i am you insecure faggots.

>C++ gave you an erection
what the fuck is wrong with you

The only person insecure are those crying about people having jobs.

you're the one having a meltdown simply because i pointed out /dpt/ has a lot of 9-5ers
wwwwwwwwwwwwwwwwwwwwwwwwww

every page of the standard my penis grows 1 inch longer
im on page 30 now and its already noticeable!

There was a girl who went around the entire Linux Kernel putting `const` in front of everything and has like 200 some commits now in the live kernel.

unsurprising a wannabenip is the wagie poster.

Working on an old timer cli mail-like program that hooks into Jow Forums and displays threads and posts int he correct text format as if we were back in the 80s while also featuring things like auto refresh and what not.

What do you think of my new language?

loop "isgt \{a\} 10" "setv a ""\"\(oper add \{a\} 1\)\""

This adds 1 to the variable named "a" until it reaches 10.
I tested it and it works.

>strings are code
instant hate.
consider Tcl.

awful

disgusting

fucking stupid

How will you handle images?

pretty gross senpai

Attached: o.png (802x554, 61K)

>images
I have no intentions to handle images. I find them disgusting and most are avatarfags that contribute nothing.

It's an imageboard. You lose a lot by skipping images.

yeah imagine all those pepes and wojaks and smug anime girls you'll be missing out on

I'd beg to differ for the exact reason i listed already.

can ASSIMP be parallelized?

How do I find a good project to contribute to from GNU? I am a professional C++ programmer who is probably autistic, and is detail, performance, and safety oriented.

Stop being a CShill, use a language thats actually going to advance your career like golang or python.

>professional C++ programmer
no such thing, you're a hobbyist who's tricked someone into employing him

What do you mean? This year I will be making almost $200k, will python or golang get me more? They are slow trash ugly languages in my mind

Why do you say I'm a hobbyist? There is lots of important software written in C++, like any time you need low latency serving

He's probably a java dev who somehow managed to jump on a high horse because his garbage language has ample job openings.

python and golang will easily get you 400k

C++

Attached: eDQvTAB.jpg (1080x1331, 97K)

What lang should I use?

Attached: B160688C-381E-4C20-AE68-D2D4CBC688B2.jpg (857x1218, 282K)

C(had)++

Based. I like modern C++.
Is there any beginner Web tutorial? And what's the to-go Web framework of C++? I tried using actix but Rust is too much of a time sink for me.

Attached: 513F2B36-6DE0-4023-B2C3-8B875DB8FA23.jpg (1353x2601, 736K)

no
x86 assembly

Kill yourself, degenerate.

Jesus fucking Christ, how many degenerates are here. The most degenerative thread on Earth.

Can someone teach a systems dev (me) how to start web programming? Are there any web languages that aren't absolute garbage full of legacy cludges and a lack of type safety etc? Is there any clean web language that you can just start up and it works well? For someone from a C++ background

Wrong thread?

bite the bullet, learn JS, learn CSS, make stuff.
Elm and ReasonML. Nim. A few others.