/dpt/ - Daily Programming Thread

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

Attached: 1541483607240.jpg (1000x1100, 114K)

Nothing, go shoot yourself subreddit niggers

Can you write a computer program to grade students answers? I was thinking of creating a small online history course that uses NLP to compare users answers to the accepted ones, based on keywords and sentence similarity. Obviously it won't be able to grade entire essays, but what about maybe 1 or 2 sentences?

Attached: images (15).jpg (715x429, 38K)

The project I picked up is built with visual studio which I am not familiar with and it is not building because some object defined in the shader is not being found

Is it possible I have to manually do something within the IDE to link the shaders to the project?

Rust was supposed to be OCaml without a GC. Did it succeed?

What is encapsulation?

Stop trying to make Ocaml a thing. It's a shitlang that's only used by Jane Street.

might as well just set the score to randomfloat(0, 100)

No because I'm an i/g/norant who only cares about being a member of the Linux master race, praying to Richard Stallman (the saint of Emacs), and having the right specs to play Deus Ex...

Best programmers:
>furries
>trans folk
>women
>enbies

It's no Haskell but it's certainly better than Java and Python.

please don't disrespect the good name of programming socks by falseflagging this hard

I have this copy function in C. I use to copy a line from a file into memory. Any way I can optimize it, resources to learn algorithms, or does my compiler take care it for me?
int copy(char *src, char *desc, const char stop)
{
int cnt = 1;
for (; *src != stop; cnt++)
*desc++ = *src++;

return cnt;
}

>function returns number of bytes written + 1

you could probably speed it up by just scanning for the stop char and then using memcpy instead of doing it one byte at a time

This copy function is insecure. Use of it could constitute a security vulnerability.

Lisp is the most powerful programming language.

>This copy function is insecure
Why?

The size of the destination buffer is not provided as a function parameter. If src is a string provided by a user, this can be used to execute a buffer overflow vulnerability.

Similar behavior can be found in the gets function (which reads from standard in until a newline character is read) and the strcpy function (which copies characters until a null byte is found). You should read the man page for gets. It might give you some perspective.

I'm not writing a library. Just need this function for aoc.

Since you're not using a scripting language like Python or Ruby, I'm assuming you don't give a shit about leaderboard scores. In this case, you should focus on developing good programming habits. Among these should include:

1. Always include size parameter for a destination buffer, never writing more characters than the buffer is capable of storing.
2. Any parameter that is a pointer should be const if you are not writing to it.

Reposting from last thread
I just got accepted to a 6 figure salary position up in boston. It'll be the first time I'll live a city other than NYC

What is it like to live in a place other than NYC? Do they have halal? What about pizza? Or hobos? Do they even have cheap Chinese food?
There's so many questions I need answered

I appreciate the help, and you're right, I don't give a flying fuck about showing off, but I'm not a newbie. I know about type qualifiers, and I chose not to use const in that function, because it isn't necessary in my use case. src is a pointer to mmapped file, that is opened with the O_RDONLY flag, with PROT_READ. I need to know the advanced stuff.

strchr(stc,stop)='\0';
strcpy(src,desc);

Fite me code safety nerds. Why do you even care how big the copy was? I'm assuming that you're writing to the beginning of 'desc' so you might as well just strlen it later.

nobody cares

>"copy" function that modifies the copied-from string
good fuckin job idiot

I can't do that. src is a pointer to mmapped file, that is opened with the O_RDONLY flag, with PROT_READ. I wouldn't need to copy, if I was okay with modifying the file.

Baaaaaaw, const that shit if you don't want me overwriting it.

where are you moving

Is C++ a good language to start for a (almost) total newbie?
I'm using Bjarne's "Programming: Principles and Practice"
plz no rude

C is fine. Think of C++ as a syntax hack of C, because people got tired of passing structs around.

Nope

also it comes with a complete other turing-complete language attached to it as the template system

Deep, unintelligible magic system is more like it, fun to use at least.

Though it can also be used to compile the same code twice swapping 'float' for 'double', bloating object size by 2x for no goddamned reason. Oh well.

Could someone please explain, are shaders always included through code or does the IDE play a role as well?

Boston

What sort of shaders? What language is this even? I am assuming you mean object not found errors as-in C/C++ linking errors. If you see a linking error, likely a source file isn't getting built (i.e. not added to the project in vstudio)

How many figures are you being offered?

You can get a condo down by Fenway Park for like $4000/month, and have tons of wacky food within walking distance
Or you can live in Cambridge, drive to work every day, and deal with shithead massholes who don't fucking know how to drive
Pretty sure those are all your options
Boston is a puckered anus leaking blood

6

They are glsl but saved as .c

Is there a way to add them manually?

Managed to ask in the wrong thread. I'm doing some graphics programming and I'm looking for some fun shapes to procedurally generate. Any ideas?

Remove all of these except "women(male)" and it's ok

Dependent types make programming practical.

What other cities have you lived in?

The segregation of state.

Oh, it's shaders saved out in const char[]s so you don't have to load at runtime. Yeah it sounds like the .c files aren't compiling == not added to the project.

Look in the project explorer and it should indicate that you have files there that aren't added to the project. Right click them or something?

Altenatively, just #include the .c files somewhere that is already compiling, good enough for simple shader sources.

Have barely left Brooklyn the 22 years I've lived on this earth

What are your go-to eatery choices, ethnic or otherwise?

critique my niggerlicious code

Attached: niggerlicious.png (582x922, 28K)

Halal or pizza

Ah so he saved them as .c so they could be included by Visual Studio?

Reading assembly for the first time. Incredibly ugly senpai

Please explain the following to me
>DifferentINputs
Are functions case sensitive in assembly?
>JNE L3
What does this line hope to accomplish. I thought when a jump fails, it just keeps going. So you're just jumping to the next assembly instruction anyway

Attached: x86_opcode_structure_and_instruction_overview.png (7004x4951, 1.98M)

Thank you?

You have .c's so that you don't have the load the shaders from disk when your program runs.

The way OpenGL works, you have to load your shader code into memory, then compile them at runtime with glCompileShader(...). The purpose of the .c files is that the shader code is dumped into constant memory that is automatically loaded when your program starts: lazy and efficient.

Remember that every .C source file gets individually compiled into an object file, then visual studio links all of the object files together to make a program. The error you saw was telling you that an object file was missing, which means you didn't get one of the .C's compiled.

x86 a CUTE

Attached: 1468197421600.jpg (400x400, 23K)

Thanks for explaining that to me. I tried moving the .c glsl files into my source files filter in Visual Studio

It is giving me many syntax errors on those files. I suppose it thinks they are supposed to be cpp? Or is glsl not compaitible with c? Or do I not have C compilers installed?

>reddit spacing
Did you just catch his autism.

it is github markdown spacing

glsl is neither C or C++, it's a separate language. All saving them as a .c or .cpp file is for is simply to declare them as constant raw data: char* or equivalent. The language would only matter if there is actual (non glsl) code in the file.

Pic relates in an example of this. The "proper" glsl source is in grey, but the whole thing is wrapped up as the equivalent of const char* just so the data is auto-loaded when the program starts. Yes you have to add the line breaks manually, hence why this is usually only done for small things.

Attached: s.png (583x171, 7K)

I see what you are saying but the shaders do not look like that unfortunately, they are written normally (starting with #version)

I suspect they are saved as .c just so his editor could recognize the keywords BUT at the same time I can't for the life of me see how they are connected to the project in the source code, so I wonder if it isn't through the IDE somehow

i can't read other peoples programs

threadly reminder

Attached: haskell guidelines.png (424x176, 8K)

Oh, well that's weird and strange. Yup if they are just straight up glsl files saved with a misleading extension then I guess you don't need to build them.

Presumably you got a function that loads the files somewhere else in the code? If not, here's a thing from my babbys first OpenGL demo

Attached: c.png (1186x511, 32K)

that's why i love using irrelevant langs.

Are programming socks only available in pink and white, or are other colours acceptable?

You mean socks for women.

I am working on learning XAML and C# from scratch for Xamarin.

How fucked am I, and when can I into employment?

The names of the files never appear in the code. How else could they be added?

>women
what is that, user?

Not you no matter what.

What you want to be.

I just wanna learn how to program

Lets say hypothetically speaking I have a 0day for filezilla server v3.39.0 with a working poc and added shellcode for windows?

would it be illegal if I were to try and sell it back to them or to someone else on the internet? Shodan is showing tons of Filezilla servers online right now, how much money do you guys thing this 0day is worth? and if so, could I be held accountable if I were to sell the code to someone else other then Filezilla themselves? Not really in the right position to be selling over 0days and I dont want to get into any trouble. Also not trying to sound like I know more then I do about binary exploitation; I was just fuzzing this new version for fun and found a weak buffer. thanx

#MeToo

do you accept bitcoin?

I dont have a bitcoin wallet. I've never sold any code before. I just currently got a full done putting it all together with py2.7

the actual crash took forever to be able to add shellcode I just pulled from metasploit since the buffer that is actually weak was not big enough to fit it all. its kinda long and I think I can still brush it up abit. im just wondering if I could get into any trouble for selling it. I dont want to email them and have them call the police on me.

Give to us, don't be gay.

Meant for you

>Did you roll your own fuzzer?
no im using peach fuzzer.

>What version of windows?
Windows 7 Ultimate x64. Its running inside a VM

>How did you bypass EMET?
in emetv5.52 you can jump over hooks. without an issue

> Of course it's illegal or a breach of contract, especially in the states.

Im not american. I live in chile.

>They probably won't do that, they might not even take you seriously or just flat out ignore you.

If I can sell it back to them and give them the addr that is vulnerable and prove that the exploit works. You think they be willing to pay me?

>You're fine, pendejo.
thanks johnny.

>TOPKEK. No, they'll just laugh at you, if anything. 0day.today.

pretty sure that website is ran the the police or government in America. Not about to go on that website and get arrested by someone in my country who works for your country.

maybe the real deal? I hear bitcoin is traceable now? any way of getting paid without it being able to be linked back to me?

How is much is too much to allocate onto the stack?
char array[1000][1000] = {};

Overkill?

>How is much is too much to allocate onto the stack?

depends on the operating system.
if your on windows dont go over 1mb
but on linux i believe it is more.

what os user?

Stack space is compiler-dependent, not OS-dependent. It's even configurable in most compilers.
The default for MSVC is 1MB, and the default for GCC/MinGW is 2MB, if I recall correctly.

Linux, the patricians choice, of course. Anyway, should I dynamically allocate the memory, or let my system automagically do it for me. Not for cross platform work. Asking for a friend.

I unironically like Go

Attached: 1541538239237.png (450x489, 74K)

wonder how long it's gonna be before they cave and finally add generics.

Do I totally misunderstand how python iterators are supposed to work or something?

from multiprocessing import Pool
from time import sleep
def expensive_func(n):
sleep(n)
return n*n
if __name__=='__main__':
p = Pool(1)
data = range(5)#works as expected
#data = filter(lambda x: x%2==0,range(5))
#exits immediately if line above uncommented
results = p.imap(expensive_func, data)
for a, b in zip(data, results):
print(a, b)


Why does this work as expected when 'data' is a range iterator, but when 'data' is a filtered iterator the loop exits after the first result is printed?

>let my system automagically do it for me

I would go in with this route.

Basically what the other guy said, just don't exceed 1mb and most of the time you should be safe. (The compiler will not automatically decide to dynamically allocate an array that is too large to fit on your stack)

For anything bigger, or even slightly smaller, you should use malloc or whatever memory allocator you use to be safe.

>Linux, the patricians choice, of course.
nice meme.

It's been nearly ten years, I doubt it will ever happen, but who knows with cucks.

Ah, kk, good to know, thanks guys.

>nice meme
nice nice meme meme. Works on my machine.

>nice nice meme meme. Works on my machine.

even though I use debian as my daily it still sometimes makes me cant to rip all my hair out of my head.

eh, as long as remmina stays on my desktop and I can reach my vps im fine i guess. and linux does run good on my computer and its really old and really shitty. (pic related)

Attached: 123.jpg (400x300, 16K)

>debian as my daily
Arch + sway + vim master race. What kind of problems are you having? What IAAS do you use?

Attached: sc.jpg (3840x1080, 1.35M)

They already are adding generics to go 2

oh no, what will /dpt/ shit post about then?

The same as usual. Mental illness, OOP, FP, and C.

as the other user said, install arch.
i was a long time debian user, but having to compile everything like gentoo because all the packages were 3 years old got tedious.