/dpt/ - Daily Programming Thread

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

Attached: 1558965297424.jpg (800x880, 236K)

Other urls found in this thread:

youtube.com/watch?v=fxk1syuf5lo
docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2019
en.wikipedia.org/wiki/List_of_Lisp-family_programming_languages
repl.it/repls/FocusedGiganticKeyboardmapping
reddit.com/r/webdev/comments/8kq21d/new_to_web_development_is_it_normal_to_have_so/
twitter.com/SFWRedditImages

enterprise java

Anime girls and C#

so what's the consensus? dork or no?

How do I get this function to return the value?

(defn random-between
"Out put a random number between -theta and +theta"
[]
(let [theta 1.83948]
(- (* rand 2 theta) (theta))))


If I move the actual calculation at the end of the function then the variable theta isn't available.

let me go back to Haskell please
error[E0599]: no method named `send_all` found for type `futures::stream::map::Map` in the current scope
--> src/main.rs:17:28
|
17 | stream.send_all(sink)
| ^^^^^^^^
|
= note: the method `send_all` exists but the following trait bounds were not satisfied:
`&mut futures::stream::map::Map : futures::sink::Sink`
`futures::stream::map::Map : futures::sink::Sink`

FUCK anime girls (metaphorically)

that is the error when the sink/stream are switched:
use tokio::prelude::*;
use tokio::net::TcpListener;
use tokio::codec::{Decoder,LinesCodec};

fn main() {
let addr = "127.0.0.1:3000".parse().expect("err parse addr");
let listener = TcpListener::bind(&addr).expect("err bind listener");
let future = listener
.incoming()
.for_each(|socket| {
let lines_codec = LinesCodec::new();
let (sink, stream) = lines_codec.framed(socket).split();
sink
.send(String::from("Echo server"))
.and_then(|sink| {
let stream =stream.map(|x| format!("ECHO: {}", x));
sink.send_all(stream)
.map(|_| println!("Connection closed"))
})
})
.map_err(|e| eprintln!("Error: {:?}", e));

tokio::run(future)
}

>rand
>(theta)
I think you got those mixed up, you're calling a variable and not calling your function.

That's a nice looking JavaScript project, user. I like it!

Attached: 0908951c907feb0841d19693840c910e.jpg (682x1024, 53K)

Is CLANG pronounced klang or see-lang?

let evaluates to the last expression in the body. Your only issues is what the other user said.

klang.

clang

klang like the sound of metal (which is also why the logo is a metal dragon).

>futures::stream::map::Map

Thanks, user. It was tough but the end result makes it absolutely worth it!

Attached: 1561385629726.png (1009x3612, 467K)

Beautiful huh

Youmu is cute! CUTE!

any applications of SIMD which go beyond simple vectorization rely heavily on bit manipulation

Those errors are vomit inducing.
Jon Schlinkert is unironically not at fault. He was just some rando uploading his learning exercises and some other retards decided to pull this shit in.

So pure

is a degree worth it?
idc about easier job hunting, rather Ijust want to leave europe and I heard a degree helps with visa applications. Is that really true though? What if I can find a job before applying for visa?

What's your destination?

t. jon schlinkert

Are you talking about the US?
Finding a job means absolutely jack shit. You need to find a company willing to sponsor a visa and the application has to be accepted. The company has to show that they couldn't find somebody as qualified as you locally, so having a degree helps, but if you have some other significant qualifications that's fine too.

What's CLANG? is it like clang?

okay I see

US or southeast asia

Another way to leave Europe is to marry an American. If you have an accent, that can help.

Terminology in COMPUTER SCIENCE is written in all caps

virgin clang
Chad CLANG

youtube.com/watch?v=fxk1syuf5lo

>mut
It's an American language, right?

sepples approved and boost pilled

I'm writing shellcode to inject into a victim process in order to bypass anti-cheats. x64 assembly cool, but does anyone know why when I call malloc (cdecl) it screws up the stack? do I nee a sub rsp or something

forgot pic

Attached: x64.png (269x176, 5K)

there is only one call convention on x64 architecture: docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2019

im going through the learnopengl tutorials and this is my project structure
can someone help me configure a cmake file for this shit
there's just so much to learn and I don't want to waste more time with retarded C++ and cmake shit

Attached: Annotation 2019-06-24 115133.png (230x340, 9K)

I know that, I push malloc arg into ecx, but for some reason when the function returns (malloc) stuff I had pushed on to the stack is no longer returned (it's corrupted) when I pop back off the stack. I don't understand why

>I don't want to waste more time with retarded C++ and cmake shit
I'm not shilling Rust or anything but you should consider using it.

Redpill me on lenses. To me it just seems like a complicated fix for Haskell's shit record syntax. What does it offer that couldn't just be fixed with a pragma/a language with better syntax?

OpenTK

lenses are first class values that can be used as getters and setters. they work well with other optics. lenses + type classes = type safe generic fields
lenses are good use lenses

disassemble a primitive program and take a look.

Attached: Capture.jpg (1372x688, 80K)

>they work well with other optics. lenses + type classes = type safe generic fields
what does that mean? I'd be fine with a write up or something, but everything I've found so far either only covers the getter/setter part (which really isn't all that amazing imo) or was filmed with a potato containing completely illegible slides and sound quality on the level of a tin can telephone.

No, it isn't.

This meme needs to die

>2019
>having name space problems
haskell a shit

>msvc
fuck off

how do I know how much space I should allocate on the stack? cheers m8

>was filmed with a potato containing completely illegible slides and sound quality on the level of a tin can telephone.
you're referring to kmett's talks?

they're not really a fix, but they certainly are used like that.

futures::stream::map::Map<
futures::stream::split::SplitStream< tokio_io::_tokio_codec::framed::Framed< tokio_tcp::stream::TcpStream,
tokio_codec::lines_codec::LinesCodec
>
>

futures::stream::map::Map<
futures::stream::split::SplitStream<
tokio_io::_tokio_codec::framed::Framed<
tokio_tcp::stream::TcpStream,
tokio_codec::lines_codec::LinesCodec
>
>

other languages
>getters/setters not first class
>generic field access rarely well typed
>if concepts of other optics exist they are rarely related
there are 3 talks i know of, 2 ekmett talks and 1 spj talk
other optics:
Getter is a function, Fold is like an iterator, Traversal is like a mutable iterator. Prism is like a pattern (you can match it or inject with it), Iso is an isomorphism. Most of them work pretty sensibly as others (lenses are traversals, traversal is a fold and setter, iso is pretty much everything, etc)
So with lenses, in something like a^.x.y, x.y itself is a first class value with a type, and formed by combining two other things. You can refer to x.y itself, and write pointfree code like (x.y %~ (+) 5).
With classy optics I mean like this
-- i might have messed up the fundeps after |, this is from memory
class HasX s t a b | s b -> t, t a -> s, s -> a, t -> b where
x :: Lens s t a b
-- the abstract field x is well typed, (forall s t a b . HasX s t a b => Lens s t a b)

Lenses and optics are really useful even without records

>futures::stream::map::Map
>futures::stream::split::SplitStream
This is even worse than C++'s std:: everywhere.

This works

(let [theta 1.83948] (- (* (rand) 2 theta) theta))

But when I wrap it in a function

(defn random-between
"Out put a random number between -theta and +theta"
[]
(let [theta 1.83948]
(- (* (rand) 2 theta) theta)))


Calling random-between gives me nil.

>[]
Quick reminder that Clojure is not a Lisp

en.wikipedia.org/wiki/List_of_Lisp-family_programming_languages

>be uni student retaking intro class because transfer student
>project was assigned a week ago, most people started on Friday according to the group chat
>they are taking 3 days to do it
>I finished it in like 4 hours in between me talking to prostitutes and arranging a meeting with one

Should I help the brainlets? It's due tommorow

consider the pros and cons of helping

and stay away from whores

why do loads of techie retards love prozzies

this. have sex, incels

Attached: akarin.gif (500x280, 711K)

>whores
consider kys

>goes to summer school
>calls others retards
I bet you kiss those prostitutes too

(random-between)

pros:
>feeds my ego
>helping people

cons:
>takes some effort

Why not? I wrap it up and it helps my sexual frustration from being an autist who can't get a real gf.

Transferred from a different uni, have to retake some classes in the summer so I'm back on track.

works for me
repl.it/repls/FocusedGiganticKeyboardmapping

i agree with you agreeing with me
chances are that if you're built skinny, you can build muscle quite well (and have great definition). get on Jow Forums

lisp is unreadable trash
homoiconicity is great, but it's still a bad programming language as a result
in fact i cant think of any other advantage it has over more widespread languages

pros:
make some friends

cons:
they might ask for more help later

Wait, it's 2019 (almost 2020) and you're NOT making your apps in Java? LOL

you get used to it

Macros are unironically worth it. Haskell not having good macros completely kills the language for me.
Would never use it when I have to work with others though

S C U M

Attached: s.png (1360x768, 132K)

who?

macros are worth it for sure but nowadays you have to argue why not to use one of the new infix languages with macros

some moron with an npm package addiction

reddit.com/r/webdev/comments/8kq21d/new_to_web_development_is_it_normal_to_have_so/

>isOdd
>isNumber

Attached: 1542786010102.png (625x682, 125K)

Such as? I don't know of any other language with macros that comes even close to lisp.

Julia, Rust, Nim, Elixir. I don't know how well their systems work. I've only used macros in Clojure.

>be 23
>dropped out of college after 2 semesters because I was a total dumbfuck lazyass at 18-19
>tired of working dead-end jobs
>figure I could teach myself coding
>don't know shit about computers yet
>the internet seems to like Python, I guess I'll learn Python first
>got a bunch of several-hour-long Youtube Python tutorials pulled up
>Python installed
>Pycharm installed
>I'm dedicating at least 4-6 hours a day to learning this while I have nothing else to do with my life but play video games and be useless
>goddamn it I'm going to become a computer wizard and get a decent job if it kills me

Wish me luck, anons. This board is nothing but magical alien runes and wild magic to me right now, but hopefully I'll begin to blend in soon enough.

>This board is nothing but magical alien runes
but the plt/redex niggers and agda wheenies don't post on this board

I'm rooting for you, user!

npm is just retarded. the creator is a tranny too.

>Pycharm
imagine installing bloat.class just to write an interpreted language

Attached: smokey.jpg (338x450, 134K)

what's the problem?

Follow my advice, teach your self programming until you feel confident, then do a short career in programming with official degree.

>being odd without being a number

Look up the salary employers in your area are offering for different languages and go from there, or the number of search results for a certain language. Don't just jump in to python.

You can be odd and not a number at the same time

They are trivial functions why would you need a library for them?

self documented code and high order programming.

Attached: 1408310349282.jpg (798x450, 48K)

Average salary in my area seems to be 90k/year for a Python developer. It's below the national average, but I'm not going to complain about that. It's a good starting point at least, right?

On Windows: at least 32 bytes as 'shadow space' for 4 registers and stack must be 16 byte aligned at the point of the call (which means 16n+8 when you enter a function because of pushed return address)

I fucking love the cosmos/space/planets/black holes/stars/quantum mechanics/time etc. and shit like this and i would like to create some programming involvintg space + ..well programming so something to calculate most likely, problem is i dont know where to start and not in terms of programming but in terms of what actually can i calculate. Anyone have any materials/tips/ideas?

Attached: 421214142.jpg (835x557, 96K)

I can look at a project and have a vague understanding of what's going on, but I couldn't program it all myself. Anyone else have this problem?

Attached: 1542092244130.jpg (1000x800, 57K)

>any tips
stay off the onions

Simulate how a blackhole causes a gravity lens effect

Im learning c++