/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

github.com/YSakhno/nanorc
csrc.nist.gov/publications/fips/fips197/fips-197.pdf
twitter.com/AnonBabble

FIRST FOR EMACS

GCC 7 WHEN?

NANO STRONK
FUCK EMACS

Artificial Intelligence is trash.

>tfw superiour syntax highlighting in nano
github.com/YSakhno/nanorc

Learning D. I've finished 13% of the book (760 pages).

Seems like I should revise the array chapter.
>Strings have no slices
>indexOf returns long
>can't implicitly convert a string to char[]
import std.stdio;
import std.string;

void main()
{
write("Enter your string: ");
string str = strip(readln());
write("\nNow enter what character you want to the string to cut by: ");
char cutoff_char;
readf(" %s", &cutoff_char);

long first_index = indexOf(str, cutoff_char);
long last_index = lastIndexOf(str, cutoff_char);

writeln(str[first_index .. last_index+1]);

}

$ ldc2 test.d && ./test
Enter your string: sdjlfegjkh lkc sklurlka flkjsdl;iu es;ek'

Now enter what character you want to the string to cut by: df
djlfegjkh lkc sklurlka flkjsd

csrc.nist.gov/publications/fips/fips197/fips-197.pdf

This is fucking bullshit how can anyone manage to understand this without any help

>Learning D.
Good man. D is the language of the future. Anything you want to do in a program, you can do in D. It's even getting the overrated safety features that make everyone praise Rust. You can't go wrong.

I don't dislike Rust. D is just easy to use.

You should dislike Rust. But more importantly you like D.

Why are you so mad about it?

>You should dislike Rust.
I found no reason to. I'm not using it because I gave up on it, it's insanely complex in some parts.

In anyways it probably doesn't matter since it's the software you produce that counts.

That's the point. Rust is antithetical to producing software. Nobody has ever shipped a program made in Rust.

I've implemented some parts of it but the english isn't even written in english, no one can fucking understand anything this paper is saying its just an extremely condensed piece of information not a learning guide, and there are no learning guides online.

True or not, why are you bringing Rust up? I was talking about D,

I was also talking about D. Maybe Rust is just so poisonous that it makes people talk about it when they never wanted to.

Learn UFCS, it can make code look cleaner, particularly on the line where you're reading the string in

red pill me on Python, guys
will it make me love programming again?

i wish someone would just write my parsers and ast for me that shit is boring af
I just wanna start my type checker and code generation

>Uniform Function Call Syntax (UFCS) or sometimes Universal Function Call Syntax is a programming language feature in D, Rust[1] and Nim that allows any function to be called using the syntax for method calls (as in object-oriented programming), by using the receiver as the first parameter, and the given arguments as the remaining parameters.
Nice. Thanks user
import std.stdio;
import std.string;

void main()
{
write("Enter your string: ");
string str = readln().strip(); //UCFS in action
write("\nNow enter what character you want to the string to cut by: ");
char cutoff_char;
readf(" %s", &cutoff_char);

long first_index = indexOf(str, cutoff_char);
long last_index = lastIndexOf(str, cutoff_char);

writeln(str[first_index .. last_index+1]);

}

No, but Lisp will.

>will it make me love programming again?
What made you stop?

You might want to take a look at Nim, user

yfw it's literally just a shitty pipe operator :^)

"Enter your string: ".writeln();

It's p. nice
>shitty
No

can't implement UFCS yourself
btw why is every captcha I get something involving "CALLE"

ayylmao I love pipes.

What about the functions that take multiple arguments then? Like readf()?
import std.stdio;
import std.string;

void main()
{
"Enter your string: ".write();
string str = readln().strip();
"Now enter what character you want to the string to cut by: ".write();
char cutoff_char;
readf(" %s", &cutoff_char);

long first_index = indexOf(str, cutoff_char);
long last_index = lastIndexOf(str, cutoff_char);

writeln(str[first_index .. last_index+1]);

}

Started going through K&R again but should I learn C if I've still got tons I could learn in Python?

I think I'm at an intermediate-advanced level with Python.

C++ has proposed UCFS in the 2016 proposal

long first_index = str.indexOf(cutoff_char);
Only works with the first argument
Also don't abuse it, I was having a giggle with the whole "...".writeln() thing
It's nice for chaining shit together tho

Depends. What do you want to do? If you like embedded system and shit like that working with Adrino or Raspberry Pi, yeah go ahead and learn C. If you are just going to do software work, C++ is more up your alley. Beside if you are doing programming as a hobby, you should just experiment with all types of languages and see which you like. Do C for a week. Switch to C++ the next. C# the next. See which one you like the best.

Will putting stuff on my Github like porn rippers and tools that notify me when targeted accounts make posts on social media immediately turn employers away?

I had a similar problem. I just wanted to know how to rasterize a bezier.

No. Go for it user

Who the fuck cares. Make it a video ripper.

(((struct)))

>rasterize a bezier
My problem is I just want to make it werk.

Fuck it time to use a library, I'm fucking done trying to reinvent the wheel

Are you by any chance an idiot? Bezier is a set of extremely basic cubic splines between adjacent points, what's so confusing about it? Once you have one spline figured out the others are extremely analogous.

I ended up making it jest-werk with De Casteljau's algorithm & Bresenham's line drawing algorithm.

>Are you by any chance an idiot?

Yes.

How old are people here? is this thread mostly professional programmers or people that want to learn?

Mostly faggots who can't code and people shitposting about their favorite language

I always thought this thread would consist of 40+ year old men with functional autism working for anoonimiss

If you see a pro-rust post, assume they are about 15. Everyone else is a toss up.

>rust is developed by 15 year olds

dumbfuck

At least you're honest. Any specific questions?

Does anyone else fantasize about fucking all the lisp femboys just to display your languages dominance over them?

I... I can't be the only one

back to /o/ turd

What? Did you get buttblasted by a lisper or something?

Is it possible to force install a library through a python script if the person who runs the script does not have the library installed? what would the command me

okay am I retarded?

I'm trying to step through this 2D array and initialize each element.

for( Cell[] cellRow : theCells ) {
for( Cell cell : cellRow ) {
cell = new Cell();
}
}


It's not working. What the fuck am I doing wrong?

Also, I'm getting an unused warning for cell. It's clearly being assigned a new instance goddammit!

n steam desktop authentication made in electron

muh cross platform

>rust developers post on Sup Forums
It's against they code of conduct.

Are you implying the rust developers are shitposting about rust on here? If that's true, that's really fucking embarrassing for them.

No, because I already solved the problem.

Turn your script into an executable.

doesn't even look that bad bro. one dedicated night SLOWLY reading through it, maybe using a pencil and paper to take notes, and you can probably understand most of it.

Mozilla got a really good deal on recently unemployed Correct the Record workers. It's not the actual devs. Unfortunately the workers were really bad as evidenced by losing to a reality tv star who ran as a joke and desperately tried to sabotage himself when the joke backfired. So now they're here shitpost shilling Rust to a bunch of dudes who can't write fizz buzz. How is Rust going to make the anime girl in my wall paper more kawaii?

never seen a language rustle so many jimmies. so much ass pain over Rust. jesus. I don't even get what's so horrible about it.

>Mad C toddler angry about Rust with literally 0 context
Who knew.

Hourly reminder that
C stands for cancer
C stands of communism
C is crime
and
C is for cucks

Can't make this shit up

To hard for our local C fizzbuzzer

>when you don't actually get anything done in Rust so you spend your days shitposting on /dpt/ instead

D fag here. I wonder why "some" people are so mad about Rust. I liked it and it was pretty nice. However it was pretty complex once you go down the road. Lack of books doesn't help either

How many fizzbuzz have you made, C pajeet?

I don't use C

You don't use any language

Nope
The Rustfags just came in here one day and started shitting the thread up

Wat? I mean cant I go like:

import os
if (!os./some_module/):
pip install /some_module/

?

How many of you have actually read SICP?

Yes I do

All programming languages are just Lisp in disguise.

Aren't you that idiot who approached me with his hateboner against rust since the beginning in this thread? At least this user here contributed you are just here to announce that you hate Rust.

Is google paying shills against mozilla these days?

Sure you do.

Ask yourself what are you trying to achieve. If you are servicing retards turn it to executable. If you are dealing with people who know what they are doing just tell them to install X module.

I don't dislike Rust either, just this fag who doesn't actually program in Rust but spends his days shitposting on /dpt/

>Turn it into an executable
Using py2exe or something? Is there a standard lib that lets me turn shit into an exe?

If you are not, his "counterpart" is not any better.

pyinstaller
cx_Freeze
py2exe

who the fuck uses nano?

I bet it's mostly guys who feel superior because they're not going to take part in the great emacs vs. vim debate.

Can anyone tell me why this exception doesn't work?

Rust or Nim or Go?

Go

Should I be using Python 2 or 3 in 2017?

Neither, you should be using Go.

What is your input to number and why are you expecting an error? NameError happens when a variable is not found in the global or local namespace.

3. There is no reason to learn 2.

if you are pajeet working on google

>3. There is no reason to learn 2.
depends on the industry, most existing projects still use 2. so you could learn 3 to shitpost in /dpt/ while you ll be forced to write 2 in prod

input to number should be a number, i'm expecting a ValueError if someone entered collatz(b) instead of entering a number, but ValueError didn't work so i changed it to NameError

True. But I am speaking from the point of view of a hobbyist or someone looking to try programming. The division between 2 and 3 is one of the reasons I dislike Python.

The correct exception should be ValueError. What happens when you use ValueError and input b?

Alright I figured out what is wrong with your code.

NameError occurs when you try to int(b) because b not defined.
ValueError occurs when you try to int('b') because b is not an integer.

So put both exceptions into your code unless you can account for one of those situations not happening

Is there a python command to set up the default terminal resolution? Would like it to set it a little bigger so my logo that prints can be seen

Rust if you can withstand complexity

How do I install PIL or Pillow in Python 3 on Windows with MobaXTerm?

I already tried the python3 -m pip install Pillow workaround as well as just python3 -m pip install PIL and I get an error message saying /bin/python3: No module named pip.

Am I just entering the commands wrong or is there something more I have to do to install these libraries on Windows with MobaXTerm?

is anyone here familiar with CC65?

is using the C compiler with nothing but asm directives a viable solution? that way i'd get slightly higher level assembly for the C64

Have you tried killing yourself?

I want to make a website that has very similar code to a chat client+server, but I have no idea where to begin.

What do?

Lmfao what did you just say to me kid?

What is your programming experience?

The things I know that may be relevant are HTML, Javascript, Java, and PHP.