/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

learnyousomeerlang.com/content
chimera.labs.oreilly.com/books/1234000001642/index.html
elixir-lang.org/learning.html
fsharp.org/learn
en.wikibooks.org/wiki/Haskell
0x0.st/pbp.pdf
gigamonkeys.com/book
cs.cmu.edu/~dst/LispBook/book.pdf
braveclojure.com/foreword/
realworldocaml.org/
ocaml.org/learn/tutorials/
guide.elm-lang.org/
purescript.org/learn/
cs.cmu.edu/~rwh/pfpl.html
ccs.neu.edu/home/matthias/HtDP2e/
strawpoll.me/12023125
msfn.org/board/topic/176300-win2k-kernel32-rewrite-progress/).
youtube.com/watch?v=9K_Lcf9g_C4
phygon.itch.io/vr-portal-demo
lmgtfy.com/?iie=1&q=How do I read a character from a file C
twitter.com/NSFWRedditVideo

Thank you for using an anime image

how much academic abstraction is really necessary to become a competent programmer?

Functional programming.
Last /fpt/: Resources:
>Erlang
learnyousomeerlang.com/content
>>Elixir
chimera.labs.oreilly.com/books/1234000001642/index.html
elixir-lang.org/learning.html
>F#
fsharp.org/learn
>Haskell
en.wikibooks.org/wiki/Haskell
0x0.st/pbp.pdf
>Lisps
>>Common Lisp
gigamonkeys.com/book
cs.cmu.edu/~dst/LispBook/book.pdf
Paul Graham's ANSI Common Lisp
On Lisp
Common Lisp Recipes
Land of Lisp
>>Clojure
braveclojure.com/foreword/
The joy of Clojure
>>Scheme
Little Schemer
The Seasoned Schemer
The Scheme Programming Language by Kent Dybvig
Realm of Racket
Lisp in Small Pieces
>OCaml
realworldocaml.org/
ocaml.org/learn/tutorials/
>Scala
Functional Programming in Scala (Chiusano and Bjarnason)
Atomic Scala (Eckel and Marsh)
Programming Scala (Wampler and Payne)
Programming in Scala (Odersky, Spoon and Venners)
>Web languages
>>Elm
guide.elm-lang.org/
>>PureScript
purescript.org/learn/

>Theory
SICP
Essentials of Programming Languages
Practical Foundations for Programming Languages: cs.cmu.edu/~rwh/pfpl.html
How to Design Programs: ccs.neu.edu/home/matthias/HtDP2e/
Art of the Propagator
An Introduction to Functional Programming Through Lambda Calculus

C# is based.

>mfw i've read how much academic masturbation is really necessary to become a competent programmer
It's not far from truth, though.

I was looking some languages hashing function and it was
long hash(char *string, int start, int len)
{
int i;
long result = 5381;

for( i = start; i < len; i++ ) {
result += (result

int main() {
char *c = (char*)0;
while(1) { *(c++) = 1; }
}


how come this crashes my pc when i run it? :3

ikr i hate how these faggots only post cpp in here

dereferencing null pointer

You're trying to read address 0
The OS doesn't like that

You can be a competent programmer without being an expert at reducing duplication and writing reusable code, but it helps.

Could learning any of these languages actually get you a job tho?

pro-level
#include
#undef get16bits
#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
|| defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
#define get16bits(d) (*((const uint16_t *) (d)))
#endif

#if !defined (get16bits)
#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) = 2;

for (;len > 0; len--) {
hash += get16bits (data);
tmp = (get16bits (data+2) 11;
}

switch (rem) {
case 3: hash += get16bits (data);
hash ^= hash 11;
break;
case 2: hash += get16bits (data);
hash ^= hash > 17;
break;
case 1: hash += (signed char)*data;
hash ^= hash > 1;
}

hash ^= hash > 5;
hash ^= hash > 17;
hash ^= hash > 6;

return hash;
}

There are a fuckton of C# jobs in the UK.

C# is one of the most in-demand languages here, so yeah.

WHY is there no /dpt/ IRC channel?

How is it that these threads are so active, but nobody has thought to make an IRC channel for quick questions?

If one doesn't already exist, how about #Sup Forumsdpt on Rizon?

/dpt/ itself is pretty quick

FP is quite big in fintech

>but nobody has thought to make an IRC channel for quick questions?
What makes you think that there has never been an IRC channel?

pÄminnelse

Text editor poll continues
strawpoll.me/12023125

>people unironically use anything other than vim or emacs

>people unironically use vim or emacs

c++ sucks so fucking much that linus didn't even write his kernel in it

Why would we need an IRC? Sup Forums works fine, and I can post pictures. And there are all kinds of other sites if I want to share programs or other shit.

C++ sucked so fucking much in 1990 that linus didn't even write his kernel in it
fixed

i use acme. sure, i had to buy a three button mouse, but it only cost 15 bucks and is worth it for muh button chording

there is #Sup Forumssicp on rizon

>using a mouse while editing

c++ is a pdp-11 assembler that thinks it's an object system

A PDP-11 is a Turing machine, no?

>worth it for muh button chording
also
>says that guy that's never even tried acme

kys my dyde

C++ is what you get when a C-occupied region is suddenly raped and pillaged by roaming Simulas.

Then over the course of the next few decades every single other paradigm wanders by and adds its bastard offspring to the already-polluted gene pool.

If it requires a mouse to be productive then I don't want to try it.

>my dyde

>people actually use Atom for anything
Jesus fucking Christ.

it's one of those lambdas i've been hearing so much about

it utilizes a 3 button mouse to allow for chording and makes it more productive than using a keyboard alone

don't knock it till you've tried it. nothing personnel, kid

Cute anime girl programming.

It's not more productive than a keyboard alone because - and follow closely here - you have to keep moving your hand between the mouse and the keyboard.

If it's not Yuki, I'm not interested.

you have literally never used acme so stfu you don't know what you're talking about

apparently you've never jacked off either since you apparently can't type effectively with one hand.

I use keyboard-only interfaces, but...

My laptop has the three mouse buttons just below the space bar, and the pad below that. I can quite easily use the 'mouse' with my thumbs while typing.

Congratulations. Some of us have real computers, though.

I type much faster with two hands than with one, as do most people.

cringe

then how do you whack it???
checkmate, atheists

>Congratulations. Some of us have real computers, though.
I've got four, bra. Not counting things like Pis/tablets/servers.

>caring about anime
super cringe

Never said I don't. It's just that I have never needed to use an editor while I "whack it".

is it possible to make an open source multiplayer game fairly hack resistant?

if someone knows how the game talks to the server, they can do anything they want.

No, they can't. As long as the server itself is secure and authoritative they can't do shit except send unrealistic inputs (like a turbo button).

people would be able to make their own clients which could have transparent walls and shit like that

Do a sight check, and if the player can't be seen, don't send updates.

i want to work on the linux kernel, but the learning curve is like the great plains.

Yep, I've fucking lost it. First Slackware, now this. This is why WAMPVOIP will never be ready for release.

Flat? It's kind of the opposite.

>What are you working on, Sup Forums?
I just finished the basics of the TUI (using ncurses) for my animu program.
The code is a fucking mess.

Now I need to work on getting my program to talk to rutorrent.

sorry, i'm autistic about the learning curve meme. think about it for a second. a learning curve "cliff" means you attain basically all there is to know in a short amount of time. a perfectly flat learning curve means you spend an infinite amount of time and learn precisely nothing.

This guy wins.

Yeah. The kernel is vast and unknowable.

can't tell if sarcastic. it's pretty intimidating starting from scratch nonetheless.

What are you doing?

I installed windows 2000.

For what purpose?

you wouldn't program a car

guess it's one step up from pounding rusty nails into my ballsack, i know what i'm doing next!

That horrible feeling called nostalgia and this(msfn.org/board/topic/176300-win2k-kernel32-rewrite-progress/).

I made a cute little front end for youtube-dl so that it downloads songs based on title and artist and finds the correct version based on length.

Might be a stupid question but how best to compile and run C++ code on Windows?

>on Linux
>install g++
>make .cpp file, compile with g++, run

This is how I do it on Linux but what about Windows?

>install msys2
>do same shit you would on Linux

>on Windows
>install cygwin/mingw
>make .cpp file, compile with cygwin/mingw g++, run

One thing I notice, is there any reason you are sending len as a parameter and not just using strlen(string)?

strlen is an O(n) operation. There's a good chance the caller already knows the length of the string so there's no sense in duplicating work.

This is C, after all.

>mfw I learned about keyboard macros in emacs

Is there a way to write programs that access those macros, taking a text file as input and outputting the result after running the macro C-u 0 times?

Microshit Visual Studio

I bet you could get emacs to do that.

emacs can do anything

except edit text

Posting this here because you guys helped me so much
I finally got a minimum viable demo out for my portal thing after figuring out the fucking projection matrix asshattery (fucking look at that thing, Unity can't even display it right. It has an oblique near plane)

youtube.com/watch?v=9K_Lcf9g_C4

If you have a vive you can demo it here

phygon.itch.io/vr-portal-demo

Are there any languages which don't allow use of the free store / heap / dynamic memory at all? Stack memory only, that is. A sort of allocationless world, free from the sins of our fathers.

Such a language would be massively gimped in terms of its usefulness.
Just write C or some shit, and then avoid malloc.

I absolutely agree with you, but I'm just wondering what can be done in a language like that. Surely it can do a base-level taste such as averaging two numbers, but how far can its wings stretch?

You'd be limited to any data structure the size of your stack.

Sure, you could use variable length arrays, but you'd be limited to 10MB per stack frame on a modern system with default settings.
On other platforms, even less.

Just use malloc.
You're not supposed to be using it outside of constructor functions anyway.

anime website

If the stack was infinite then it would be capable of anything, but then again an infinite stack is not really any better than the heap performance wise.

What you should strive for is to use malloc/free itself as little as possible, i.e. allocating large chunks that are then allocated from by your application using different methods, like stacks, pools, etc.

So is c++ really as sub-par as people say it is?

Because I'm in the process of learning it as a first language, hoping it'll help make learning higher-level languages relatively easier in the future.

What other languages can I learn that'll give me a thorough introduction to programming concepts, but be mainstream enough for marketability?

There's nothing innately wrong with C++ because it lets you write pure C and get away with it.

Learn C first and then pick and choose the C++ constructs you like, because it's poor practice to use all of them, and even Bjarne himself is attempting to strip the language down to a more manageable core because the feature creep has gotten so bad.

c#

>What other languages can I learn that'll give me a thorough introduction to programming concepts, but be mainstream enough for marketability?
Unsarcastically, Python. It's what MIT and others teach in their intro courses

>Slower than Jit'd scripting languages

Hahah

I learned C++ while first learning programming concepts like data structures.

I liked it a lot. It made sense to me. When I went to look at other languages they seemed so sloppy to me, in the sense that there were not nearly as many data typing restrictions. I think it's better to be disciplined first and then relax later.

But I'm not a programmer by trade so listen to others.

Learn C first, then C++/Java for marketability.

C will teach you about how computers work, pure functional languages will teach you about how abstraction works. All other languages are basically just mixtures of the two unless you count OOP, which is just its own shitty thing. But you'll still understand how to use it to approximate functional abstractions which is generally what happens anyways.

is also right, but the issue is that everyone and their mother uses their own flavour of C++ and C++ is so versatile that these flavours end up tasting quite different.

Can you fuckers actually help me out for once?
How do you acquire a char from a file in c using getc()?

with that attitude you can fuck right off

I want the text boards back.

Why do people complain about anime in this general when the functional retard are using it because it's their only way to attract an audience, as everyone did for the past 10 years here.

char c;
cin >> c;

How can you any sort of visual progress though.

fgetc

lmgtfy.com/?iie=1&q=How do I read a character from a file C