/dpt/ - Daily Programming Thread: Trump Edition

Previous Thread: What are you working on, Sup Forums??

Other urls found in this thread:

pastebin.com/w5mBSems
github.com/getify/You-Dont-Know-JS
en.wikibooks.org/wiki/Haskell/Classes_and_types#Classes_and_instances
youtube.com/watch?v=gihvvbNIEo8
twitter.com/NSFWRedditVideo

I'm reading a C++ tutorial

I'm watching one

...

If Trump was a programmer, which language would he have used?

Working on a linked list assignment...

I have a clear() method for a LinkedList, does this work? I wast trying without the front = NULL snippet, but it didn't seem to work
//FRONT IS NULL
if(front == NULL) return;

ListNode* temp = front->next;
while(temp != NULL)
{
cout

Java assignments

At least I'm learning.

When do I start making money?

Without front = null, the memory is still freed but front now points to a garbage memory value.

Never

Is it possible to get a bf who's both good at programming and also not diagnostically autistic?

Thanks, senpai

Cobol in all likelihood

Yes, but expect them to be liberal, or hate the world.

Gonna be a really tough one to find.

You can't be a good programmer without being autistic

Classical liberal or neoliberal?

I love that webm. Vote for Trump, brother.

NeoLiberal.

reddit.com/r/bur

What great readmes

>/dpt/
>Donald "President" Trump

stop shilling you fucking subleddit we don't give a fuck
go back to plebbit to get your internet shekels and never come back here faggot

NIGGER MY POST ISN'T A SPAM

...

Constructers in Abstract classes in cpp are a fucking nightmare and there's nothing helpful on the web for it.

this is my code and it's not fucking working for whater reason. pastebin.com/w5mBSems

where's the constructor?

is this bait or are you really fucking retarded?

therefore his argument is flawed

I wrote a JavaScript library for type checking and type conversion (and a map function).

I don't know if this could actually be useful though

in Abstract class


public:
char*nom;

this is my constructor. forgetaboudit too advanced for u i guess.

What font is this?

Fantasque Sans Mono

Thanks

I keep getting a variable not defined in scope error in c++ could anyone help me?

#include
#include

using namespace std;

class Person{
private: string full_name;

public:
string getName();
void setName(string n);
}


#include "Person.h"
string getName() {
return full_name //this is where i get the error
}


excuse the shit indentation first time doing this and the tab key was tabbing to the captcha

fagts

go to a code monkey site to learn the basics

string Person::getName() {
return full_name
}

TOPKEK

How new are you?

whatsamatta with you is typeof not gud enough for ye eh??

still an excellent exercise

still getting the same error

rather

;

You could do a lot of this with typeof but it's more convenient this way, and it also has some more features like check if every element in an array is a number, or map a function to every element of an array. I don't think anyone would use it though.

no as in the variable is not declared in this scope error

I just found out that because I read a graph of function names, parameters and data flow from a file and follow that graph, I am writing an interpreter for a script language.

That just struck me like lightning and the implications are alarmingly complex. Should I try to specify the "language" first or should I implement the functionality of the program and derive the language from what it actually does?

It's not like most of this couldn't be accomplished with built-ins (there's literally a map function for arrays since es6) but I like the explicitness of your library a lot.

>Using a non-strict language
ISHYGDDT

Doesn't that defeat the purpose of an abstract class?

>there's literally a map function for arrays since es6
Oh, didn't know that. That probably makes this pretty useless (I assume TypeScript has this too). Thanks though
It's not like you always have a choice

nw, it's all in the bible:
github.com/getify/You-Dont-Know-JS

there's a ; missing

I know I have fixed that but thats not whats giving me the error relating to the variables

I don't think it's a stupid enough question for /sqt/.

I want to run an old legacy C file on a webserver, using HTTP requests instead of stdin and stdout. What tool would you guys recommend?

works for me

disregard me i suck dicks

if you're a cute girl, you can suck mine ; )
what did you do wrong btw?

was meant for you

I had created a new folder where I put cloned Person.h and Person.cpp to see if the problem was something to do with the header file being used by others files in my original folder. Then I navigated to that folder in the terminal and forgot I was there so I was compiling the faulty code even though the original had been correctly edited

looks like cgi is what you want. not sure if it will just werk or if you have to rewrite certain sections.

Is there a better way for quasi inheritance in haskell?
data Generic = Base Shared Fields | Extended Shared Fields AndUnique

There is no need for inheritance in haskell.
Use typeclasses and instances.

I have to work with a poo in loo, what should I do?

foo :: Generic -> Float
foo (Base shared field) = shared
foo (Extended shared field extra) = shared * extra

bar :: Generic -> Field
bar (Base shared field) = field * (Base shared field)
bar (Extended shared field extra) = field * (Extended shared field extra)

*How should this be written instead?

en.wikibooks.org/wiki/Haskell/Classes_and_types#Classes_and_instances

Just do all the work, tell whoever Pajeet is worthless.
Then next time you get a worthwhile partner

you forgot ur semi-colon their bruh

Is there any good software for testing out network protocols?

Like a server or client tool you start up, select which types of fields are present and at which positions, then just let it log the input

So, I have an amazing idea.

But, I'm too lazy to actually work on it (I've started some work twice already, but both projects have stalled and died off)

The culprit is the fact I was unable to find a quick and easy way to display everything I've wanted.

Is there a game engine that allows me to do 2d/3d things, as easy as possible and preferably have a streamlined way to create dynamic guis?

Can be for C++/C# or any other language that's actually popular and makes sense

...Virtually?
If so, Cisco Packet Tracer

If not, why not just write one yourself? Selecting a port and listening is rather easy on all platforms.

Virtually, with no care about the real inner workings of protocols, just testing topology and such? Cisco Packet Tracer
Real emulation, can be connected to the internet and emulates every single layer, being able to even write your own protocols and simulating the machines with VM? GNS3

>If not, why not just write one yourself? Selecting a port and listening is rather easy on all platforms.
Writing a general one is a lot of work and I'm sure there are ready-made solutions out there.

I would like to be able to configure how the data is to be interpreted and also add tests for it.

Correct endianness that sometimes vary by field, correct encoding of floats (have to deal with people using non-IEEE...) and the like, etc.

Ah, excuse me, I thought you simply wanted to look at the data/run extremely simple tests.

>Comma after shekels.
>Proper noun 'internet' when it doesn't have 'the' to the left of it.
>Period instead of semicolon after subleddit.
You seem to be illiterate, user. I'm sorry, but you'll have to leave.

pointers are fucking my shit up again

whats the recommended way of returning collections of stuff in C++?
both of these seem pretty clumsy desu

bool read_into(byte** ppData, size_t** ppDataCount)
bool read_into(std::vector* pData)

link?

Writing a development environment for a computer I'm designing... in batch.

>1180 lines
Kill me.

what the fuck, why

get a decent scripting language at least

I'd love to - but I'm unwilling to learn.

Fuck all your object oriented shit, I want my GOTO / GOSUB dammit! I couldn't care less what problems it might have.

How is multiplication even defined here?

It isn't. The important bit is that the parameters of Base and Extended are required in foo and bar

if(op.image.isTrump() == "true")
{
reply("thank you for posting a trump picture");
}

>be 2nd year CS student
>class is 95% males
>get assigned to a random group of 4 people for next assignment
>my 3 teammates are female

really makes me wonder

>I'm unwilling to learn
Are you fucking serious? You would rather write scripts in the shittiest "language" ever than learning a proper language? You don't even have to learn a whole new language, you can just learn the very basics and it would be infinetely better than batch.

Name a language that has goto or an instruction like it, and I'll look into it very seriously.

Functions don't count, the variables have to be global for the entire program.

I say this with 100% seriousness - I've been using GOTO since the late 1980s when we first got a computer - it's a bad habit that I don't see the problem with not giving up.

A good IDE is also something of a must.

Post-script:
Keep in mind this is just an emulator for a computer I'm designing, since it hasn't been built yet and a few of my friends are working on programs for it, I thought it'd be useful to write a short program they could emulate the computer in.

>Name a language that has goto or an instruction like it, and I'll look into it very seriously.
There's a reason why nobody uses goto, it's because it's fucking shit and you would probably realize that if you would learn an actually useful language.
>Functions don't count, the variables have to be global for the entire program.
You can modify global variables with functions.
>it's a bad habit that I don't see the problem with not giving up
So you're admitting that you're just stuck in the past?

Seriously, learn a proper scripting language RIGHT NOW. If you don't then you're just ignorant as fuck and stuck in the past.

Oh and I should also mention that there are (obviously) languages that have a goto feature but as I said, there's not a single reason to use them.

Remind me of what exactly makes goto shit.
>Looks more organized
>carries over variables
>easy looping
>Access one point of a program from multiple positions and act accordingly
The only problem I can see with goto might be speed or memory fragmentation, neither of which are of particular importance to me.

Yes, I am stuck in the past, but at least my god damned Commodore 64 works correctly.

Name a decent scripting language with gosub or a goto equivalent, and like I said, I'll look into it.

See above for my reasons

>Looks more organized
No, it's the exact opposite: Your code will be unmaintainable with goto.
>carries over variables
Except functions can do that much better in every way.
>easy looping
No. Why do you think so?
>Access one point of a program from multiple positions and act accordingly
Except functions can do that much better in every way, again.

You clearly don't know shit about programming and refuse to learn anything new because it's something new. Do yourself a favor and learn a new language anyway, your life will become so much easier. I mean seriously, batch scripting is the most annoying "language" I have ever used. I would rather use Brainfuck than this garbage.
>Name a decent scripting language with gosub or a goto equivalent
You don't fucking get it, if you would use a decent language then you would immediately realize how retarded your arguments were.

Is there any good open-source keystroke encryption software out there?
And does the major operating systems have them built in?
If they don't, shouldn't they?

I mean, as long as they were set up to use a random salt, the whole keylogger problem would vanish?
Am I wrong?

I've posted in this thread before. I'm pretty good doing simple coding challenges in Js. I don't see Javascript posted here a lot so I'm just throwing that out there.

For my first actual programming project I want to create a voice interactive alarm clock; something with more dexterity than google now.

I want to use my phone to do this, a bit like:
youtube.com/watch?v=gihvvbNIEo8

I'm aware he uses does this with 'tasker scripts' (something unfamiliar with). How can I use voice to send text to my RPi? It's pretty simple. How do you think I should go about this?

I want it to take as input a conversational string and to search the string for keywords. If anyone has any insight on ways to go about this, that would be awesome. I essentially know nothing.

So im doing my first bigger project and I'm not sure if everything is working fine

what i am doing is read input data from excel and plugging it all into a custom class to manage and query it

it works fine when I test it with just the first 10 lines, but when I run a test of all 30k lines it never terminates. Im monitoring it via task-manager and the ram usage never goes above 20mb

i dont really have the experience to troubleshoot this, could you recommend something?

Where is pic related disorganized?

>Except functions can do that much better in every way
How can integers be carried over better? I'm not sure I understand. All it's doing is retaining a value.

>No. Why do you think so?
:LOOP
REM Stuff here
GOTO LOOP
That's why.

>Except functions can do that much better in every way, again.
Calling a function name inside a function too many times can cause more issues than using GOTO infinite times.

>Rather use Brainfuck than this garbage
That was a low blow

>learn a decent language
I'm not sure if visual C++ counts, but it was pretty shitty for what I tried to do. Could've been done much simpler in batch or VBS even.

>Your life will become much easier
By learning a high level programming language? You realize I work more with hardware than software, right? (I don't know if I implied that enough, sorry).

C was pretty good, but I still prefer even Crapplesoft BASIC or FORTRAN over it.

Writing a game/physics engine.

Anyone know a sensible way to handle a player-controlled object that is also a physics object? Like, I still want it to bounce off of things and resolve collisions sanely, but I also want the player to control it. I'm trying to avoid doing things that would allow the player to cancel all their momentum w/ quick movements

>How can integers be carried over better? I'm not sure I understand. All it's doing is retaining a value.
I don't exactly know what you mean, but you can carry over variables to functions very easily
function(variable) {
// do something with the variable
}
>:LOOP
>REM Stuff here
>GOTO LOOP
>That's why.
You mean an infinite loop?
while(true) {
// do stuff
}
Or do a thing 10 times:
for(int i = 0; i < 10; i++) {
// do stuff
}
These are just two cases. You have many more options that are much better than goto.
>Calling a function name inside a function too many times can cause more issues than using GOTO infinite times.
I have no idea what you're talking about. Do you mean calling a function inside a function? Why would that cause issues?
>I'm not sure if visual C++ counts, but it was pretty shitty for what I tried to do.
Then use something else. That's not an excuse, there are so many languages to choose from. Pretty much everything you do in batch is easier in other languages.
>You realize I work more with hardware than software, right?
Doesn't matter, just learn the basics of a scripting language. There are so many languages yet you choose batch?

>Learn a language
>ruby
No
>Python
Fuck off
>C
Confusing but yeah sure
>C++
garbage
>Java
No
>VBScript
Acceptable but no
>PowerShell
How about suicide

Trying to become a functional programming magician.

What language?

I decided to get back into programming, been about a year since I was programming basic games like tic-tac-toe and shit like that.

Wanted to get back into it, so I am just doing little mini programs to get back into the swing of things, as in shit that takes like 2 minutes.

Haskell

So who did he vote for? Did he vote for Jeb?