/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

strawpoll.me/10614983
github.com/zaphoyd/websocketpp)
github.com/zaphoyd/websocketpp/blob/master/examples/utility_client/utility_client.cpp),
groups.google.com/forum/#!topic/websocketpp/SimAUzwZUVM),
wiki.python.org/moin/Asking for Help/How do you protect Python source code?
amazon.com/Expert-Programming-Peter-van-Linden/dp/0131774298/
c-faq.com/
literateprogramming.com/ctraps.pdf
rmbconsulting.us/a-c-test-the-0x10-best-questions-for-would-be-embedded-programmers
tutorialspoint.com/cprogramming/cprogramming_interview_questions.htm
c-faq.com/decl/spiral.anderson.html
twitter.com/NSFWRedditVideo

Thank you for using an anime image.

Why do people still use OOP?

Where is VPS guy?

Because it's easy.

no, it's not
its an abstraction layer, it's no worse than a framework and just makes your program even more complicated than it should be, if you find defining 500 methods just to set a variable to 1 "easy" then you're fucked lad

>Why do people still use OOP?

It works decently for a lot of problems. Obviously, it's flawed, but it helps get work done.

It's a layer of abstraction on top of a hundred layers of obfuscation.

Abstract doesn't mean more complex. It just means different.

Same reason they use functions.
Same reason they don't write code in assembly, or a hex editor, or a magnetized needle and a steady hand.

Let's try something new.
I made an anonymous push git repo!
No authentication needed for push or cloning!

git clone git://45.32.87.203/dpt-repo.git

>Want to write a tiny (elf header and a handful of bytes) forkbomb
How do I test this without crashing my laptop every few attempts?

>Re(2016 + 2 - 3 + 1 + i)
>not using a functional paradigm
What's wrong with you, Sup Forums?

that's not how computers work in the real world, weeb

Computers don't work

c++17 sure looks nice.

if (init; condition) {}
switch (init; condition) {}

std::pair x(1, ":^)");
std::tuple y('a', 9, x);
// templated classes now work similar to templated functions so no more pair x(), auto y = make_tuple(...), etc

auto &[a,b,c] = y;
// nicely unpacks tuples/structs/etc

>functional
>expects it to work
that's why you're retarded

What the fuck is a class? What the fuck is an object even supposed to be? What's wrong with just using structs?

still no concepts

that's a class

How do I get good at C? I'm looking to get into embedded systems, so I feel like I should somewhat "master" the language. However I feel that solving your standard programming exercises in C is more tedious than it is educational.

[butthurt intensifies]

Right a datastructure in C.
Then beat it's performance in assembler.
The best way to master anything is to work out how it works underneath.

I will do haskell stuff when there will be 1k core processors for concurency, good ram to keep up with immutable state shit and what not.

Well, I finally got my menus finished after a trip to the bathroom and some Spaghetti O's

I also started on the fake conversation panel. It changes every time I click my waifu.

Gonna need to figure out a good randomization technique and lots of lewd shit she can say to me.

Also gonna have to set some thresholds for an image changer, so I can turn her into a hentai game... But I'm gonna have to pick some decent images. I'm not sure I currently have what I'll need.

Also, need to decide how I'm gonna handle the middle panel. I kinda wanna AJAX load some pages into it when I click links from the navigation menu.

Also considering the hentai game being /activated/ after a certain number of actions, and then it overlays onto the page. Now sure what I wanna do with the game yet, though, exactly. I'll need to sleep on it probably...
I'm also gonna have to really make a choice regarding how I'm gonna use that middle panel... Maybe that can be the game? IDK.

4 hours for Spaghetti O's? Man, that must suck.

anyone have any experience with free image. I cant tell if its converting things to bgra by default or if thats just how the image is formated.

no, dude, I worked on it some more after I left, then I took a crap.

I also have OCD, so when I'm done on the toilet, I'll wash up for like 40 minutes.

THEN I got back to working on this.

So, say around 30 mins before bathroom ,1½ in bathroom, then around 45 minutes of eating and stuff, and another half hour coding some more. Also, chatted with a friend briefly and goofed around on a few DNews YouTube vids

well some of its already usable

#ifdef CONCEPTS
template concept bool foo = requires (T x){ x*x; };
#else
template
#endif
foo mul(foo a, foo b) { return a*b; };

int main() {
mul(1,2);
mul("test", "no");
}


g++ test.cc

test.cc: In instantiation of ‘foo mul(foo, foo) [with foo = const char*]’:
test.cc:11:18: required from here
test.cc:7:33: error: invalid operands of types ‘const char*’ and ‘const char*’ to binary ‘operator*’
foo mul(foo a, foo b) { return a*b; };
~^~


g++ test.cc -std=c++1z -DCONCEPTS -fconcepts

test.cc: In function ‘int main()’:
test.cc:11:18: error: cannot call function ‘auto mul(auto:1, auto:1) [with auto:1 = const char*]’
mul("test", "no");
^
test.cc:7:5: note: constraints not satisfied
foo mul(foo a, foo b) { return a*b; };
^~~
test.cc:7:5: note: concept ‘foo’ was not satisfied

well that sounds debilitating.

you betcher ass it is.

But as a programmer, I will be able to live my life indoors and mostly away from people.

30th for null references need to be a thing in C++ (rather than undefined behavior).

They're called pointers, faggot

I said C++, not C.

>doesn't know C++ has pointers
ask me how I know you're a webshit

>Why do people still use OOP?
You don't have to go over the top to use it like java forces you, it's very helpful when it would benefit the client greatly to have a simplified interface that is class specific.

Consider the pthreads api for C, you declare structs for the pthread itself, mutexes, semaphores, etc. The information for the structs is hidden using some clever compilation tricks so that the client doesn't access the data directly. Classes in OOP languages can instead encapsulate that data.

To start, you first use an interface to initalize the values, usually called pthread_[struct type]_init(bunch of variables or other structs) and then when you're finished using them you have to call pthread_[struct type]_destroy(struct). It's simple but constructors/destructors from OOP are great at managing that.

In addition, calling these seemingly independent functions from pthreads.h like pthread_join, pthread_create, pthread_cancel, etc. are much more simpler to utilize when they are called on the pthread_t you are manipulating rather than passing the pthread_t around.

And resource management when working with pointers is made so much nicer using OOP constructs.

That's just my opinion on why OOP is useful even if there's ugly shit like abstractMethodExceptionCatcherFactoryInterface and stuff.

C pointers aren't the C++ way to do things.

Lets have a programming collab

>I'm retarded

go ahead, just ask

C pointers are less flexible.

>null reference
thats what pointers are for. also the new optional type.

they are if you use them correctly.

come on, ask

How?

>he's a softwareonly babby

Java is the best programming language. It is well defined and it has so many libraries and support everywhere. Nothing can beat it. Pro tip you can't prove me wrong

strawpoll.me/10614983
strawpoll.me/10614983
strawpoll.me/10614983

dw, that was stupid.

>You can either be a NEET or a normie.
Fuck off.

Exactly what about us Entrepreneurs

Sanefag degenerate weaboo pedophile

Yeah anime is for people who are sane.

you're normies lad

I got a more memorable url!

git clone git://tempgit.mooo.com/dpt-repo
You can still include the .git part if you want.

>tempgit.mooo.com
Neat! Also, I thought of a project.

Nice

Fuck off normie. Go have sex with your girlfriend you fucking NORP.

ulimits? VM? Docker?

And if you guys want to talk, run the script in the git repo.

What is the point of Docker? The while premise seems like complete overkill, designed for retards who can't set up systems correctly

Scala can do everything Java can do and more

I want to do something very simple.

Using batch script or python, how can I print the names of the currently selected folders from Windows Explorer?

a c++ program that connects to websockets. I need help. I am using this library (github.com/zaphoyd/websocketpp) to connect to the websockets, but it only works with unencrypted websockets (ws://) instead of encrypted websockets (wss://). I am basing my project off of this example (github.com/zaphoyd/websocketpp/blob/master/examples/utility_client/utility_client.cpp), and cannot get the tls_handler to fucking work. I've followed what this fag said here (groups.google.com/forum/#!topic/websocketpp/SimAUzwZUVM), and it still doesnt work. After I did what he said, it basically gave me a generic 'could not connect' for both the encrypted and nonencrypted connection. If anyone knows what I'm talking about, please help before I kms.

curl?

i could use curl if I decided to say fuck the websockets, but I'm so fucking close it's killing me.

Can someone explain this behavior in Python 3.5? I know C++, so I know how pass by value, pass by reference, and pointers all work. But I am confused about what's going on here because Python is new to me:

class ABC:
listOne = list()
listTwo = list()

def __init__(self):
self.listTwo = list()

a = ABC()
b = ABC()

a.listOne.append("One")
a.listTwo.append("One")

b.listOne.append("Two")
b.listTwo.append("Two")

print("a.listOne: ", a.listOne)
print("a.listTwo: ", a.listTwo)
print("b.listOne: ", b.listOne)
print("b.listTwo: ", b.listTwo)

Output:

a.listOne: ['One', 'Two']
a.listTwo: ['One']
b.listOne: ['One', 'Two']
b.listTwo: ['Two']

I need this because I want to paste a file into multiple selected folders. holy shit why is simple shit so difficult.

Encapsulation, Inheritance, and Polymorphism

listOne is a class level variable, therefore it's shared among all the instances of that class

listTwo is an instance level variable since you're setting it in the constructor, so the contents are specific to that instance

>Encapsulation
Fundamentally flawed
>Inheritance
Shit
>Polymorphism
Not exclusive to OOP

What programs have you made without OOP?

Python never ceases to amaze me.
I just found out that "foo" in s is faster than s.startswith("foo").
What the fuck.

Basically if you define variables outside of the methods, they're actually static members, not member variables.

As if:
struct A {
static std::list one{};
static std::list two{};

std::list two{}; // let's pretend this is allowed

A(): two{} {
}
};

Is it possible to hide the code of a python script?

I got memed my a company that is using python : they kept promising me I'll have a bonus at the end of my internship if I get beyond the original objective, which I did, and got nothing but the bare legal minimum.

I continued the project on my own and eventually managed to get something I can sell them for a fair price. Since they'll ask for a proof, I want to give them a sort of proprietary blob to prove my point and give them the source once I get my bucks.

I know we can do so in matlab but I never heard of such thing in Python.
Is rewriting the stuff in C, compiling it and calling the program in a python script my only solution? Feels overengineered.

(To expand upon this, both are accessed with the dot but the latter is simply being overriden).

IL or object code?

not really once the string starts getting bigger

not all that surprising on smaller strings either as operators are generally faster that function calls

you can compile python to an executable, not sure how hidden the code is though

object code I guess. wiki.python.org/moin/Asking for Help/How do you protect Python source code? says I should gibberish my variable and function names before I compile it into some .pyc and it should be enough but I think I'd better ask for other's opinion.

why is Java so good?

help me, /dpt/

That's why the "Report post" exists.

That's very strange but cool thing to know.

Another question: How do I type hint for lists of objects? Like if I had a list containing ABC objects, how would I type hint to them? I'm using PyCharm.

In this case, the type hinting works for the single object, but not a list containing that object:

def tester(ABCObject, ABCList):
'''
:param ABCObject: Takes a single instance of an ABC
:type ABCObject: ABC
:param ABCList: Takes a list containing ABC
:type ABCList: list
'''

Not your personal army

Nv, figured it out. It's ''':type ABCList: list[abc]'''

it would be hilariously easily to reverse engineer, it can be decompiled to something pretty close to the source.

understand that anything can be reverse engineered, it just depends on how much effort one is willing to put in.

with that said, how worried are you that they will try to cuck you? the case might be that simply obfuscating the shit out of it might be enough. or you might have to rewrite it in C and employ a bunch of anti-debugging techniques.

mods/janitors are too slow. let's make it annoying for shitposters.

this is not only about me, you will benefit from this too, but OK, whatever floats your boat.

For fun, I want to create a python program that will collect all the data while I play Overwatch.

Preferably, I'd like the data to be the amount of keystrokes entered, internet speed, characters chosen, specials activated, life of player, etc.

Are there any anons that can provide input on how to get started with this in Python? I'm not even sure if I'd be able to do this, as surely Blizzard has some sort of authentication feature that would stop my python program from doing this.

Not sure if this is over my head, but I'm just curious as to how one would do this.

>Not sure if this is over my head
it almost certainly is
you either need to cause the game to load a .dll you create, either at runtime or by creating a remote thread in the process which calls LoadLibrary
or you can read the data out of the game from your process with ReadProcessMemory

either way you need to reverse at least a little of the game to figure out where the data is located
which means you also need to know at least some x86 asm

>this is not only about me, you will benefit from this too, but OK, whatever floats your boat.
I don't benefit because I don't go to dumb shit threads like speccy or desktop so I don't see any of that shit anyway. Likewise, their existence works as containment because it keeps speccy retards from shitting up my serious discussions.

If you want to post somewhere where users actively prevent certain discussions, reddit or voat are prime candidates for you to go to.

bump please? I'm about to kms.

So I'm about to finish this "Illustrated WPF" book, on what should I focus next if I wan't to develop LOB/Enterprise applications? Databases, git gud at this framework?

I'm working on a couple of personal projects just to practice and to show, but pointers to what do next will be helpful.

Well fuck. Maybe I'll play with some other ideas before I try to attempt this. Not sure how difficult this is, but considering I'm asking these questions I'm going to say very.

Thanks for your input.

thanks fags, someone reported the thread and it was deleted ironically, they aren't this fast when I report useless/spammy threads.

>understand that anything can be reverse engineered
Yeah, I know, but I believe they'll realize that it would be cheaper to help me repay a part of my student loan than paying the man-hours to reverse engineer instead of working on their own tasks. (or he'll just cuck another intern into doing it for him)

>with that said, how worried are you that they will try to cuck you? [...] you might have to rewrite it in C and employ a bunch of anti-debugging techniques.
As much as he can I guess. Since I don't know the extend of decompyle I guess C is the safest solution.

it's not as bad as it sounds, but if you're not coming from a C or C++ background then it's probably going to be a while before you're at that point

amazon.com/Expert-Programming-Peter-van-Linden/dp/0131774298/

c-faq.com/

literateprogramming.com/ctraps.pdf

rmbconsulting.us/a-c-test-the-0x10-best-questions-for-would-be-embedded-programmers

tutorialspoint.com/cprogramming/cprogramming_interview_questions.htm

Thanks again brotha.

Oh, how could I forget the clockwise/spiral rule?

c-faq.com/decl/spiral.anderson.html

I bet none of the fags on Sup Forums can tell me what "OOP" really means.

upvote

Yeah, that is damn neat-o.