[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 316
Thread images: 47

File: 1475566478902.png (17KB, 400x300px) Image search: [Google]
1475566478902.png
17KB, 400x300px
What are you working on, /g/?

Old thread: >>59446947
>>
File: 1487413306014.png (383KB, 611x720px) Image search: [Google]
1487413306014.png
383KB, 611x720px
First for anime.
>>
File: 1486218892910.jpg (183KB, 1480x1080px) Image search: [Google]
1486218892910.jpg
183KB, 1480x1080px
Rewrite most of NASA's codebase in Haskell.
>>
File: cat_girl.png (341KB, 500x566px) Image search: [Google]
cat_girl.png
341KB, 500x566px
>>59459347
Thanks for anime image.
>>
File: my_project_for_the_last_week.webm (2MB, 1920x450px) Image search: [Google]
my_project_for_the_last_week.webm
2MB, 1920x450px
If you want the version with audio: my.mixtape.moe/wryegl.webm
>>
>>59459347
If I learn C# first, will I be hated on here?
>>
>>59459416
Hated? No. But I won't consider you human.
>>
>>59459416
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
>>
File: 1452471092796.png (372KB, 1280x720px) Image search: [Google]
1452471092796.png
372KB, 1280x720px
>>59459449
>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
>>
File: point-to-point.jpg (141KB, 500x333px) Image search: [Google]
point-to-point.jpg
141KB, 500x333px
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.
>>
>>59459488
D is necrophilia?
I guess C is like fucking your great grannny
>>
>>59459496
>cities interconnected by different kinds of routes
A graph.
>>
>>59459501
D is dead, anon. 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.
>>
File: 39c.jpg (82KB, 640x659px) Image search: [Google]
39c.jpg
82KB, 640x659px
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.
>>
File: graph.png (12KB, 179x251px) Image search: [Google]
graph.png
12KB, 179x251px
>>59459510
This stuff is exactly what I was looking for. Thanks anon!
>>
>>59459558
Are there separate 'key down' and 'key up' events or something?
>>
>>59459558
I remember in delphi the enter key was separate characters cr lf, maybe something like that?
>>
File: 1454897517948.jpg (13KB, 526x526px) Image search: [Google]
1454897517948.jpg
13KB, 526x526px
>>59459347
>>59459357
>>59459366
>>59459404
>>>/a/

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?
>>
File: 1479558719301.jpg (130KB, 894x894px) Image search: [Google]
1479558719301.jpg
130KB, 894x894px
What anime program should I make to learn Rust?
>>
>>59459621
>used to drink 12 beers each day for few months
>now fat fuck
Really miss drinking and programming.
>>
@59459616
>REEEEEEEEEEEEEEEEEEEEEEEEEEE
>using that incorrectly
>>>/r/ibbit
>>
>>59459626
You shouldn't learn rust.
>>
File: lang.rank_.117.wm_.png (139KB, 1250x915px) Image search: [Google]
lang.rank_.117.wm_.png
139KB, 1250x915px
They updated the rankings, guys.
>>
File: MVI_0537.MOV.webm (3MB, 1280x720px) Image search: [Google]
MVI_0537.MOV.webm
3MB, 1280x720px
>>59459626
You don't need Rust to programm microcontrollers.
C is pretty good for it.
>>
>>59459626
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.
>>
>>59459645
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
>>
>>59459589
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.
>>
>>59459644
Did I ask you for an opinion?
>>59459648
I already know C though.
>>59459651
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.
>>
>>59459645
To me the more to the bottom right a language it is, the better it is.
>>
>>59459544
I don't think I care, I'm kinda immune to /v/ fags' constant hurr durr marketshare etc arguments and it doesn't affect me.
>>59459644
You shouldn't have to learn C either
>>
File: whydothis.gif (200KB, 1060x446px) Image search: [Google]
whydothis.gif
200KB, 1060x446px
>>59459608
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.
>>
>>59459416

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.
>>
>>59459667
>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.
>>
>>59459704
Pascal :DDD
>>
>>59459704
aw crap
>>
>>59459717
no
>>
>>59459711

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.
>>
>>59459756
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.
>>
>https://stackoverflow.com/insights/survey/2016#technology
>C's popularity dropped by 11% in the last three years
RIP
>>
>>59459771
>most loved
>Rust #1
:^)
>>
>>59459767

>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.
>>
File: 1474373650932.png (164KB, 413x352px) Image search: [Google]
1474373650932.png
164KB, 413x352px
>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
>>
>>59459616
get away, reddit, even /pol/ loves anime.
>>
>>59459767
>Introduction to OOP
>>>/r/abbit
>>
File: javascript.png (159KB, 426x552px) Image search: [Google]
javascript.png
159KB, 426x552px
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..
>>
>>59459863
Why do you think this is an appropriate thread for your kind?
>>
>>59459863
You should really ask in /wpg/.
>>
>>59459863
those are two words that dont go together.

use LUA
>>
File: 1488855504532.jpg (63KB, 480x480px) Image search: [Google]
1488855504532.jpg
63KB, 480x480px
Read my first Python/programming book, "Starting Out With Python". What do I do now? How do I further develop what I have learned?
>>
>>59459987
Learn Lisp.
>>
>>59459987
>>59460009
>>>/p/lebbit
>>
>>59459987
Haskell for functional programming.
>>
>>59460051
As opposed to haskell for imperative programming?
>>
>>59459987
Make something.
>>
>>59460051
If he's going to learn pure FP, it shouldn't be with trashkell.
>>
>>59460063
Better go with Lisp.
>>
>>59460036
>>>/t/umblr
>>
>>59460074
But Lisp is outdated.
>>
>>59460074
Lisp doesn't use pure FP though. I was thinking more along the lines of Idris, which is dependently typed.
>>59460080
Outdated in what way?
>>
>>59460063
Yeah, better start with Idris right away.
>>59460080
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?
>>
>>59460091
I think Haskell is a good compromise. Why you don't like it ?
>>
>>59460110
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.
>>
>>59459955
Lua is godlike.
>>
fuck you retards thanks for nothing
>>
>>59460149
you are welcome
>>
>>59460091
> 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).
>>
>>59460149
install gentoo
>>
Is there a way to specify additional include directories when you run an autoconf configure script?
>>
>>59460120
>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?
>>
>>59460162
>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.
>>
>>59460315
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.
>>
>>59460333
You can use parallelism if you want
>>
>>59460337
>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?
>>
>>59460333
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 ();;
>>
>>59460365
>What hardware accelerated ISA extensions are implemented in modern smartphones,
>apart from H.264/H.265 and MP3?

WHAT DID HE MEAN BY THIS
>>
>>59460400
Can you do this in C++? I'm sorry I just need this for benchmarking purposes
>>
File: 123.jpg (99KB, 884x731px) Image search: [Google]
123.jpg
99KB, 884x731px
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.
>>
>>59460365
https://en.wikipedia.org/wiki/ARM_architecture#Advanced_SIMD_.28NEON.29
>>
>>59460425
I won't do your homework anon.
>>
>>59460461
I already know how to do this anon. 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");
}
}
}
>>
>>59460315
>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.
>>
>>59460503
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.
>>
>>59460137
its quite amazing how theres really only two good scripting languages: lua and c#.
>>
>>59459424
Lol, wtf is wrong with c#?? In tandem with .net, you can do freaking anything.
>>
>>59459404
>>59459366
>>59459357
>>59459347
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.
>>
>>59460677
Can it solve P vs NP? If not, then it's trash.
>>
>>59460480
#include <algorithm>
#include <vector>

#include <cstdio>

int main()
{
auto sample = std::vector<int>(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;
}
>>
>>59460689
How?
>>
>>59460673
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 <stdio.h>
#include <stdlib.h>
#include <unistd.h>

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.
>>
>>59460711
Here's some literature for you to read: http://phrack.org/issues/49/14.html
>>
>>59460103
put it in /contrib/ with license.
>>
>>59460711
scanfs doesn't care if you overflow, so it will also overwrite escape character.
you could easily do buffer[16] = '\0' to fix your problem.
>>
>>59460695
Holy shit, I guess I got 1mil richer. An algo for verifying a subset of numbers within a set adds to 0? Whats the catch?
>>
>>59460711
>C-fags will defend this garbage language
>>
>>59460677
>Lol
>freaking
>>>/r/ibbit
>>
>>59460742
looks solid, ill have a look

>>59460760
sorry are you suggesting this to solve the overflow? I need to exploit the overflow for a challenge, modifying the code is out of the question because it runs off a server we have to telnet to.
>>
>>59460705
thanks
>>
>>59460721
there's Doxygen, but not sure it's still the best
>>
>>59460756
Thanks!
>>
>>59460808
Yeah, it'll probably be what I choose by default, but all I've heard about it is "it's bad, but there's nothing better". Hopefully that's not true.
>>
>>59460711

I get what they are tying here.
Find which char corresponds to 77, and when you start going over 16char limit, keep spamming that char till you bump into address of magic.
>>
>>59460710
i was going to mention python in my post, but its lack of portability and compatability as well as split community make it a terrible language to learn, but it has good implementation
>>
>>59460771
That was just one example of the P vs NP problem. You'd have to prove it in the general case.
>>
>>59460333
Yes. Of course.
>>
>>59460711
aaaaaaaaaaaaaaaaM

is solution
>>
>>59460756
different anon here

is there a book/manual where I can learn stuff like this?

I want to organize code like a pro to make it public and not look like a newfag
>>
>>59460711
>Can you guys help me with a buffer overflow?
Don't use C
>>
>>59460881
Don't think so. I guess just browse a lot of repositories and projects and you'll get a feeling of how things should go. Usually there is at least a folder for the actual source code of a program, one for testing, one for dependencies when they may be harder to find, and one for doc. In the root you put things like readme, install and license file if you got one.
>>
>>59460789
Roflcopter
>>
>>59460899
it's his homework, the task is to trigger the overflow

it teaches people how shit C is
>>
>>59460930
kek
>>
>>59460711
So, to help you out.
Debug the code using
     
printf("%x", &buffer[16]);
printf("\n%x", &magic);

You'll notice that they are same address, and since magic is of type int, whatever char you enter, will be casted as int.
>>
>>59460333
#include <stdio.h>
#include <vector>

bool search(int x, const std::vector<int> &ints)
{
for (auto &i : ints)
{
if (i == x)
{
return true;
}
}

return false;
}

int main()
{
std::vector<int> ints;
const int n = 100;

for (int i = 1; i <= n; i++)
{
ints.push_back(i);
}

if (search(56, ints))
{
puts("found");
}
}
>>
>>59460906
thanks for the advice
I guess there's no shortcut to gaining experience:)
>>
>>59460872
>aaaaaaaaaaaaaaaaM
that does not work sadly
>>
File: ye it does.png (4KB, 641x292px) Image search: [Google]
ye it does.png
4KB, 641x292px
>>59460997
>aaaaaaaaaaaaaaaaM
>>
>>59460693
I googled and found this:
https://stackoverflow.com/questions/13978775/how-to-avoid-include-dependency-to-external-library

Is this the only solutions available?
>>
>>59460997
>>59461024
It's extremely reliant on your architecture and compiler, and how it decides to lay shit out.
On x86_64 GNU/Linux with GCC 6.3.1, the compiler put some extra space between them.
aaaaaaaaaaaaaaaaaaaaaaaaaaaaM was the input that worked for me.
>>
>>59460333
int createvec(int n) { retuen n; }
int find(int v, int x) { return x >= 1 && x <= v; }

if(find(v, x))
puts("found");


no need for a search since we know the vector always contains 1 .. n
>>
>>59461053
well there you go.
its maybe a bit further away, the address that is, really only way to know is to debug it and check where it is.
>>
>>59460956
Thank you anon
>>
File: i counted 16 a.png (29KB, 321x145px) Image search: [Google]
i counted 16 a.png
29KB, 321x145px
>>59461024
Here i made sure to use 16a

>>59461053
Right okay, I didnt try that with more a because when i over run it by a small amount, I used &#127 just to fuck with it and I got something like 50 000 as a return
>>
>>59461024
>>59461053
Ok great thats going.

So why does it return 77? I get that M is ascii code number 77, which is fair enough, yeah I get that one.

But I was watching videos on buffer overflows to get my hread around this concept, and it was all MALICIOUS CODE POINTING AND INJECTING OMGGG

and I dont understand how we get from feeding a fucking array to retreiving code from overrun memory.
>>
Reminder there's literally no reason to not use JavaScript and webgl to create your games.

https://playcanv.as/e/p/44MRmJRU/
>>
>>59461108
>and I dont understand how we get from feeding a fucking array to retreiving code from overrun memory.
anon, you need to learn about the stack and how memory is reserved by the compiler

this is kind of important if you want to be a semi-competent programmer
>>
I want to learn C++ but the language is too big to master.

>inb4 C
no
>>
File: 1486916586115.jpg (46KB, 600x291px) Image search: [Google]
1486916586115.jpg
46KB, 600x291px
Today I will remind them
>>
File: pointers.jpg (62KB, 500x500px) Image search: [Google]
pointers.jpg
62KB, 500x500px
>>59461108
Check out about arrays and pointers.
>>
>>59461162
Schwarzenegger is an anti-Trump cuck.

Guy on the right is cooler.
>>
>>59461166
>pointers
oh fuck me. i dont encounter this shit in bash

>>59461153
im not a programmer at all. this is a security course im doing for fun because i want better linux skills and to learn to script to automate; i always felt scripters were hell different to programmers
>>
>>59461161
You can't learn C++ without learning C.
>>
>>59461206
I know a little bit of C, it's not really all that special
>>
>>59461206
>You can't learn C++ without learning C.
Bjarne claims C is obsolete and knowledge of C is not required to learn C++
>>
>>59461166
Where does the computer store the array elements while you later try to access the int?
>>
>>59461223
Bjarne is a faggot. Don't listen to his lies.
>>
>>59461233
They are all on stack, oh man, you will have to watch some tutorials on this. There are big differences between dynamically allocated stuff and static stuff.
>>
>>59461253
Yea, but LIFO? So you'd have to pop through the array to reach the int right? Or does the memory stack operate differently from regular data structure
>>
>>59461181
>im not a programmer at all.
you're still in STEM, aren't you? if you write code then you're a programmer
>>
>>59460711
Where's the script?
>>
What's the difference between static and non static classes? Only performance ones or is there something I'm missing?
>>
>>59461261
It operates a bit differently.
>>
>>59460333
(defun foo (n x)
(declare (type (integer 1 *) n x))
(let ((a (make-array n :fill-pointer 0)))
(loop for i from 1 to n do (vector-push i a))
(when (find x a)
(print "Found."))))
>>
>>59461287
error: expected ')' before 'foo'
(defun foo (n x)
>>
>>59461269
Programmer as a profession was a mistake.
>>
File: Untitled.png (116KB, 1908x489px) Image search: [Google]
Untitled.png
116KB, 1908x489px
>rust
hurr durr segfaults
>D
yet another C replacement
>Chapel
Seems like a language that is actually trying to fill niche.
>>
>>59461392
I haven't heard of it, so it must be trash.
>>
>>59461392
>""""productive"""" as a property of a given language
>the cloud
I can already tell it's fucking garbage.
>>
>>59461431
Research projects don't pay for shills to spam image boards like Companies like Mozilla.
>>
>>59459410
BR? HUE
>>
>>59460333 >>59460339 >>59460400 >>59460870 >>59460956 >>59461064 >>59461287
this is why you learn Python
if 56 in range(1,100):
print('found')
>>
>>59459648
Why does screwing that thingy speed up the program
>>
>>59461506
I can do the same.
if mem 56 (range 1 100) then print_endline "found"


When you compare languages compare them with the same stdlib, otherwise you'll use a shitty language with a huge std lib. It's good for small project, but for big projects the stdlib is irelevant, but the language is.

Filthy code monkey.
>>
Shalom
(require 2htdp/image)
(define image-size 20)
(overlay/xy
(triangle image-size "outline" "blue")
0 (/ image-size 3)
(rotate 180 (triangle image-size "outline" "blue")))
>>
File: 1482251585484.jpg (165KB, 1032x774px) Image search: [Google]
1482251585484.jpg
165KB, 1032x774px
>>59459771
>VII. Development Environments
>first place
>Notepad++
>>
File: 1475202542027.png (38KB, 691x456px) Image search: [Google]
1475202542027.png
38KB, 691x456px
>>59459648
>using C to flash leds
>not using a c# http server to flash leds
>>
File: see you around faggot.gif (443KB, 400x296px) Image search: [Google]
see you around faggot.gif
443KB, 400x296px
>>59460710
>there's no reason to use lua
>>
File: 1481931532294.png (229KB, 1075x1430px) Image search: [Google]
1481931532294.png
229KB, 1075x1430px
>tfw to smart to use any language but C++

enum byte : unsigned char {}; // byte is a new integer type
byte b { 42 }; // OK as of C++17 (direct-list-initialization)
byte c = { 42 }; // error
byte d = byte{ 42 }; // OK as of C++17; same value as b
byte e { -1 }; // error

struct A { byte b; };
A a1 = { { 42 } }; // error
A a2 = { byte{ 42 } }; // OK as of C++17

void f(byte);
f({ 42 }); // error

enum class Handle : std::uint32_t { Invalid = 0 };
Handle h { 42 }; // OK as of C++17
>>
File: 1487267510041.jpg (337KB, 1280x1483px) Image search: [Google]
1487267510041.jpg
337KB, 1280x1483px
>>59461659
>tfw to smart to use any language but C
>>
File: 1486153748181.png (19KB, 500x590px) Image search: [Google]
1486153748181.png
19KB, 500x590px
>tfw to smart to use any language but ASM
>>
File: 1477518401786.jpg (79KB, 640x640px) Image search: [Google]
1477518401786.jpg
79KB, 640x640px
>tfw too smart to code but i can post on >>>/g/ about pajeet languages i know nothing about
>>
>>59461622
*unless you're working with torch or something specific
>>
>>59461767
Pleas include a trigger warning sir, this hurt the feels.

Kind regards: LeRedditKid2005XD
>>
>>59461767
It's "to smart" not "too smart" you stupid fucker.
>>
inline namespace __cxxabiv1
{
extern "C" void* __cxa_allocate_exception(std::size_t thrown_size) _GLIBCXX_NOTHROW;
}

extern "C" void* irq_safe_malloc(std::size_t n)
{
if (in_irq_context()) return nullptr;
return std::malloc(n);
}

// BLACK MAGIC HAPPENS HERE
void patch__cxa_allocate_exception()
{
auto p = reinterpret_cast<byte*>(__cxxabiv1::__cxa_allocate_exception); // take the address of __cxa_allocate_exception
p = std::find(p, p + 0x20, 0xe8); // find the first 0xe8 byte, assume this is the call to malloc.
auto post_call = reinterpret_cast<std::uintptr_t>(p + 5); // e8 call instruction is 5 bytes
auto new_malloc = reinterpret_cast<std::ptrdiff_t>(irq_safe_malloc); // take address of irq_safe_malloc
*reinterpret_cast<std::ptrdiff_t*>(p + 1) = new_malloc - post_call; // hotpatch __cxa_alloc to call irq_safe_malloc instead.
}

holy shit what the fuck did I just do
>>
File: 294527424.jpg (110KB, 500x500px) Image search: [Google]
294527424.jpg
110KB, 500x500px
>>59461817
So, this is the power of pajeet++
>>
explain in retards terms how to invert a list.
>>
>>59461659
C++ was a mistake.
>>
>>59461817
>inline namespace
fucking sepples
>>
>>59461837
(reverse list)
>>
>>59461850
I need to implement the function anon.
>>
>>59461837
>swap 0 with n - 1
>swap 1 with n - 2
>...
>>
>>59459756
>>59459767
VB.NET was literally made only because MS wanted VB6 people to migrate their shit to .NET and expected them not to understand C#
>>
>>59461876
I need to do it on racket and don't know how to do n-1 in a recursive function.
>>
>>59461837
1 - Create new list
2 - Pop first element of the list
3 - Add it to the new list
4 - Repeat -2 and -3 until there's no more element to take in the list
>>
>>59461903
5 - return new list
>>
>>59461837
let reversed = list.into_iter().rev().collect();
>>
>>59461837
what kind of list? in what language?

define the input precisely
>>
>>59461899
>>59461903
>>59461919
Example:
(let ((s '()))
(dolist (i '(1 2 3 4 5) s)
(push i s)))
>>
>>59461899
(define (rev lst ret)
(if (empty? lst)
ret
(rev (rest lst) (first lst))))
(rev '(1 2 3) '())


2 list, one input, one empty
remove first from input and add it to beginning of empty until there's no more stuff in input
>>
>>59461946
WHITE GENOCIDE
REEEEEEEEEEEEEEEEEEEEEE
>>
le programming language xdxd
>>
>>59461392
>the cloud
What did he mean by this?
>>
File: thefuckamireading.jpg (94KB, 421x834px) Image search: [Google]
thefuckamireading.jpg
94KB, 421x834px
>>59461980
Christ, /dpt/, why are you so triggered by a piece of code?
>>
>>59462001
designed to run on distributed systems.
>>
>>59461782
Lua is the best embedded scripting language.
>>
>>59462118
>best embedded scripting language
that's C
>>
>>59461954
You need to fix your recursive call.
>>
>>59462129
>Scripting
>>
>>59462132
shh
>>
>>59462154
Of course, it's only fair we let him figure it out.
>>
File: HAHA FAGGOT.jpg (235KB, 1211x1210px) Image search: [Google]
HAHA FAGGOT.jpg
235KB, 1211x1210px
>>59462129
>>
So, I have a data.txt:
[8,10,6,7]
[7,10,5,7]
[7,8,6,7]
[7,8,3,7]
[7,7,3,4]
[4,6,4,5]


And I want to strip them and operate with arrays (note the comment):
file = open('data.txt')

def print_lines(a):
for line in a:
data = line.strip('[]')
# data = map(int, data.split(','))

print data

print_lines(file)


After the line.strip the print output is this shit:
8,10,6,7]

7,10,5,7]

7,8,6,7]

7,8,3,7]

7,7,3,4]

4,6,4,5


How to make it work properly?
>>
Well, nanosecond of googling and now I know of string.translate().
file = open('data.txt')
def print_lines(a):
for line in a:
data = line.strip()
data = data.translate(None, '[]')
data = map(int, data.split(','))
print data

print_lines(file)

But that line.strip() still bugs me, it should remove ']' before the '\n', and it does not.
>>
>>59462327
try
.strip('[]\n')
>>
>>59462401
Thanks, m8!
Who would know it was so easy.
>>
File: 827.png (250KB, 680x638px) Image search: [Google]
827.png
250KB, 680x638px
$PEPE
>>
>>59462517
the alt right encryption frog
>>
>>59461284
pls respond
>>
Help the retard.


class Matrix {
T m[4][4];

public:
Matrix();
friend Matrix operator+ (const Matrix&, const Matrix&);
friend Matrix operator* (const Matrix&, const Matrix&);
friend Matrix
};


1. Is it possible to make an object, as it's written in the code, the AxB matrix, not 4x4? How could I imply this in code itself, like
Matrix i(4,4);
Matrix j(2,3);
etc.

2. How do I create an unary operator? Like;
Matrix m(3,3);
det m;

Are there any better variants? Don't punch me, I am legitimately scored below 100 IQ.
>>
Why aren't you programming with coeffects, /dpt/?
>>
void main()

or

int main()

?
>>
>>59462598
> Is it possible to make an object, as it's written in the code, the AxB matrix

yes, but you need to use dynamically allocated memory for your array or use vector<>

so you need to learn more C++ to do that

I'm pretty sure there are tutorials out there that teach all this with the matrix example, just search around
>>
>>59462684
int main if your program is launched by another process or you care about return codes in debugging

void if it isnt
>>
>>59462598
Templates.
>>
File: 1484836659130.png (178KB, 500x500px) Image search: [Google]
1484836659130.png
178KB, 500x500px
Is there a language which I can just type propositions into and it will tell me whether or not they are true?
>>
>>59462765
interactive console or something?
c++ has edit and continue and interactive
c# has interactive
lots of them have interactive i think
debug with visual studio in paused will tell you what is what too
>>
>>59462684
This >>59462690
Probably should just use int main and return 0 at the end just to dot your eyes and cross your teas
>>
File: languages3.png (17KB, 522x384px) Image search: [Google]
languages3.png
17KB, 522x384px
>>
>>59462765
Check out PROLOG, dumb anime poster
https://en.wikipedia.org/wiki/Prolog
>>
>>59462646
Because I'm trying to learn Haskell right now. Can we just keep it to one trendy language at time please?
>>
>>59462792
It can just print "True" or "False" to the screen after compilation, doesn't really matter.
>>59462814
Hello, plebbitor. Did I do something to upset you?
>>
>>59462765
python
>>
>>59462815
Why? 2 languages at a time is the bare minimum. Anything below is acceptable only if you are mentally handicapped.
>>
>>59462804
>haskell fasater than pyton

wrong.0day.7z.jpeg
>>
>>59462832
that's like any language that compiles and runs to console, did you mean something different?
>>
>>59462876
Non-professional programmer detected.
>>
>>59462876
Haskell is compiled, snek is not
>>
File: 1375549615821.png (107KB, 400x400px) Image search: [Google]
1375549615821.png
107KB, 400x400px
>>59462832
What about you check out the link I provided and thanks me you fucking piece of moe trash
>>
>>59462890
compiling code slows the development speed
>>
File: 1368599713102.png (20KB, 256x310px) Image search: [Google]
1368599713102.png
20KB, 256x310px
>>59462853
I won't use that piece of trash.
>>59462892
What makes you think I'm not checking it out already? Thanks, it seems to be what I wanted.
>you fucking piece of moe trash
+18 please.
Learn to use your words correctly.
>>
>>59462921
That's why I only compile after I've finished development.
>>
>>59462890
>>59462885
write this in haskell

open file
ignore first line
remove newlines at the end of lines
turn to lower case
split lines into words
print the second word of each line if it's longer than 2
close file
>>
>>59462961
λx.x+1 ?
>>
>>59462961
I can do it in OCaml if you want.
>>
>>59459366
liar
>>
>>59463102
No.
>>
>>59459366
More like JAVA!!!
>>
>>59463097
He said "lesser trash", not "complete trash".
>>
Opinions on Dr. racket?
>>
>>59463097
it's a python one liner any retard can do in minutes (or under a minute if sufficiently coffeed up)

>fast development
>>
>>59463646
Use emacs with geiser insteat but for intro stuff dr racket is fine.
>>
>>59463646
I don't like mixing square brackets with my parentheses.
>>
>>59463664
Stdlib is irrelevant for large projects.
>>
>>59463696
large projects are small in python

and there are ways to make the execution very fast
>>
>>59463715
large projects are small in lisp

and there are ways to make the execution very fast
>>
(for i 4)

is this a correct for loop in racket?
>>
File: VID_20170318_175144950.mp4.webm (2MB, 1920x1080px) Image search: [Google]
VID_20170318_175144950.mp4.webm
2MB, 1920x1080px
>>59459347
>What are you working on, /g/?
doing stuff. Just a little bit
>>
>>59463744
No. Why don't you try it yourself?
>>
>>59463768
>that finger
>that nail
eww anon pls...
>>
>>59463787
it's just fat, bruh. Nothing wrong with being fat.
>>
>>59463769
I'm checking the documentation.
>>
>>59463829
(for ([i 4]))
>>
>>59463859
Lisp is beautiful.
>>
>>59462890
Haskell has a REPL, so it can be interpreted. And Python is JIT compiled, not interpreted.
>>
>>59463873
that's not lisp though, racket and clojure uses those ugly [] but real lisp uses only ().
>>
>>59463768
Wow, that seems really useful, anon.
>>
Fact: OCaml programmers are the most powerful race in the world.
>>
File: no direction.jpg (151KB, 1072x597px) Image search: [Google]
no direction.jpg
151KB, 1072x597px
I've seen the basic resources on compilers and wikipedia but they're very theoretical (450 pages of theory, 50 of pseudocode). I look at compiler code and still don't get it. I think I'd need to be guided step-by-step through each line of a C compiler to get it (I want to make a C compiler but am to dumb). anything like this? Is this a lost cause?
>>
>>59464035
If by "powerful" you mean autistic...
>>
Spend about 3 hours trying to figure out if there was an efficient way to convert an internal image format into an OpenGL image when the low-level native converter premultiplies the color data when going internal -> GL, but interprets the data GL -> internal as non-premultiplied. Eventually I said fuck it and just decided to divide by the alpha in the fragment shader.
>>
rate my code:
(define (fibonaci a) (
cond
[(< a 1) 0]
[ else (+ a (fibonaci (- a 1)))]))

(define (check_fibo a) ( for ([i a]) (
begin
(display "| fibo: ")
(display i)
(display ":")
(display (fibonaci i)
) )))
>>
>>59462890
>Haskell is compiled
Wrong.
>snek is not
Wrong.
>so it can be interpreted
Correct.
>And Python is JIT compiled
Wrong.
>>
>>59464094
>I/O
Dropped.
>>
>>59464094
Reformatted it for you. Try to aim for something like this:
(define (fibonaci a)
(cond [(< a 1) 0]
[ else (+ a (fibonaci (- a 1)))]))

(define (check_fibo a)
(for ([i a])
(begin (display "| fibo: ")
(display i)
(display ":")
(display (fibonaci i)))))
>>
>>59464073
Start with something simple, like brainfuck-to-asm or BASIC-to-C, to get the basic idea of how compilers work. As simple as C is, it's still pretty complex for introduction to the concept of compilers.
>>
Isn't lazy evaluation simply the pedantic way to say "we're too retarded to implement dead code elimination"?
>>
>>59463743
>dead language
>fast development
pick one
>>
>>59464156
Development's so fast it's over before it even started.
>>
>>59464094
>lisp
dropped
>>
>>59464156
>>59464179
>>59464181
t. brainlet
>>
>>59464191
I have nothing against functional programming, but the parentheses are a pain in the ass
>>
>>59464242
L*sp is neither functional, nor functional.
>>
>>59464242
That's why paredit exists.
>>
>>59464267
Not all of us can be smart enough to understand Lisp. Shame too, because it is such a simple language.
>>
File: 1459707820968.png (381KB, 466x572px) Image search: [Google]
1459707820968.png
381KB, 466x572px
first for python.
>>
>>59464431
python is really slow
>>
File: e7.jpg (151KB, 640x360px) Image search: [Google]
e7.jpg
151KB, 640x360px
>>59464443
second for python
>>
>>59459347
first for rust
>>
>>59464242
You are dumb as shit if you think Lisp is about parentheses.

>>59464443
Unless you're writing kernels, or 3d games to run on a 286, speed of execution is insignificant compared to speed of development.
>>
>>59464482
>>59464431
>8 hours late
I guess Python and Rust are both really slow...
>>
>>59464297
I guess only the same kind of subhuman who can't understand it would actually use that garbage.
>>
File: crying.gif (184KB, 533x300px) Image search: [Google]
crying.gif
184KB, 533x300px
>>59464126
I did some introductory things. It has to be a C compiler
>>
>>59464510
Oh, so it "has" to. You're one of 'those' guys. I see. You can fuck off then.
>>
>>59464487
>about parentheses
what does it mean for a programming language to be "about" something?
>>
>>59464510
> It has to be a C compiler
Why wouldn't you try something aesier, like Algol or BCPL?
And then you build a C compilerin Algol/BCPL.
>>
File: 27786.jpg (29KB, 400x400px) Image search: [Google]
27786.jpg
29KB, 400x400px
>>59464482
muh communism
>>
>>59464510
Is this for a class or something? A C compiler written by one person will take months to get to the point where it can even compile anything, and it will inevitably be inefficient and unreliable compared to mainstream compilers. Look at TCC, it's had like years of development and there's still some things it doesn't handle well.

>>59464537
Now you're getting it.
>>
File: 1489280954604.jpg (28KB, 318x394px) Image search: [Google]
1489280954604.jpg
28KB, 318x394px
>>59464555
>tatoos
Absolutely disgusting
I wish I had a pack of Christ-chan right now
>>
>>59464555
>communism
Rust wasn't created by RMS Marx Stalin.
>>
What's the simplest way to test a language for Turing completeness?
>>
>>59464603
brainfuck compiler
>>
Working on a thing and i need help.

doStuff fills textblock and lisblock with values and i can read them without problems, but whenever i try to access them from main, i get an error.

main(){
...
char* memblock;
char* textblock;
int* listblock;
...
memblock = new char[x];
...
doStuff(memblock, textblock, listblock);
...
}

void doStuff(const char*, char* textblock, int* listblock){
...
textblock = new char[y];
listblock = new int[z];
...
}
>>
>>59464612
No, it would need to be an interpreter.
>>
How do I create a new array by ommiting a result? Example: I have an array with each element having "ID: value|name: value|pass: value"
I want to create a new array without the ID, basically splitting it by |, and then sort it by name. Do I have to create a new array for that or can I sort directly?
>>
>>59464624
Language?
>>
>>59464544
I mean written in C, sure it could be C-to-Algol. I guess I gotta start with that.
>>59464567
Almost every compiler of a major language is written in C.
>>
When do you start using a lot of math in programming? The only time I really used it was when I was doing graphics and trying to move an object around a world and keep its forward direction and I needed some shit with sins and cosines
>>
>>59459496
Is this Maria?
>>
Real talk time.

Python is slow garbage that makes the programmer keep track of everything in their head.

Lisp is obsolete now that static languages have caught up. The people who insist on using lisp are angry people who think they're sticking it to the man, and people who can't or won't learn a more useful language.
>>
>>59464653
>useful language
This was a good post until this retardation. Deleted it from my memory.
>>
>>59464644
C#, but it shouldn't matter.
>>
>>59464591
Rust is created by nu commies.
>>
>>59464612
I'm not sure how I would write it in this language yet. Anything simpler?
>>
>>59464603
Construct a turing machine for it.
>>
>>59464672
It's a representation of Turing machine.
What can be simpler?
>>
>>59464661
Compilers can actually check your shit in static languages and tell you when you've fucked up. You don't have to write a milliard tests or put the code into production to discover simple errors in the code.
>>
>>59464653
>static languages
Dropped.
>>
>>59464690
Are you handicapped? Where did I even imply that I disagree?
>>
>>59461837
reverse(begin(list), end(list))
>>
>>59464703
When you wrote that the statement that modern static languages are more useful than lisp was retardation.
>>
File: file.png (392KB, 397x549px) Image search: [Google]
file.png
392KB, 397x549px
>>59462598
template <typename T, size_t N, size_t M>
class Matrix
{
std::array<T, N * M> m{};
};


Then just convert between 2D and 1D indice.
>>
>>59464735
It makes no sense to say that a language is objectively either useful or useless.
>>
>>59464650
No, it was just a random game board image on Google.
>>
New thread:

>>59464779
>>59464779
>>59464779
>>
>>59464750
templatizing the size is much less flexible than passing it via constructor during runtime
>>
>>59461237
I learnt c++ without prior C knowledge.
>>
>reading random Javascript code
render(props, state) {
let time = new Date(state.time).toLocaleTimeString();
return <span>{ time }</span>;
}

>they use let practically everywhere
>as if var doesn't exist anymore

There must be some nazi style guide that refuses var. fucking hipster coders
Thread posts: 316
Thread images: 47


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.