/dpt/ - Daily Programming Thread

What are you working in, Sup Forums?

Old thread:

Other urls found in this thread:

theguardian.com/technology/2017/sep/21/coding-education-teaching-silicon-valley-wages?CMP=share_btn_fb
tutorialspoint.com/c_standard_library/c_function_fabs.htm
stackoverflow.com/questions/25995272/how-to-delete-dynamically-created-buttons
docs.microsoft.com/en-us/dotnet/framework/winforms/controls/how-to-add-to-or-remove-from-a-collection-of-controls-at-run-time
dpaste.com/0SVPF9Q
twitter.com/NSFWRedditVideo

theguardian.com/technology/2017/sep/21/coding-education-teaching-silicon-valley-wages?CMP=share_btn_fb

>Tech's push to teach coding isn't about kids' success – it's about cutting wages

>Today’s hi-tech wages threaten Silicon Valley’s bottom line. What better way to drive down coders’ pay than by investing in a new generation of cheap labor?

I'm sticking it to them by only usin languages nobody else does

Fuck you! You won't make a dime off me!

Anyone know where I can find some shell exercises

>?CMP=share_btn_fb
Wipe tracking off your urls.

>fb
Eat shit, faggot.

What are some /dpt/ approved text editors?

What's wrong with singing up, I don't get it

gedit, fag

Small guessing game project for my java class.

I want this function to also work if n is negative, so that when a negative n is put in, it converts to a positive and and it continues the program. I would assume that it might involve absolute functions but that sounds tedious. I think I need to create another if statement regarding negative values.
double my_cbrt_2(double n)
{
double result = 1;

if (n > 1.55)
{
while (n > 1.55)
{
n /= pow((9.0 / 8.0), 3);
result *= 9.0 / 8.0;
}
}
else if (n < 1.05)
{
while (n < 1.05)
{
n *= (9.0 / 8.0);
result /= pow((9.0 / 8.0), 3);
}
}
else if (n = 0) {
return 0;
}

return result * my_cbrt_1(n);
}

noob java question

when i make an object & and it to an arraylist like this


catArrayList.add(new cat(name,color,cute));

what is the reference name for that object? like if i wanted to change the name or color later, how would i target it

vi, emacs

Thanks

n = n < 0 ? -n : n;?

is this bait?

I hope it's your homework.

Agda, Coq, or Idris?

C++ is the only language that matters.

Is this for me I just don't want to sign

I'm scared ok

Feeling the heat of Rust, Bjarne?

Programming was invented by the jews to keep you enslaved to a monitor your entire life. Wake up, sheeple.

Just to say I managed to "fix" my error by creating separate packages for each .java files in the project. I'm not sure if this is the correct fix, but it worked.

Programming from a text editor + terminal all I had to do was keep the files in the same folder, and call the 'class' in each .java file to run it. No matter if they're all in the same folder.

I guess for some reason eclipse didn't allow that.
(they shared the same name, i know, but terminal never gave me problems so I didn't expect eclipse to)

See

? I don't really care about some freshman's poor understanding of a tool.

Are you seriously going to defend C++'s string/range manipulation?

pass n as an argument to fabs()

tutorialspoint.com/c_standard_library/c_function_fabs.htm

I think you need to learn what you're even talking about before you throw out opinions. Maybe next semester, kiddo.

>doesnt understand the guys complaint so he cant respond
>calls him kiddo instead because he has no other response

simply epic

catArrayList.get(number)

I don't argue with retards, I laugh at them.

well obviously. my question was more about using reflection to get the object by the objects variables, but ive found a good source now so ignore that

sorry but anyone who thinks c++ is a good language is the retard here

even c# is better

What am I talking about?

Blind fanboyism isn't going to save you from your embarrassment

Is it because laughing is more fun or it has deeper reasons?

I love declarative programming

whats wrong with am retard, need explaining.

>whats wrong with
It's a one-liner in modern languages. C++20 might get ranges though

if theres one thing rust did right, its the more functional-ish standard library.

c++ avoided functional style stuff a lot, and are now only bringing it with ranges.

That's because Rust is influenced by Ruby's iterators and ranges.

Rust has good ideas like ADTs, patterns, ranges and lazy iterators.
And then it absolutely fucked it up with shitty trait based generics and borrow checker principles

>language wars

Found the only thing worse than a retard - a Pajeet.

>And then it absolutely fucked it up with shitty trait based generics and borrow checker principles
t. programlet

>that transparency
gross.

Whats wrong with traits? Borrow checker is the necessary evil of Rustlang, wouldn't have a reason to exist without it.

Hey so any of you /dpt/ folks familiar with crossover job finding site?
I have to a project there and I am not sure it is worth my time.

its good for reading/copying code from the internet while writing.

That is a retarded reason.

your continued existence is for a retarded reason

traits encourage functional programing which is against superior object oriented programing

Is there a way to concatenate 2 strings and add a space to them automatically? In java.

why not just concatenate a space between them

No. Java cannot do this.
Sorry.

What's that, you wrote a computer program, made a little website, you uploaded some videos to Youtube? Well, let me take this opportunity to congratulate you, the monkey learned a trick. Look at you, uploading comments. You're already spewing your vile filth all over the computer, huh? Congratulations! You must have an IQ in the double digits! Here's a little piece of advice. The next time you're gonna unload your jealousies and inadequacies online, here's a little piece of advice. Here's a little piece of advice, slick. Next time you're gonna go on the computer (mommy and daddy bought you a new computer!), you're going to unload your jealousy and inadequacies on somebody else, on a stranger? Just make sure you don't pick Sam Geno, the son of the Papa Geno Pizza empire. I've bought people like you. I've destroyed people like you. It's nothing for me to call up my father, and have every pizza jockey in the nation have a photo of you, right above their oven. Thinking about you, my personal army of pizza makers.

They'll put sauce on you. They'll lay you out. Swing you around in the air just like in the old movies. Then they'll destroy you. Piece by piece. Piece by delicious piece. Cheesy piece by cheesy crusty piece. They'll destroy you.

That's option one. Option two is you can apologize to me. Just say you're sorry. Takes a big man to apologize, don't it? Humble yourself before a god, a pizza god?
Anyway. That's about it. Go fuck yourself.

string1 + ' ' + string2

You need to create a SpaceInsertingStringConcatenationFactoryBean. It should be straightforward to do.

xD

didn't read

Don't forget to distribute it across the network. Can't have your application crashing just because of a critical hardware failure.

Wasn't Bjarne compiling some kind of modern C++ guidelines? I seem to recall seeing something like that like a year ago.

Arrays.stream(new String[]{string1, string2}).collect(Collectors.joining(" "));

But traits are essentially interfaces and you can even do dynamic dispatch with trait objects.

>a year ago
>C++

Probably still compiling

how to utilize this? major() { cat /dev/urandom | hexdump -v -e '/1 "%u\n"' | awk '{ split("0,2,4,5,7,9,11,12",a,","); for (i = 0; i < 1; i+= 0.00001) printf("%08X\n", 100*sin(1382*exp((a[$1 % 8]/12)*log(2))*i)) }' | xxd -r -p | aplay -c 2 -f S32_LE -r 16000 }

They're superior to Java-style interfaces because you can use them to add new functionality to existing types.

Of course they're better, but makes no sense.

Post gone or smth
Where are those excercises? I may find them useful

they're not getting absorbed into high paying jobs because memorizing syntax doesn't make you a better problem solver

1. open terminal
2. type "major"

lmao

Alright, dumb question but I can find a proper answer anywhere.
How do you initialize arrays in C using the GNU style guide? I currently have it like pic related (don't want to figure out how to copy and paste out of vim atm) and I'm not sure if that's right.

Learn the fucking alphabet.

>capital # lowercase
>not capital lowercase #
Absolute heresy, on top of you forgetting letters

Shit, i forgot the D goes on your mom later

Whoops.

Nn

for got the N retard

just declare the array then add the char programatically using ascii ffs

how about you stop being a monkey and read about ascii in C and use a loop for this

>GNU style

>not using look up tables

plebs out

Why use an array at all? Just use the functions you'd use to populate the array.

Guys please

Will do.

then generate the lookup table with a python script, don't type it all out

>GNU style
isnt that like
char characters[59] =
{
'A', 'B', 'C', 'D',....
....
'v', 'w', 'x', 'y', 'z'
};

>don't type it all out
>telling me how to live my life

Writing an entire script or typing 60 characters i wonder which is easier

void main()
{
import std.stdio : writeln;
import std.ascii : letters, digits;
auto abc = letters;
auto nums = digits;
abc.writeln;
nums.writeln;
}


ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
0123456789

writing the script, but seeing you can't even count i bet it'd be easier to type it all out

>tfw no shell exercises

in python this is just
import string
print (string.ascii_letters)
print (string.digits)

Im a little confused about adding and deleting dynamically created buttons with c#.
>stackoverflow.com/questions/25995272/how-to-delete-dynamically-created-buttons
Says I can just delete it. But
>docs.microsoft.com/en-us/dotnet/framework/winforms/controls/how-to-add-to-or-remove-from-a-collection-of-controls-at-run-time
Says I have to subtract the event handler, remove it, then dispose of it.

the point is to generate something you can copy and paste into the source in the form 'A, 'B', ...

test post please ignore. For some reason I can post in any thread on any board, but when I try to post my code for help on this thread the post instantly says "connection error"

Can you manipulate them at all if need be?

Could someone help me with my noob question? I'm at my wits end trying to figure out this code. It works as I'd hoped except for cases where I use the number 9. For some reason any number with a 9 digit throws the entire thing out of whack. I've used online compilers and they also fuck up when there's a 9. It fucks up in different and unexpected ways for different compilers, which is confusing me. For example, using the one i am, entering a number like "999" ends up incrementing 1 and 0. Using a printf call to check the value shows that the value returned from "999/10" is 100, and then 10, adding 2 0's and no 9's to the occurrences array. Using an online compiler, 999/10 properly gives 99 and 99/10 properly gives 9, but then it prints the value in occurrences[9] as '9', even though it should've only incremented 3 times. I'm sure it's something stupid but I can't seem to pinpoint the issue.

Dpaste because every time I try to post it using code tags my post fails with a connection error.

dpaste.com/0SVPF9Q

sure
ass = list(string.ascii_letters)

oh, well
import std.ascii : letters, digits;
import std.stdio : writeln;
letters.writeln;
digits.writeln;


is also possible, i just like variables.

Anyone have an idea. On how to output each letter of a word with an asterisk between each letter in java? Super noob at this. Can't figure it out.