/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

stackoverflow.com/insights/survey/2016#technology
en.wikipedia.org/wiki/ARM_architecture#Advanced_SIMD_.28NEON.29
phrack.org/issues/49/14.html
twitter.com/NSFWRedditGif

First for anime.

Rewrite most of NASA's codebase in Haskell.

Thanks for anime image.

If you want the version with audio: my.mixtape.moe/wryegl.webm

If I learn C# first, will I be hated on here?

Hated? No. But I won't consider you human.

Are you going to do programming for the money? yes? Go ahead

Do you love the act of programming? Chose anything you like. I started with JS. Then I learned Python. Then C. After that I tried both Java and C# and I dindn't like either.

Then I learnt scheme, it's a nice language but it's so limited. Now I am in love with Dlang. The code is so readable I can't go back to C.

C is nice too I guess

>Now I am in love with Dlang
>Necrophilia

Hello lasses and lads, do anyone happen to know a good book or site with good and structured information about Java servlets?

t.clueless student who don't want to go through google and read on pajeet-tier tutorials with do nothing

Hello /dpt/
I'd like to create a simple board game in C to learn about programming.

What would be a suitable type of data structure to represent a game board for a point-to-point movement game?

The game board of the game I'm currently planning to implement in C has cities interconnected by different kinds of routes. Each of these routes has a different number of intermediate "steps" that the players have to move their tokens along.

Pic somewhat related, although that game does not feature the intermediate steps between the cities.

D is necrophilia?
I guess C is like fucking your great grannny

>cities interconnected by different kinds of routes
A graph.

D is dead, user. I don't know how you can think otherwise.
Nobody of note uses it. There is no reason for anybody to learn it. Nobody (except necrophiles on here) talk about it. It completely fucked up the one niche it actually had a chance in. Other languages do literally everything it does better.
C is still alive and relevant, though.

I don't know if I should put this is /sqt/ but does Visual Basic trigger KeyUp events twice?
Using the debugger in Visual Studio I went step by step, and after the event finishes once it repeats itself for seemingly no reason, with different arguments.
>inb4huaaaaaaaa.NET
College requires it.

This stuff is exactly what I was looking for. Thanks user!

Are there separate 'key down' and 'key up' events or something?

I remember in delphi the enter key was separate characters cr lf, maybe something like that?

REEEEEEEEEEEEEEEEEEEEEEEEEEE
THIS IS A FUCKIN PEPE BOARD. GET OOOUUUUT!!!

Im having a good time drinking jägermeister and learning some assembly.
Why havent you converted to the /comfy/ lifestyle yet?

What anime program should I make to learn Rust?

>used to drink 12 beers each day for few months
>now fat fuck
Really miss drinking and programming.

@59459616
>REEEEEEEEEEEEEEEEEEEEEEEEEEE
>using that incorrectly

You shouldn't learn rust.

They updated the rankings, guys.

You don't need Rust to programm microcontrollers.
C is pretty good for it.

I wrote an anime program in Rust which gets the list of currently airing animu, finds all of the groups with releases of it, and then will add an entry to rutorrent's RSS feeds. Maybe that will give you some ideas.
I'm considering writing it in a language less infested with zealots though. They really turned me off the language.

C and python obvious masterrace.
Java, PHP and all that shit is for normies.

C is perfect for literally everything and Python is just glorious for sientific programming

Yes, it acts when the key is released while keydown is when the key is down. Additionally keypress is the middleground, and is the only one that behaves properly if you hold a button down and you begin to vomit letters continuously - however this is not desired in this case.

Did I ask you for an opinion?
I already know C though.
I have a similar program written in a more anime language already, but I guess I'll try if I can't find anything else.

To me the more to the bottom right a language it is, the better it is.

I don't think I care, I'm kinda immune to Sup Forums fags' constant hurr durr marketshare etc arguments and it doesn't affect me.
You shouldn't have to learn C either

The thing is what I am trying to do does not use Enter key - but yeah, Enter does return carriage and new line.

I noticed something new and mind dumbing. If breakpoints are on (step by step) the program sometimes behaves 100% correctly. If I am just typing without breakpoints, it starts going haywire.

I think I'll just start from scratch and try textChanged on the textBox or other crap instead, sorry if this looks like a mess to begin with.

You will be hated no matter what programming language you start with, no matter what programming language you like and use the most, etc...

I personally recommend starting with C, but in the end, it doesn't really matter that much. Just don't start with anything super retarded, like Visual Basic or PHP. Those are languages that don't have a legitimate use case in 2017.

>C is perfect for literally everything
Ahahahah no. In almost all cases C is just a useless timesink

@59459704
>use case
stopped reading right there.

Pascal :DDD

aw crap

no

Name a legitimate usage for either language. C# and F# both do excellent jobs for interacting with .NET, and VB is just a retarded third wheel with nothing to distinguish itself. Furthermore, it doesn't even work on .NET Core yet, so anything you make with it is basically going to be non-portable. With PHP, its only purpose was for web development, and JavaScript has stolen the show. Literally everything bad with JavaScript can also be said about PHP, but the reverse is not true. Starting a new PHP project in 2017 would be something only an idiot would do.

Introduction to OOP really, it does indeed have no practical purposes otherwise though, but it still could be used for standalone projects that nobody uses.

>stackoverflow.com/insights/survey/2016#technology
>C's popularity dropped by 11% in the last three years
RIP

>most loved
>Rust #1
:^)

>Introduction to OOP
Languages that are better than VB for this task: pretty much any OO language. Ruby especially, since it's the spiritual successor to Smalltalk.

>but it still could be used for standalone projects that nobody uses
You could do that in any language.

>Write a program which scrapes some website's internal API, because their whole stupid website is generated from JS
>2 months later, they change it

get away, reddit, even Sup Forums loves anime.

>Introduction to OOP

opinions on this book, I have heard mostly good things.
I have been learning Ruby and Lua, but now feel I want to branch out, Javascript because I am interested in Node, ember etc.
heard this is a good book also for general programming..

Why do you think this is an appropriate thread for your kind?

You should really ask in /wpg/.

those are two words that dont go together.

use LUA

Read my first Python/programming book, "Starting Out With Python". What do I do now? How do I further develop what I have learned?

Learn Lisp.

...

Haskell for functional programming.

As opposed to haskell for imperative programming?

Make something.

If he's going to learn pure FP, it shouldn't be with trashkell.

Better go with Lisp.

...

But Lisp is outdated.

Lisp doesn't use pure FP though. I was thinking more along the lines of Idris, which is dependently typed.
Outdated in what way?

Yeah, better start with Idris right away.
It's not outdated, it's trash.

How do you do when uploading to git if your C++ project includes a library from a single .hpp file? Do you distribute that single .hpp file in your repo, or simply provide a link to it?

I think Haskell is a good compromise. Why you don't like it ?

You're going to do a lot of pointless work to reap the benefits Idris provides. Besides, I want to encode proofs in my types.

Lua is godlike.

fuck you retards thanks for nothing

you are welcome

> Outdated in what way?
It totally ignores the last 50 years of development in CS and PL, still uses techniques and terminology from the 60s, the CL standard hasn't been updated for 23 years, yet the implementations still struggle with implementing the standard, it has no modern devevelopment tools, the performance is inherently bad because of dynamic typing and GC, the community consists of a couple of edgy teenagers and 50+ oldfags supporting 30+ years old legacy code (think Stallman and emacs).

install gentoo

Is there a way to specify additional include directories when you run an autoconf configure script?

>You're going to do a lot of pointless work to reap the benefits Idris provides
Elaborate.
Is Idris easy enough to learn if I know Haskell?

>It totally ignores the last 50 years of development in CS and PL
Citation needed. I've seen this rhetoric before with nothing to back it up.
>the CL standard hasn't been updated for 23 years
So what? Updating a standard isn't going to do anything. Look at Haskell. Its ecosystem is pervaded by dozens of non-standard language extensions.
>yet the implementations still struggle with implementing the standard
Now that's just not true. Where did you come up with that outlandish claim?
>it has no modern devevelopment tools
Define "modern development tool." Also point me to anything remotely comparable to SLIME.
>the performance is inherently bad because of dynamic typing and GC
CL can already be compiled down to assembly, and if space is an issue, just build your system using ECL. GC has never been an issue, but on that note, point me to any popular pure FP language that doesn't use it.

Can you write a C++ file that
1. Creates a vector of ints
2. Adds 1 ... n to the vector
3. searches x ∈ [1 ... n] and if found prints ("found")

C fags are welcome too.

Stop formatting your arguments like that, friggin sophomore. Focus on fleshing out coherent and striking retorts to key issues in his post, not on artistically responding point-for-point to every sentence he made. You think it makes you look like you're one-upping him on every level, but it actually makes it look like you don't have a clue and are just petty.

You can use parallelism if you want

>Stop formatting your arguments like that, friggin sophomore.
Emotional garbage.
>Focus on fleshing out coherent and striking retorts to key issues in his post, not on artistically responding point-for-point to every sentence he made.
Already done. Learn to read.
>You think it makes you look like you're one-upping him on every level, but it actually makes it look like you don't have a clue and are just petty.
Once again, just emotional fluff.

What hardware accelerated ISA extensions are implemented in modern smartphones,
apart from H.264/H.265 and MP3?

let v = Array.init 13 succ;;

let search x =
let l = Array.length v in
let rec loop i =
if i = l then
print_endline "not found"
else if v.(i) = x then
print_endline "found"
else
loop (succ i) in
loop 0
;;

let rec read_int prompt =
let line =
try
print_string prompt;
flush stdout;
Some (read_line ())
with
| End_of_file -> None in
match line with
| None -> None
| Some line ->
try
Some (int_of_string line)
with
| Failure _ -> read_int prompt
;;

let rec main () =
let n = read_int "Enter an int: " in
match n with
| None -> print_endline "bye"
| Some n ->
search n;
main ()
;;

let () = main ();;

>What hardware accelerated ISA extensions are implemented in modern smartphones,
>apart from H.264/H.265 and MP3?

WHAT DID HE MEAN BY THIS

Can you do this in C++? I'm sorry I just need this for benchmarking purposes

hey guys, NEET here learning to program. I'm halfway through cs50 on edx, doing all the excersises and stuff. What complementary material (books mostly) should/could I be reading along this course? Something for those moments when I get sick of looking at a screen and coding, so a book would be a nice thing to throw into the mix. Maybe something about cryptography, something about databases? Help me out.

en.wikipedia.org/wiki/ARM_architecture#Advanced_SIMD_.28NEON.29

I won't do your homework user.

I already know how to do this user. My intentions are clear.
import std.stdio;
import std.parallelism;

void main()
{
int[] arr;
for(int i = 0; i < 50_000_000; i++)
{
arr ~= i;
}

foreach(element; arr.parallel)
{
if (element == 40_000_000)
{
writeln("FOUND");
}
}
}

>Now that's just not true.
What about MOP, how many implementations have it feature-completed?
>Define "modern development tool."
IDE, debugger, profiler, code navigation, refactoring. All this with modern GUI, without expecting you to learn C-x C-c M-z C-M-y or such.
>CL can already be compiled down to assembly, and if space is an issue, just build your system using ECL
Well, anything can be compiled down to assembly, even Lua has LuaJIT. This doesn't change the fact that since CL is dynamically typed you have to have runtime type checks all over your code, and types being used being unknown compiler is unable to apply proper optimizations. In other words, CL can compete with LuaJIT or PyPyt, but it can't compete neither with Java/C# nor C/C++/Go/Rust. Oh, and every CL program have to have full-blown CL interpreter in it because you (eval) is always a possibility.

MOP isn't part of the standard. The usual emacs+slime+paredit+whatever else you need covers most if not all cases, so throwing it out just because it supposedly isn't modern, which by the way is a terrible metric to go by when choosing a tool, is frankly unwise. Anyway, there's tooling for vim, and of course there is LispWorks. CL actually has pretty good support for types (see deftype et al.). And optimizations are applied dependent on those type declarations. The space issue is very real, but as I said before, you could use ECL.

its quite amazing how theres really only two good scripting languages: lua and c#.

Lol, wtf is wrong with c#?? In tandem with .net, you can do freaking anything.

thanks for ruining /dpt/, idiots

How do you properly distribute a library?

I have created a library Foo in a folder. In another folder, I've created an application that uses said library. When I add the library folder to the include path in my application, it won't compile unless I also add the include paths to the libraries och which my Library Foo depend.

All I want is to Include Foo.h and nothing more. How do I do it? If it matters, I'm using Linux.

Can it solve P vs NP? If not, then it's trash.

#include
#include

#include

int main()
{
auto sample = std::vector(5'000'000);
iota(begin(sample), end(sample), 0);

auto result = find(begin(sample), end(sample), 4'000'000);

if (result != end(sample)) {
std::puts("Found!");
}

return 0;
}

How?

python is ubiquitous and comfy desu

there's no reason to use lua

Can you guys help me with a buffer overflow?

I have a script that I am supposed to overrun on purpose

#include
#include
#include

int main(int argc, char *argv[]){

printf("Enter some stuff:");

int magic = 1;
char buffer[16];


scanf("%s",buffer);

printf("You entered %s \n", buffer);
printf("magic = %d\n", magic);

if (magic == 77){
/* REDACTED */ // Print out the flag

} else {
printf("nope\n");
}

return EXIT_SUCCESS;

}


The problem is when I feed the program garbage to get output, all I either receive is 1, or a number tens of thousands higher than 77.

Im not sure what exactly i am supposed to be feeding this program to get 77 out of it.

What documentation generator should I use for C++ projects?
I want something with the least amount of friction, since I've never used anything like that.

Here's some literature for you to read: phrack.org/issues/49/14.html

put it in /contrib/ with license.