/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: WEF.jpg (960x704, 109K)

Other urls found in this thread:

lmgtfy.com/?s=d&q=java remote code execution
istherejava0day.com/
java-0day.com/
twitter.com/AnonBabble

JavaScript rocks!

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

C/C++ are exploitable and every garbage collected language cannot be used for systems programming.

>c/c++
Why are you lumping two entirely different languages together?

What programming language is "not exploitable"?
because she doesn't know what she's talking about

rust

Because they have the same problem.

>C strings are garbage. They do not permit string views,
const char *

Why on earth would you think that Rust is somehow non-exploitable?

>entirely different

Attached: yikes.gif (500x264, 383K)

What the fuck is that image and why did you use it as a /dpt/?

dining philosophers obviously, are you blind?

Something like std::span would be better, a way to give a view of a substring

It doesn't allow buffer overflow for example.

struct view {
const char *start;
size_t end;
};

That's blatantly false
Now I just need a way to pass this to all functions that take strings.

>Now I just need a way to pass this to all functions that take strings.
n_variant_of_desired_function(..., my_view.start, my_view.end, ...);

Nice

from random import randint
optio = ["rock", "paper", "sizer"]

def rando(optio):
rand = randint(0,2)
player = input("choose between rock, paper, sizer: ")
if player not in optio:
print "no no no CUNT! play by the RULZE!!!!"
return rando(optio)
for o in range(len(optio)):
print "player: "+player
print "pc: "+optio[rand]
if(optio[o] == optio[rand] and player == optio[o]):
print "its a tie try again"
return rando(optio)
elif(player == "rock" and optio[o] == "sizer" or player == "paper" and optio[o] == "rock" or player == "sizer" and optio[o] == "paper"):
print player + " beat " + optio[o] + " you win fag"
break
else:
print "you loose fag next time"
break

rando(optio)

>PROGRAMMING thread
>heads of some of the greatest SOFTWARE companies of the world dining
>DuRr ThAt PiC iS uNrElAtEd

erlang

gay

err-lang?

error-lang

It sucks, use an anime image next time.

Attached: 1546126990820.gif (400x480, 124K)

Was not expecting to see bolsonaro in this board today.

Rust is truly the best language for compiler warning oriented programming, it's like the compiler is writing the code for me and I don't have to think, it just doesn't work until it does. I will probably not go back to C++ unless I need to write a GUI. Clang and GCC and Valgrind & cie are weak and dumb. Rustc hold me tight and fuck me silly until everything fit properly in my soft programmer bum. Damn, were are my programming socks and my buttplug, I love to feel girl when I program. Who's girly Rust here? Thee-ee don't hit on me silly homos.

i made 2 machine learning to talk to each other what do you got cunt? can u do dis?
>no
so stop shitposting and go back to your local machine!

Attached: Screenshot from 2019-01-25 21-41-34.png (1920x1080, 582K)

Kafka tier.

>so stop shitposting and go back to your local machine!
but I'm already at my local machine

Attached: what.png (1280x720, 583K)

Nor Ueli Maurer. This is odd.

>compiling boost
>1.5 hours in
What the fuck is wrong with these people? And what kind of absolute moron puts this bullshit on a critical path to running your software?
I wish everyone involved in what I'm trying to install would never have been born so I could justify choosing something else or writing it myself.

Literally who.

What you doin that for? Gentoo?

_print = lambda s : self._print('[STATUS] {}'.format(s))

Am I a bad man?

oh wow I love tim cook now, maybe there is still hope for applel

Attached: balsonaro cook.jpg (960x704, 176K)

>Am I a bad man?
Depends on if write that shit on purpose or you're just retarded.

Attached: 1544624254455.png (512x512, 80K)

University fucked me over and couldn’t get my class, does any know of any good resources to learn c/c++ myself?

if your here you your not in your local machine

I'm too high, I don't know anymore.
I thought it would be a neat little helper for my private print() method.

that seems acceptable. You could call them "log" instead of "_print" tho. Also if you want to prove your highness, make it in such a way that you don't resolve "_print" on every call.

>I'm too high, I don't know anymore.
That's probably where you should stop programming and go do something else until you sober up.

>What are you working on, Jow Forums?
still working on my fizzbuzz. It's getting prettier by the minute

Attached: IMG_6394.jpg (3000x2000, 346K)

But I'm having fun. Also I'm still trying to figure out

I got ya bro, fun things are fun.

Attached: 1547343221111.jpg (550x550, 36K)

I'll repeat again. C strings are garbage. They do not permit string views.
Your post tells me you don't actually know what a string view is or what a const char* is.

I just realised violates PEP8 for "reckless misuse of lambdas".. Now I'm paranoid that I use too many lambdas at work, I don't want to be that guy :(

Not that guy. What does string view offer?

Ok how about
def _print(s): return self._print('[STATUS] {}'.format(s))

maybe but who cares. Python's lambdas are tarded anyway. Check with pylint and if it spergs out change them to a def and you'll be safe.

Who cares, Python is already a slow garbage lang, just do whatever

Maybe you can dump the "return" if _print returns None like print dopes.

How do I make HTML JavaScript call a Python script and return the output?

Attached: yEi96RfJWYfD9yjEn4_eaZdNfrMoJOLhZvLEvhIdYvs.jpg (422x309, 25K)

That's fine man, just try again in 10 minutes.

Attached: 1547282495684.png (486x562, 224K)

>I don't want to be that guy :(
If you use python at work consider if your coworkers opinions are worth respecting.

I don't use Python at work (much), I'm mostly talking about the JS I work on with other people.

great programming work

pass a substring to a function without allocating any additional memory, similar to C++'s span type
>HTML JavaScript call a Python script
Do you want to call Python code server-side or client-side?

>not opening your brain via paranoia tactics using marijuana

you'll never have a security hole again if you smoke weed and program

Client side. I'm using localhost.

>Your post tells me you don't actually know what a string view is or what a const char* is.
You're right, I don't know what a string view is. I only looked it up. I don't fully understand, but what I read suggested a string view is a way to access substrings without copying from or mutating the original string.
If there's more to a string view than that, feel free to enlighten me, but if that's all they are, const char * does the same thing. Or rather -- if you'd read the rest of the conversation -- struct {const char *start; size_t end;}.

JavaScript in the web browser can't run Python.

>pass a substring to a function without allocating any additional memory
I see why you objected. You would have to allocate the size somewhere like on the stack.
That's a very rough environment you work in though. Pretty amazing how a string view manages to avoid that.

S̶i̶m̶p̶l̶e̶s̶t̶ ̶(̶r̶e̶a̶d̶:̶ ̶p̶r̶o̶b̶a̶b̶l̶y̶ ̶t̶h̶e̶ ̶r̶i̶g̶h̶t̶ ̶w̶a̶y̶)̶:̶ ̶h̶t̶t̶p̶s̶:̶/̶/̶u̶w̶s̶g̶i̶-̶d̶o̶c̶s̶.̶r̶e̶a̶d̶t̶h̶e̶d̶o̶c̶s̶.̶i̶o̶/̶e̶n̶/̶l̶a̶t̶e̶s̶t̶/

S̶i̶m̶p̶l̶e̶s̶t̶ ̶(̶r̶e̶a̶d̶:̶ ̶t̶h̶e̶ ̶q̶u̶i̶c̶k̶e̶s̶t̶ ̶a̶n̶d̶ ̶l̶e̶a̶s̶t̶ ̶p̶a̶i̶n̶f̶u̶l̶)̶:̶ ̶h̶t̶t̶p̶:̶/̶/̶f̶l̶a̶s̶k̶.̶p̶o̶c̶o̶o̶.̶o̶r̶g̶/̶

Oh , never mind.

>What programming language is "not exploitable"?
Java

I'm not that guy, I'm just explaining the idea
Obviously there's likely memory being used because somewhere you're passing data somehow. The idea would be that a string doesn't know/care where it's allocated, and something like the struct discussed elsewhere in the thread (with a start pointer and an end pointer) could be passed to functions.
This is not unlike how iterators in C++ containers work.

I like the way you think
def _print(s): self._print('[STATUS] {}'.format(s))

Which is why there exist no remote code execution vulns against any Java application whatsoever.

lmgtfy.com/?s=d&q=java remote code execution

That's strange.
istherejava0day.com/
And
java-0day.com/
Aren't active anymore.
It's pretty odd. They weren't exactly expensive pages to run because they didn't need to update. Maybe they were bought out.

And the wording? Isn't log shorter and more explicit?

Also in Python 3 (or Python 2.7 with a __future__) you can override print.

mfw

Attached: Karen188.jpg (1280x720, 78K)

I'm tempted to switch to log.. as for the underscores I'm using that to indicate private functions.

If I liked Effective Java will I like Effective C++ too, or are they completely unrelated?

How do I watch a youtube video in either swing or tkinter?

because java exploits its users, not the other way around

>118 Karen shitposting images
must be hard being british.

e.g.
def _kill(self):
'''Aggressively stop the server process (tries to be polite, initially sending SIGHUP and SIGINT)'''
self.process.terminate(force = True)

Lisp is the most powerful programming language.

>I'm using that to indicate private functions.
Oh never mind. nevertheless, you don't need one for the lambda/internal function thing do you?

def log(s): self._log('[STATUS] {}'.format(s)) # Why won't you love me, user?

Do you have Karen1488.jpg?

I hope you realize the guy in the bottom right is Satya Nadella.

thanks
thats also me

>don't need one for the lambda/internal function
Hmm I guess not

>flirting
:3

what anime are all these girls from?

Attached: 1451331316397.gif (600x338, 149K)

I used this command and my JavaScript still can't call my php script. What did I do wrong? How do I get my website to acknowledge the php server I started?
php -S localhost:8000

> php server
just use mod_php like a normal person

>What did I do wrong?
Probably a lot of things but go ask your dumb ass question

Do I do this???
mod_php -S localhost:8000

Follow the AJAX path from the start to finish and see where it breaks.

Does a request appear in the Network tab in the developer tools of your browser? Does it go to localhost:8000? Does the php server see anything at all? How does it route the request?

No, you use Apache server like a normal person

An actual length

It launches the request but gives me this error
>Failed to load file:///test.php?foo=bar: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https

>Apache
Did they just defrost you?

You will never boomerpost this hard.

Attached: 1525388794348.png (380x349, 77K)

Nobody uses Apache these days, grandpa. Everybody uses nginx.

>const char * does the same thing
No, because const char* doesn't contain a length. And C abstractions are too garbage to make using struct {const char *start; size_t end;} convenient enough to use.

Reminder that in programming disputes, the one that actually posts code automatically wins.

I wrote some more nigger code this time a perimeter calculator but I made two iterations of it which one do you like more

#include

int main(){
char inp_height[100];
char inp_width[100];
int height;
int width;
int perimeter;

printf("Enter height value: ");
fgets(inp_height, sizeof(inp_height), stdin);
sscanf(inp_height, "%d", &height);

printf("Enter width value: ");
fgets(inp_width, sizeof(inp_width), stdin);
sscanf(inp_width, "%d", &width);

perimeter=2*(height+width);
printf("Your perimeter is %d", perimeter);

return 0;
}

and

#include

int main(){
char input[100];
int height;
int width;
int perimeter;

printf("Enter height and width: ");
fgets(input, sizeof(input), stdin);
sscanf(input, "%d %d", &height, &width);

perimeter=2*(height+width);
printf("Your perimeter is %d", perimeter);

return 0;
}

Ada is life.

Attached: 1547875971957.jpg (1052x1342, 402K)

well duh.