/dpt/ - Daily Programming Thread

Jack White
Jack White

christian programs only

old:
credforums.com/thread/56891261/technology

What are you working on god bless?

All urls found in this thread:

credforums.com/thread/56891261/technology
github.com/nick-gits/calcupy
archive.rebeccablacktech.com/g/thread/S56842194#p56842335
scala-lang.org/
credforums.com/thread/56885896/technology
tools.ietf.org/html/rfc1057#section-3
toptal.com/c-plus-plus/interview-questions
docs.gl/gl4/glBufferData
docs.gl/gl4/glBufferSubData
seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf
c2lang.org/
code.dlang.org/getting_started
benchmarksgame.alioth.debian.org/u64q/compare.php?lang=csharpcore&lang2=csharpllvm
benchmarksgame.alioth.debian.org/u64q/compare.php?lang=java&lang2=csharpllvm
ideone.com/t8L8Pn
docs.oracle.com/javase/7/docs/api/java/lang/String.html#constructor_summary
chrome.google.com/webstore/detail/slack-emoji-uploader/jfacjbibcobdehekkieokkloinlfdomg
youtube.com/watch?v=iSmkqocn0oQ
github.com/rui314/8cc
news.ycombinator.com/item?id=1803815
harmful.cat-v.org/software/andy_tanenbaum
pages.cs.wisc.edu/~remzi/OSTEP/
codingame.com/ide/582466342ac6944cd030506c22f5f68cf2376a4
benchmarksgame.alioth.debian.org/u64q/c.html
credforums.com/thread/56904235/technology
credforums.com/thread/56904236/technology

John King
John King

    string::size_type i = 0; 
while ((i < str.length()) && (isalnum(str[i]))) {++i;}

if (i < (str.length() - 1)) throw invalid_argument("string may only contain alphanumeric characters.");

This code refuses to throw an exception for one character strings, work for everything else though. Why is it doing this?

Joshua Watson
Joshua Watson

second for python

Parker Brooks
Parker Brooks

one character string:

i = 0
while i < 1 { ++i }
i = 1
if (i < (1 - 1)) throw
if (1 < 0) throw

Thomas Adams
Thomas Adams

if (std::find_if(str.begin(), str.end(), [](char c) {
return !::isalnum(c);
} != str.end())
throw invalid_argument("string may only contain alphanumeric characters.");

Brandon Martin
Brandon Martin

Woops, missed a paren there.

James Williams
James Williams

tfw I'll never have a qt plastic korean gf
;_;

Jeremiah Jenkins
Jeremiah Jenkins

std::not1(::isalnum)

Nicholas Nguyen
Nicholas Nguyen

becase

0 < 1-1
evaluates to false

Brody Powell
Brody Powell

Is anyone doing this and trying to win the 10k?

Robert Gray
Robert Gray

huh, never heard of that one before, gonna look it up

Evan Brooks
Evan Brooks

Actually doing anything productive is against my religion

Evan Perry
Evan Perry

Can anyone tell me if installing works for you with pip?

github.com/nick-gits/calcupy

pip install calcupy

if you could tell me any errors you get I would be very happy

Matthew Jones
Matthew Jones

Hey /dpt/,
I'm working on my resume currently and I was wondering what it takes to mark a language as "learned". I'm currently in university and have had about a year of experience in web development with a company, but I don't really consider myself proficient in any language.
If I've taken a course in a language and passed should I mark it as "learned"?

Also any resume tips?

Hudson Williams
Hudson Williams

When you can write a project in that language without googling everything

Aaron Watson
Aaron Watson

seffy~

Hunter Campbell
Hunter Campbell

That shit is fucking too hard for me.

Dylan Clark
Dylan Clark

idk what that means.

Dylan King
Dylan King

neither do i ;)

Julian Lewis
Julian Lewis

Uhhh, as an interviewer if I see it on your resume you best be able to code through the technical interview. A guy had javascript on his resume and I asked if he's proficient, long story short he wasn't.

Jose Turner
Jose Turner

Thoughts on Scala as a language?
Is it like python but useless?
Does it have any applications?

Brody Hall
Brody Hall

doing school work
have to follow oop
constantly second guessing myself because it feels like im being forced to be so ineffective
hardest part is trying to follow all the oop rules with the contradictory assignment instructions

am i retarded?

Jacob Allen
Jacob Allen

archive.rebeccablacktech.com/g/thread/S56842194#p56842335

Kayden Walker
Kayden Walker

If you're already second guessing OOP, then you might not be retarded

Eli King
Eli King

you best be able to code through the technical interview
entailing what?

Jonathan James
Jonathan James

that's one comment about it and it isn't very interesting

Nolan Miller
Nolan Miller

Solving problems involving arrays, matrices, graphs, tries.

Camden Brooks
Camden Brooks

scala-lang.org/
says all you need to know right here
"Object-Oriented Meets Functional"

it then goes on to lie

David Davis
David Davis

What's the purpose of remote procedure call?
And what the hell is a "call" in this context, like a function call?
I don't understand any of this WAMP/Autobahn stuff. Hep me.

Easton Cox
Easton Cox

why is my prof making me learn a meme language
is it because he wrote the book?

Noah Turner
Noah Turner

How do I get HR to call me back when I apply for entry level programming work?

I did that thing where you apply even if you don't have every single requirement and now I'm afraid I've been blacklisted.

I've applied to 20 places last month and not a single place sent me a rejection letter.

Austin Rodriguez
Austin Rodriguez

you don't even get the benefits of pure, clean, concise or error free code
and you have to manually write lots of type signatures with little inference
should've done a real language

Tyler Perez
Tyler Perez

is it because he wrote the book?
Yes do you have any idea how much extra income that is? Like $100 per student per book man.

John Turner
John Turner

Thanks guys, I just didn't want to seem as a knowitall marking down a language that I wasn't completely competent in.

Adam Green
Adam Green

What are some cs jobs for a recent cs grad. I know you guys meme about college kids but I gotta start somewhere

Charles Cook
Charles Cook

I have a function that takes a pixel's RGB values, stores them in reference parameters, and multiplies them by a different value (taking a unit vector from a pixel's RGB and multiplying each component by a scalar).

When I run the functions that do the unit vector calculation, they're correct (the result is a double), but when I multiply them by an integer, I get numbers like 1.06e-301 (arbitrarily close to zero)... What am I doing wrong? Here's a snippet of my code:

int returnNormalizedRGB(int colorToShift, int shift)
{
double pRed, pGreen, pBlue;
createUnitVectorFromPixel(colorToShift, pRed, pGreen, pBlue); //This part correctly gives a double based on the RGB values of the pixel
int shiftRed, shiftGreen, shiftBlue;
GBufferedImage::getRedGreenBlue(shift, shiftRed, shiftGreen, shiftBlue); //This function is part of another library that correctly extracts the RGB values of a pixel

double newRed = (pRed * shiftRed); //The part where everything goes to shit... These are almost always evaluated to a number incredibly close to zero
double newGrn = (pGreen*shiftGreen);
double newBlue= (pBlue * shiftBlue);
return -1;
}

Colton Diaz
Colton Diaz

Have you checked the shift values are right?

Anthony Wilson
Anthony Wilson

authors make $100 off of a $100 book
yeah nah, try $10

Aaron Nguyen
Aaron Nguyen

If they self publish and require it as part of their class, then yes, it's $100

Brody Anderson
Brody Anderson

Yes... Here's some sample output:

    cout << "BROWN = " << BROWN << "\n\t r=" << shiftRed << "\n\t pR=" << pRed << endl;
cout << "New Red: " << newRed << endl;

Ian Wood
Ian Wood

just do it your regular way then and when you're done just add blocks between significant areas and copy paste those blocks under new signatures. You can then make a class with those function names and just replace the blocks in main with the calls to your new functions...

Eli Wilson
Eli Wilson

what are the shift values like?
Other than that I have no idea

Luke Richardson
Luke Richardson

When should I use auto in C++?
Why should I not use auto every single time I declare and initialize datatypes?

Jackson Barnes
Jackson Barnes

why was strcpy_s created when strncpy already exists? the only difference between the two i can see is the order of arguments.

Jeremiah Williams
Jeremiah Williams

GBufferedImage::getRedGreenBlue(shift, shiftRed, shiftGreen, shiftBlue);

Does this function take references, or are you supposed to feed it pointers to shiftRed, shiftGreen, and shiftBlue?

Isaiah Phillips
Isaiah Phillips

This is probably your issue

Joseph Wilson
Joseph Wilson

Example: I'm using the color Brown (0xF4A460), so shiftRed = 244, shiftGreen =164 , shiftBlue = 96;

The doubles I'm getting are like this:
doubleRed = .5774, doubleBlue = .57735, doubleGreen = .5775.

Colton Ward
Colton Ward

The function signature is

void GBufferedImage::getRedGreenBlue(int rgb, int& red, int& green, int& blue)

and I'm passing in variables, not pointers, when I actually call the function... The function works, but I'm not sure if that's leading to some issues...

Kevin Thompson
Kevin Thompson

he thinks college textbooks only go to up $100

Liam Ross
Liam Ross

int&
Then why are you passing in ints you goober.

Wyatt Sanders
Wyatt Sanders

Alright, well why not cast these ints to doubles before you multiply and check the result?

Wouldn't hurt to see if it's some coercion that's doing the damage.

Easton Rivera
Easton Rivera

...I'm passing int variables... Isn't that the point of passing-by-reference?

It's late and I'm starting to lose any semblance of coherent thought

Jose Bailey
Jose Bailey

you cannot follow all oop rules at once, as some contradict each other

Daniel Kelly
Daniel Kelly

You're right. I'm the one who should go to bed. I was thinking in terms of C and that you had to pass an address in or something.

Oliver Powell
Oliver Powell

Here's the updated function:

int returnNormalizedRGB(int colorToShift, int shift)
{
double pRed, pGreen, pBlue;
createUnitVectorFromPixel(colorToShift, pRed, pGreen, pBlue); //This part correctly gives a double based on the RGB values of the pixel
int shiftRed, shiftGreen, shiftBlue;
GBufferedImage::getRedGreenBlue(shift, shiftRed, shiftGreen, shiftBlue); //This function is part of another library that correctly extracts the RGB values of a pixel

double newRed = (pRed * static_cast<double>(shiftRed)); //The part where everything goes to shit... These are almost always evaluated to a number incredibly close to zero
double newGrn = (pGreen*static_cast<double>(shiftGreen));
double newBlue= (pBlue * static_cast<double>(shiftBlue));
cout << "BROWN = " << BROWN << "\n\t r=" << shiftRed << "\n\t g= " << shiftGreen << "\n\t b = " << shiftBlue << endl;
cout << "\t\tNew Red: " << newRed << endl;
// int pixelAfterShift = (newRed << 16) + (newGrn << 8) + newBlue;

return colorToShift;
}

And attached is the output

Evan Flores
Evan Flores

Me from earlier credforums.com/thread/56885896/technology

I figured it out.
In the webm, the dots are my random 10 samples given to my by the kinect. The line is the Bezier curve I approximate. The convex hull box vertices are the control points I solved for. Finally, the red circle where the P3->P1 line intersects the Bezier curve is the apex.

I sampled random points along the curve between my start and end point. That let me build a system of equations where I could solve for my Bezier's control points. It's a fast matrix operation since these Bezier curves will always be quadratic but I think it can go to about quartic before it gets slow. Since we know every quadratic Bezier curve is also cubic, I solved for P3 by P3 = P0 + P2 - P1. The cool thing about Bezier curves is the geometric apex always appears at t = 0.5!

Lincoln Jenkins
Lincoln Jenkins

update: got Cargo working right on Windows + got a project started out. but Rust always makes me feel like I'm writing a bunch of boilerplate, so there's still a 50% chance I'll switch to something else. been meaning to try Frege, so that's probably my back-up language in this case

Adam Long
Adam Long

Is that shyrene

Alexander King
Alexander King

Coding vehicle simulation physics, for my 3D game in unity (i don't like unity physics), a spring for the suspensions

Im self-thaught and im stuck
-I've seen some physics formulas on internet, but they just fuck up my mind

So far i've made a script to change the distance between two points based on a force, it werks but...

-Don't know how to make bounce effect when changing force
-i can only distribuite the weight of the vehicle to the wheels accordingly
But not use other forces applied to the vehicle

It has been 2 days...

Luis Rogers
Luis Rogers

ofc
our game dev girl

Tyler Hernandez
Tyler Hernandez

I just learned that without libraries, doing any advanced math in C is torture. I spent all day trying to implement matrix inversion without precision loss for some really small numbers for multiple linear regression.

I just gave up trying to do it in C without libraries and decided to learn R.

Nicholas Russell
Nicholas Russell

Maybe you should learn how to do matrices on paper, you dumb shit.
Then you can write a function to automate it.

This is how math libraries are written.

David Lewis
David Lewis

Why do you have to be inflammatory, you cunt? I wouldn't hurt to show some sympathy at least for someone's troubles, you psychopath.

I can do matrix inversion with Gauss-Jordan elimination but I just can't keep the precision needed to get accurate numbers for calculations that result in numbers that have more than 17 digits of precision once I get to 4 unknown variables.

Sebastian Murphy
Sebastian Murphy

programming

Elijah Lee
Elijah Lee

/diy/catalog#s=ohm

In all seriousness, I did something like that once.. Except I made dresses out of them.

Daniel Green
Daniel Green

int main()
{
int age;

If ( age <= 20) ;

James Anderson
James Anderson

If

Michael James
Michael James

Is the quickest string reverse just to do a loop from the end of the char array to the beginning and concat each value from the array into a blank string?

Joshua Wood
Joshua Wood

If we're talking C, you could do it with a swap function and a single for loop, with a pointer pointing to the start of the string and another pointing at the end
If it's any other language, it'll probably have a reverse function

Thomas Morgan
Thomas Morgan

Is there a way to condense this two-sided switch into a single function? Its iteration is flipped if it's right-sided but I feel like since they're so similar they could be one

if (sidedness) {
for (int i = links.size() - 1; i > 0; i--) {
//Only search half at the entry depth
if (currentDepth == assistDepth && i < sizeLimit) {
break;
}
while (links.get(i).attr("abs:href").equals(url)) {
if (--i < 0) {
break;
}
}
pagesCrawled += recursiveCrawl(links.get(i).attr("abs:href"), currentDepth + 1, sidedness);
}
} //Left-handed search
else {
for (int i = 0; i < links.size(); i++) {
if (currentDepth == assistDepth && i > sizeLimit) {
break;
}
while (links.get(i).attr("abs:href").equals(url)) {
if (++i > sizeLimit) {
break;
}
}
pagesCrawled += recursiveCrawl(links.get(i).attr("abs:href"), currentDepth + 1, sidedness);
}
}

Alexander Reyes
Alexander Reyes

Writing a cue sheet parser.

Lincoln Foster
Lincoln Foster

try to write array in this familiar way
"missing : after property id"
Wowie Javascript
You sure are shit

Austin Lewis
Austin Lewis

What programming language is most japan
Ruby?

Camden Martinez
Camden Martinez

What's a book that will help me learn modern C++? I have a solid understanding of C, but I wanna know what's new in C++. (r/lvalues, namespaces, OOP, iostream)

Wyatt Ramirez
Wyatt Ramirez

installed in 2 seconds

Noah Clark
Noah Clark

int i = links.size() - 1; i > 0;

int i = 0; i < links.size();

Split these into variables. So for example

int start;
int limit
if (sideness) {
start = links.size();
limit = 0;
} else {
start = 0;
limit = links.size();
}
for (int i = start ; i < limit ; i++) {
...
}

Connor King
Connor King

/dpt/-chan, daisuki~

Accelerated C++

Gura

not using clojurescript

C is obsolete.

strcpy_s returns an error code and calls a callback procedure if there is an error.

What's the purpose of remote procedure call?
Providing a remote APIs which can be secret and closed source. It's evil and endanger our freedom (read Dr. Richard M. Stallman)

And what the hell is a "call" in this context, like a function call?
tools.ietf.org/html/rfc1057#section-3

Yes

toptal.com/c-plus-plus/interview-questions

MIT
Sorry, i only install GPL licensed softwares.

Please next time use an anime image.

Nicholas Jenkins
Nicholas Jenkins

Girls can't drive boats

Aaron Moore
Aaron Moore

using anything but AGPL3'd software
I hope you don't do this.

Gavin Robinson
Gavin Robinson

What famiar way? Try learning JavaScript syntax before complaining about it.

Js is shit though ofc

Luke Russell
Luke Russell

How the fuck do you learn how to compile C and C++ programs? It is such a chore compared to other languages

Bentley Gray
Bentley Gray

Your a retard.
{} are for objects, [] are for arrays.

Mason Butler
Mason Butler

Is

gcc -o prog prog.c

really that hard?

David Robinson
David Robinson

wrote a pretty big and complex lib months ago
realize I forgot to handle a specific corner case
have to rewrite 80% of the code from scratch because of that

Jacob Hughes
Jacob Hughes

And if you include other stuff you have written in the program it becomes a clusterfuck

Benjamin Nguyen
Benjamin Nguyen

gcc -O3 *.c

Cooper Flores
Cooper Flores

what are makefiles

Thomas Nguyen
Thomas Nguyen

Do you still not know what RAII is?

Wyatt Adams
Wyatt Adams

Do I have to use gl.bufferData for updating my vertex array?
There doesn't seem to be any guides covering cases where the vertex array updates, they always use matrix transformations on them for everything.

Jaxson Hill
Jaxson Hill

Write a Makefile.

Alexander James
Alexander James

I believe so yes, what else would you do?

Dylan Rogers
Dylan Rogers

Not sure if this belong here.
How do we build masks and how do we swap bytes/bits/triads?

Like, we need to swap last bytes, make abdc out of abcd. How is it done in computer arithmethics? Should it be done like ab00 and ff00? Is there any book?

Julian Ortiz
Julian Ortiz

Pajeet, my son. You are C# programmer now. You do not need to understand bytes.

Jacob Brooks
Jacob Brooks

Actually writing directly to an array?

Jonathan Reyes
Jonathan Reyes

I'm not even a programmer.

Connor Kelly
Connor Kelly

A buffer is an array right?

Hunter Myers
Hunter Myers

Yes, but it'd be great if I could use conventional array operations rather than recreating the buffer repeatedly.

Grayson Turner
Grayson Turner

So why don't you use swift, Cred Forums?

Charles Williams
Charles Williams

Because I don't develop for applel.

David Gomez
David Gomez

It's only interesting if you target the apple systems. The language itself doesn't bring anything new.

Hacker's Delight

where the vertex array update
From the client ? Bind the array with glBufferData during the setup then update it with glBufferSubData after the array has been modified.

docs.gl/gl4/glBufferData
docs.gl/gl4/glBufferSubData

If you modify the buffer only once per frame, use GL_STREAM_DRAW for the usage parameter of glBufferData.

For other techniques, see
seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf

c2lang.org/

A better C with a tool that generates makefile automatically.

Why ?

Alexander Gray
Alexander Gray

Look up boolean logic.

Julian Williams
Julian Williams

c2lang.org/
integrated build system
shame

Evan Peterson
Evan Peterson

Does anyone use this fucking interface for Java? We're learning Java at university first year and it seems quite poor.

It looks pretty decent for data visualization though.

Does anyone else struggle with the idea of moving shapes around etc? My course is very visual focused so far.

Charles Phillips
Charles Phillips

Why?
Literally the worst part about C/C++ is the fact that there are dozens of build systems and everyone just picks the he likes.

Makes code sharing on multiple platforms pure cancer.
It's the reason why I don't contribute to any C/C++ open source projects.
It's also the reason why I prefer not to use other people's libraries and just reinvent the wheel.

Ian Jenkins
Ian Jenkins

What programming field is easiest to get into? Which one can give me montly income as soon as possible, from 0 (I only know how to write simple function in python and maybe more if I still remember anything else) to a job?
I'm thinking web-dev can be pretty cozy but the thing that I dislike is using APIs a lot. Not because I ever made anything with them but because it seems I don't actually make anything.
Also, how do you learn to learn?

Aaron Peterson
Aaron Peterson

Are you using windows?

Anthony Smith
Anthony Smith

Question: In Python with some modules I seem to need to force some classes into the namespace rather then just calling them through the hierarchy. If I don't, I get Attribute Errors like so...

import matplotlib
ani = matplotlib.animation....

AttributeError: module 'matplotlib' has no attribute 'animation'

As opposed to the correct way which works...

import matplotlib.animation as Animation
ani = Animation....

Why is this?

Austin Morris
Austin Morris

Yes, I use multiple OSs. But that shouldn't matter.
Windows has a huge market share so it should be treated as a 1st tier platform.

Colton Cox
Colton Cox

What if my program isn't targeting the unwashed masses?

Austin Kelly
Austin Kelly

But that shouldn't matter.
If it doesn't matter then why was I able to guess it?

Christopher Rivera
Christopher Rivera

*tips fedora*

It does matter, but it shouldn't matter.

Colton Reyes
Colton Reyes

checked

Eli Morgan
Eli Morgan

It does matter, but it shouldn't matter.
You're paying microsoft. Maybe you should ask them to fix it on their end.

Aiden Torres
Aiden Torres

(checked)

Andrew Young
Andrew Young

huge market share so it should be treated as a 1st tier platform

So why don't you use Reddit instead of Cred Forums? It's 1st tier though

Zachary Torres
Zachary Torres

*tips fedora*
Great argument, idiot.
99.999999999999% of people aren't the type of people who are going to download your program.
The only vestige of Windows is gamerfags and people who just use it for a web browser and maybe excel or something. Those people aren't going to add new shit to their computer.

If you want to write something with mainstream appeal, it needs to be web-based or mobile-based.
There is no good reason to target Windows.

James Garcia
James Garcia

Why is Haskell so fucking unreadable? If your syntax is outshined by PHP that isn't a great sign.

Brandon Peterson
Brandon Peterson

hella digits

Angel Richardson
Angel Richardson

Not really a good equivalence.

The better comparison would be the fact that I'd develop some sort of Reddit app before I'd develop a Cred Forums app if my intention was solely to make money off of as many people as possible.

Logan Long
Logan Long

Wasted trips. Fuck you, reddit.

Joseph Perez
Joseph Perez

It's readable. Just takes awhile to learn the language.

Kayden Russell
Kayden Russell

Which is fucking bullshit. There are plenty of cases where you want use C/C++ on both windows and other platforms.

I still want to be able to compile programs on both fucking platforms without wasting fucking hours.

I still want to be able to use external libraries and not waste fucking hours trying to compile them on all my platforms I want to support.

I love C, but the whole development environment is pure distilled cancer.

Kevin Hill
Kevin Hill

Java dev or web dev.

Dylan Scott
Dylan Scott

windows is pure distilled cancer for anyone but end users
I think we can all agree.

Dylan Davis
Dylan Davis

boring
uncreative
syntaxic cancer
neuronal waste
lifewasting
meme

Nathaniel Walker
Nathaniel Walker

Totally agree. That's why these jobs are easily. Even a the near brain-dead can get them, and many do.

Isaac Fisher
Isaac Fisher

I think you're misplacing the blame.
It's Window's fault, not C's fault.

Ayden Taylor
Ayden Taylor

Can the k&r C book be read in a week?

Luke Ortiz
Luke Ortiz

I if go web dev will I have harder time later on if I will want to learn ASM or C?
Also what's the average ARM assembly developer salary?

Isaiah Jones
Isaiah Jones

Isn't Microsoft working on making it easier to write multi-platform programs, I think I read some statement about it

Nathan Parker
Nathan Parker

Depends on the skill level of the person reading it.
But it's a pretty short book.

Sebastian Rivera
Sebastian Rivera

I if go web dev will I have harder time later on if I will want to learn ASM or C?
probably a bit yeah

Also what's the average ARM assembly developer salary?
No idea, probably quite high. But those jobs are also probably insanely rare. There's fuck all demand for ASM or even C programmers compared with Web Dev and Java shit.

Nolan Barnes
Nolan Barnes

Build systems should've been standardized 20+ years ago to prevent this.

Anyway, anyone who doesn't use cmake is a fucking cunt.

Jeremiah Garcia
Jeremiah Garcia

I don't think there are many pure asm jobs.

But if you're looking to work in embedded system the chances of needing to know asm is high.

Noah Wood
Noah Wood

cmake

Austin Bennett
Austin Bennett

Build systems should've been standardized 20+ years ago
but if you don't use this built system that didn't exist 20 years ago you're a cunt
hmm

Nicholas Hughes
Nicholas Hughes

Nice argument.

Elijah James
Elijah James

I would've been fine if it was something else. But cmake is the dominant multiplatform build system right now.

I don't like cmake but it's what we're stuck with today.

That's why if you don't use the dominant tool you're being a cunt.

Nolan Robinson
Nolan Robinson

Considering C# and nearly all of its ecosystem is now open source and cross-platform, yeah.

Not sure what they're doing as far as C/C++ goes.

Mason Garcia
Mason Garcia

Who's using C# outside of windows?

Brandon Murphy
Brandon Murphy

Is this a rhetorical question?

Isaac Bennett
Isaac Bennett

Why do I always get this error? The program isn't even active anymore (I've checked Process Explorer before and got nothing). I have to wait 5 minutes before I can compile again.

Carson Perez
Carson Perez

Is the answer nobody?

Ayden Lee
Ayden Lee

Fuck, forgot the picture.

Andrew Cooper
Andrew Cooper

I unironically suggest you start using linux.

Aiden Cooper
Aiden Cooper

use cmake
it's still shit. in Go you can put in your code

import "github.com/..."
and it will automatically retrieves the needed files from github. something like DUB is also better code.dlang.org/getting_started

only a retard coming from c/c++ would find cmake good.

Connor Collins
Connor Collins

conflating package management and built systems
get out with your cancer. I don't need another pip, rpm, and others shitting up my system.

Asher Ortiz
Asher Ortiz

No, considering the Unity software (engine is C/C++ with .NET wrappers) and Xamarin are both built on Mono and those are becoming increasingly popular as cross-platform dev tools.

Even Red Hat Enterprise Linux ships with .NET Core now.

Noah Hughes
Noah Hughes

I have Ubuntu on another partition but I fucked it up by installing MATE when I could've installed Ubuntu MATE instead,

The permissions problem has never been an issue on other computers (college computers, etc.). I need to know where I fucked up.

Cooper Gutierrez
Cooper Gutierrez

Xamarin

C# is the best language for mobile app development.
Anything you can do in Objective-C, Swift or Java, you can do in C#.

Am I getting memed?

David Turner
David Turner

Cool thanks.
Yeah I expect that you must always know more than just one language/technology.
Is there a good site for job offers besides SO jobs?

Aiden Murphy
Aiden Murphy

not many

Mono
benchmarksgame.alioth.debian.org/u64q/compare.php?lang=csharpcore&lang2=csharpllvm
benchmarksgame.alioth.debian.org/u64q/compare.php?lang=java&lang2=csharpllvm

Kek

Thomas Perez
Thomas Perez

No, it's true. Xamarin is pretty based.

Grayson Ortiz
Grayson Ortiz

Java jobs probably require knowing the least amount of shit I would think.

Is there a good site for job offers besides SO jobs?
Dunno. I just use popular job portals in my country.

Michael Rodriguez
Michael Rodriguez

My Korean waifu worships satan though

Jayden Smith
Jayden Smith

That website is such garbage. The samples don't even use the same codebase in the comparisons, the fuck? Look at the binary tree example. One version is parallelised, the other is not. No shit the non parallel version is slower on a 4 core machine.

Nathaniel Stewart
Nathaniel Stewart

responding to a benchmarkpost

Nathaniel Morales
Nathaniel Morales

Java jobs probably require knowing the least amount of shit I would think.

Can you override private or static method in Java ?
Can you access non static variable in static context?
What if I write static public void instead of public static void?
Describe and compare fail-fast and fail-safe iterators. Give examples.
Compare the sleep() and wait() methods in Java, including when and why you would use one vs. the other.
What are method references, and how are they useful?
What is the difference between String s = "Test" and String s = new String("Test")? Which is better and why?
What is difference between object oriented programming language and object based programming language?
Can you make a constructor final?
Can we execute a program without main() method?
Can you declare the main method as final?

Jacob Brown
Jacob Brown

Have you tried running blocks as admin?

Try compiling from command line as admin if that doesn't work.

Jason Scott
Jason Scott

everyone can contribute, if you are not happy, fix the code then send a pull request.

Jacob King
Jacob King

I have better things to do with my time user

Hunter Reed
Hunter Reed

Are these genuine questions, or are you trying to make a point? I can't tell.

Andrew Morgan
Andrew Morgan

like posting in /dpt/ ? If the mono version sucks it's because most of c# programmers using mono suck themselves.

Charles Scott
Charles Scott

like getting mad at benchmarks on a vietnamese comic book forum?

Gabriel Cooper
Gabriel Cooper

Look at the binary tree example. One version is parallelised, the other is not. No shit the non parallel version is slower on a 4 core machine.
Interesting, I didn't even notice that last time I was browsing them.

It's pretty glaringly fucked, now that I look at it.

Not that benchmarks really matter all that much in the grand scheme of things, especially when you're talking about something like Xamarin (and to that end, C# in general), which isn't made to build performance-critical applications doing much math.

Mason Butler
Mason Butler

Those are common interview questions for java

Brandon Flores
Brandon Flores

like posting in /dpt/ ?
yeah

If the mono version sucks it's because most of c# programmers using mono suck themselves.
hmm.. not really following that logic.

Lucas Miller
Lucas Miller

it's because most of c# programmers using mono suck themselves
Wouldn't it only be the person who submitted that code?

The rest of the C# devs who look at it may just not give enough fucks to correct it.

James Barnes
James Barnes

right.

What is the difference in write new String("Test")?

Charles King
Charles King

reminder that both the c# and the mono compiler produce IL code that doesn't conform to the spec, but the runtimes fix the issue

Logan Young
Logan Young

Been there, done that and I still get the same result.

Disabling the antivirus does not work either.

Dominic Diaz
Dominic Diaz

a string literal is put in a static hash map so all same strings share the same instance. new String() creates a new instance even if the same string has already been instanced before.

String a = "abc"
String b = "abc"

a and b reference the same instance (a == b)

String a = new String("abc")
String b = new String("abc")

a and b reference different instances (a != b)

Joshua Hernandez
Joshua Hernandez

public class Main {
public static void main(String[] args) {
String foo1 = "foo";
String foo2 = "foo";
System.out.println(foo1 == foo2); // may be true

String foo3 = new String("foo");
String foo4 = new String("foo");
System.out.println(foo3 == foo4); // always false
}
}

ideone.com/t8L8Pn

Nathaniel Butler
Nathaniel Butler

JUST

Wyatt Gutierrez
Wyatt Gutierrez

What do you mean?

Isaac Ramirez
Isaac Ramirez

Thanks.

Also, does anyone know how much do sites like mobafire.com, op.gg and lolking make? And how do they keep up the sites?

Christopher Perry
Christopher Perry

oh

Adam Jenkins
Adam Jenkins

Every day I feel like I learn a new problem with Java that C# doesn't have.

John Turner
John Turner

keep in mind Strings are immutable so this can't really cause a problem, just confuses Java newbies when sometimes == works for their Strings and sometimes doesn't, before they learn to use .equals()

Wyatt Sullivan
Wyatt Sullivan

Operator overloading was a correct decision

Dominic Lee
Dominic Lee

C# is similar in this case, though.

The '==' operator compares reference equality like Java.

Oliver Butler
Oliver Butler

not with strings

Parker Clark
Parker Clark

Not with primitives in general (they override

.Equals()
), but the issue could still arise with other types.

Robert Carter
Robert Carter

Yeah, but the example was with strings.

Michael King
Michael King

Your mom was with strings.

Also, this:

int x = 1;
short y = 1;
x == y; //true
y.Equals(x); //false

== compares value if there is an implicit cast to a type comparison, while

.Equals()
compares both value and type.

Oddly enough, '==' is using Equals() behind the scenes and doing the best overload for this, which is to promote the short to an int, and then compare type+value.

Bentley Nelson
Bentley Nelson

var ayy = "ayy";
var ayyy = "ayy";
WriteLine(ayy == ayyy); //true

var lmao = new { lmao = "lmao" };
var lmaoo = new { lmao = "lmao" };
WriteLine(lmao == lmaoo); //false
WriteLine(lmao.Equals(lmaoo)); //true

WriteLine(lmao.lmao == lmaoo.lmao); //true

var poo = new string(new char[] { 'p', 'o', 'o' });
var pooo = new string(new char[] { 'p', 'o', 'o' });
WriteLine(poo == pooo); //true

Landon Clark
Landon Clark

What is the difference between String s = "Test" and String s = new String("Test")?
Oh cool, I learned the basics about this in class a week or so ago.

Which is better and why?
THAT we didn't learn. I'd guess making a new String("Dicks") would be safer than String s = "Dicks"? I'd guess that literals are more prone to programmer error, but I'm a programming newfag so I don't know how correct that is.

Ethan Campbell
Ethan Campbell

You can use `var` in java? I didn't know that

Evan Nguyen
Evan Nguyen

Neither is "safer", using the literals is less memory expensive.

its C#

Zachary Sanders
Zachary Sanders

Ohh, well I don't know either language

Kayden Walker
Kayden Walker

var is enclosed to function block
let is enclosed to nearest block

Luis Clark
Luis Clark

But lmao and lmaoo are anonymous types, not strings.

Matthew Cruz
Matthew Cruz

that's javascript...

Gabriel Ross
Gabriel Ross

Oddly enough, '==' is using Equals() behind the scenes
I rather doubt that. == almost certainly just compares the byte values of the value types of equality. .equals() would involve massive overhead.

Eli Cook
Eli Cook

tl;dr: having == for anything but primitives was a mistake

Cooper Reyes
Cooper Reyes

Horrible language

Colton Campbell
Colton Campbell

What's wrong with using it to compare reference equality?

Josiah Rogers
Josiah Rogers

It doesn't coincide with value equality.

John Adams
John Adams

It makes sense with pointers but references are a more abstract concept, even if they are implemented the same.

It's just creates confusion.
It should just have a refEqual() method or something.
That's much clearer.

Parker Green
Parker Green

C# has

ReferenceEquals()

Jaxson Harris
Jaxson Harris

Eh, yeah..

But I find in reality adding refEquals() everywhere is not worth the extra code bloat. == isn't perfect for reference types, but refEquals() everywhere is painful af.

Matthew Perry
Matthew Perry

using the literals is less memory expensive
Wow. That's simple. If using the literals is less expensive, why/when do we use the class String to make a new instance?

Christopher Davis
Christopher Davis

in case you want to compare strings with reference equality for some daft reason i guess.

Aiden Myers
Aiden Myers

exactly what i said

Brody Ramirez
Brody Ramirez

but like.. what kind of examples are there of that? Source?

Leo Thompson
Leo Thompson

String(String) is not very useful practically, but String has other constructors for creating a String from other objects:
docs.oracle.com/javase/7/docs/api/java/lang/String.html#constructor_summary

Ryan Cook
Ryan Cook

Is it this method of calculating variance right?


public static double variance(ArrayList<Integer> list) {
double sumOfSqrDifferences = 0.00;
double difference;
for (int num : list){
difference = average(list) - num;
sumOfSqrDifferences += difference*difference;
}
return sumOfDifferences / (list.size() - 1);
}

Total noob here sorry

Zachary Collins
Zachary Collins

I'm assuming this is why C#'s string constructor doesn't accept a string literal.

In C#, you can't do:

var ayy = new string("ayy");

like in Java.

But in the same respect, I'm not sure why you would want to.

Jace Miller
Jace Miller

Oh that's actually pretty cool.

Connor Peterson
Connor Peterson

bush did 9\11.exe
\

gee i wonder

Sebastian Walker
Sebastian Walker

I just noticed that I put average(list) method call inside the for loop which made it needlessly calculate it over and over

I stored that inside a variable outside fo the for loop now:

 public static double variance(ArrayList<Integer> list) {
// write code here
double sumOfDifferences = 0.00;
double difference;
double listAverage = average(list);
for (int num : list){
difference = listAverage - num;
sumOfDifferences += difference*difference;
}
return sumOfDifferences / (list.size() - 1);
}

John Jackson
John Jackson

:(

Aiden Torres
Aiden Torres

Hey guys,

Question: What do you guys use for Project Managment?

I'm working as a Developer at a place that really doesn't have any. All we have is an SVN service that we use to keep the code, but we don't really have anything like project requirements, written down schedules, or anything of the like.

I'm looking to implement such a system. I'm wanting to put together something that will track current projects, their requirements, individual tasks related to that project and the like.

Does anyone know of any guides or templates I can use a base to put together something?

Thanks.

David King
David King

just switch from svn to git and install gitlab on some internal server at the company, it has everything you need for such thing

Jackson Williams
Jackson Williams

I can't figure out OpenAL streaming because I'm mostly retarded.

Luke Howard
Luke Howard

Trello, but I'm not a programmer.

It's a simple, flexible and nice tool.

Brandon Morgan
Brandon Morgan

How hard is it to implement Skip Lists? I'm using Java.

Jose Perry
Jose Perry

I used teamwork.com at my last company. I'd recommend it.

Andrew Parker
Andrew Parker

not overloading your operators to prevent usage of '==' and '!=' by printing rude messages if attempted

Asher Lee
Asher Lee

no

Chase Jones
Chase Jones

how does spolsky do it

Isaac Jenkins
Isaac Jenkins

If you're using Visual Studio, you can get a VSTS website for free with unlimited storage right now.

You can use it regardless, but the integration is nice.

Kanban boards, interation/sprint tracking, capacity planning (Joe can work x hours per day, these items take x hours, do projection), and private version control.

Kayden Morris
Kayden Morris

Swift is a horrible troll language.

Bentley Bell
Bentley Bell

Do what?

Alexander Jenkins
Alexander Jenkins

Learned about chrome extensions this weekend. Ended up writing this

chrome.google.com/webstore/detail/slack-emoji-uploader/jfacjbibcobdehekkieokkloinlfdomg

Nolan Phillips
Nolan Phillips

You should just make Shitpost Script.

Hunter Brown
Hunter Brown

Why would i do this?

Jackson James
Jackson James

Already did.

Liam Torres
Liam Torres

i dunno the stuff produced by fog creek always looks a little underwhelming when they announce it but ends up being quite good

Easton Smith
Easton Smith

chrome.google.com/webstore/detail/slack-emoji-uploader/jfacjbibcobdehekkieokkloinlfdomg
neat

Jaxon Phillips
Jaxon Phillips

What types of problems is functional programming suited for?

What types of problems is functional programming unsuitable for?

Benjamin Rogers
Benjamin Rogers

depends what you mean by functional programming.

If you mean "pure" functional programming like haskell and shit, then I'd say it's good for very complicated problems where the code needs to be extremely dependable, but not necessarily extremely fast.

Functional programing as mixed in with imperative programming is useful for everything.

Gabriel Phillips
Gabriel Phillips

depends what you mean by functional programming.
I don't know. That's what i'm trying to figure out.

Chase Baker
Chase Baker

What i mean is, i'm trying to determine if the fp meme is something worth putting time and effort into learning.

Leo Scott
Leo Scott

it's not a meme

Juan Richardson
Juan Richardson

It is. It improves your regular programming just by learning the concepts and understanding their benefits.

Andrew Baker
Andrew Baker

But it is.

Parker Edwards
Parker Edwards

What is functional programming?

How does it manifest in Haskell vs. the functional features added into languages like Python and C#?

Matthew Cox
Matthew Cox

So 'Learn you a Haskell for great good' is a good place to start?

Or are there better recommended starting points?

Adam Thompson
Adam Thompson

Dunno. I learned F#, which is nice because as a .NET developer I can actually use it for real world shit. Haskell is kind of useless.

Wyatt Howard
Wyatt Howard

Okay guys. I've been developing in Java for around three years now. Six if you count the bachelor I took in Computer Enginering.

It's time to get serious - it's time go learn c++. Properly. I don't see it going anywhere, if anything it's growing bigger.

It's time to learn more than the hello world and basic syntax. It's time to get started working on bigger projects, it's time to start using the proper tools (IDE etc) to work with it. Basically, IntelliJ for Java is a gift from the gods. It's amazing. Do I get CLion for C++/C, or are there better altenratives? My development platform is Linux.

SHOWER ME WITH YOUR KNOWLEDGE, DPT

Nathan James
Nathan James

Careful, user. You're asking for Cheeto-encrusted rage with a comment like that.

Eli Roberts
Eli Roberts

Java is just fine too, at least as a "here to stay" language.. If you're looking for 'languages that are here to stay', I'd say make sure you're versed in C++ and the .NET languages (C#/VB.NET*)

*: VB.NET isn't good, but there is a shit ton of legacy code out there in it, if you encounter it today you'll either be A) maintaining it for someone who has very small/situational use for the code in particular or B) updating it to C#.

Ryan Miller
Ryan Miller

So as a C++ guy, what would be a beneficial starting point for learning fp?

Nathan Lee
Nathan Lee

Even Haskels original designers agree :^)
youtube.com/watch?v=iSmkqocn0oQ

Owen Young
Owen Young

hello /dpt/ I have a stupid question, hope you don't mind
how would you solve this?

James Wood
James Wood

since when did jetbrains switch to subscription pricing
fucking dropped

Kevin Sanchez
Kevin Sanchez

winapi

Hudson Rodriguez
Hudson Rodriguez

dunno. Maybe read up about immutables and side effects and stuff. That stuff is applicable to C++.

Learning Haskell probably isn't a bad idea though. it's a good way to get to grips with the benefits of functional concepts.

Isaac Torres
Isaac Torres

I would solve it by passing the correct type to the function's parameter.

William Brown
William Brown

I really enjoy writing Node. Am I cancer? Should I be learning something else?

Adam Watson
Adam Watson

Working on my terminal emulator, still working on the renderer adding all the various bullshit attributes.

The cells in the video are from the following test code (and no, this is not how the code will actually handle cell modifications, it's just for testing):

        *terminal.get_mut(1, 1) = terminal::Cell::Char {
x: 1, y: 1, value: "a".into(), style: Rc::new(Style {
foreground: Some(Rgba::new(1.0, 0.0, 0.0, 1.0)),
background: Some(Rgba::new(0.2, 0.2, 0.2, 1.0)),
attributes: style::BOLD,
})
};

*terminal.get_mut(3, 1) = terminal::Cell::Char {
x: 3, y: 1, value: "b".into(), style: Rc::new(Style {
foreground: Some(Rgba::new(1.0, 0.0, 0.0, 1.0)),
background: Some(Rgba::new(0.0, 0.0, 0.0, 1.0)),
attributes: style::STRUCK,
})
};

*terminal.get_mut(5, 1) = terminal::Cell::Char {
x: 5, y: 1, value: "c".into(), style: Rc::new(Style {
foreground: Some(Rgba::new(0.0, 0.0, 0.0, 1.0)),
background: Some(Rgba::new(1.0, 1.0, 1.0, 1.0)),
attributes: style::ITALIC,
})
};

*terminal.get_mut(7, 1) = terminal::Cell::Char {
x: 7, y: 1, value: "d".into(), style: Rc::new(Style {
foreground: Some(Rgba::new(1.0, 1.0, 1.0, 1.0)),
background: Some(Rgba::new(0.0, 0.0, 0.0, 1.0)),
attributes: style::REVERSE,
})
};

*terminal.get_mut(9, 1) = terminal::Cell::Char {
x: 9, y: 1, value: "e".into(), style: Rc::new(Style {
foreground: Some(Rgba::new(1.0, 1.0, 1.0, 1.0)),
background: Some(Rgba::new(0.0, 0.0, 0.0, 1.0)),
attributes: style::BLINK,
})
};

*terminal.get_mut(11, 1) = terminal::Cell::Char {
x: 11, y: 1, value: "f".into(), style: Rc::new(Style {
foreground: Some(Rgba::new(1.0, 1.0, 1.0, 1.0)),
background: Some(Rgba::new(0.0, 0.0, 0.0, 1.0)),
attributes: style::UNDERLINE,
})
};

Brody Bailey
Brody Bailey

lel. looks way over engineered.

Jaxson Hill
Jaxson Hill

Thinking about writing a C compiler.

Grayson Reed
Grayson Reed

As I said that's not how it actually handles cell modifications, it's changing internal state from outside for testing.

Nicholas Sanders
Nicholas Sanders

I think someone did that already

Evan Perry
Evan Perry

Do it.

Luis Russell
Luis Russell

github.com/rui314/8cc

Jace Price
Jace Price

I could pass a correct type parameter, but how do I make it so it contains the string defined above?

Adrian Bailey
Adrian Bailey

Python is the most aesthetic language

Cameron Moore
Cameron Moore

My dick is the most aesthetic language.

Jason Brown
Jason Brown

quite the opposite

Elijah Nguyen
Elijah Nguyen

write method, refers to a method below
LOL COMPILE EROR HAHA U MAD ;DDDD
ENJOY WRITING THE MAIN AT THEBOOTOM LOOOL U FAG

Colton Miller
Colton Miller

I'd give it to Haskell

John Miller
John Miller

UNI started recently, and in one of our classes, these are the recommended books to read, are they particulary good, or should I choose to read others?
They are:
Modern Operating Systems By Tanenbaum (Prentice Hall)
Operating Systems Design and Implementation - A.S.Tanenbaum, A.S.Woodhull
Linux System Administration - Linux Professional Institute (Lpi)
Operating Systems - Internals and Design Principles (Stallings)

Colton Long
Colton Long

news.ycombinator.com/item?id=1803815

Yes

const wchart_t * -> LPCWSTR
wchart_t * -> LPWSTR

the problem is that c_str() returns a pointer to const wchar_t while LPWSTR is simply wchar_t* (not const)

Owen Thompson
Owen Thompson

harmful.cat-v.org/software/andy_tanenbaum :^3

Brandon Nguyen
Brandon Nguyen

harmful.cat-v
:^3

Benjamin Jackson
Benjamin Jackson

pages.cs.wisc.edu/~remzi/OSTEP/

cat-v
k tard

Nolan Young
Nolan Young

:-^)

Oliver Martin
Oliver Martin

Never reply to me again unless you're contributing to the thread.

Carson Cooper
Carson Cooper

i've been reading anderson-dahlin recently. seems nice. i'd be interested to hear about others' experiences
tanenbaum is really standard and lots of people have learned from it

Luis Jenkins
Luis Jenkins

Which of these is better to use for zeroing out?

/* using 0 */
memset(foo, 0, bar);

/* using '\0' */
memset(foo, '\0', bar);

Austin Gonzalez
Austin Gonzalez

So they're decent to say the least, and I should read through all of them in addition to
?

Henry Stewart
Henry Stewart

That looks fun. I'll have a look at it.

Connor Phillips
Connor Phillips

memset(foo, '\x00', bar);

Chase Torres
Chase Torres

Working on an instagram scrapper so I can watch all those twerk videos offline and view everything without the instagram's really shitty player.

Logan Martinez
Logan Martinez

plus you can make webms of your waifu

Ayden Young
Ayden Young

3d waifus
You people disgust me.

Jayden Jackson
Jayden Jackson

there's no difference, so I guess just ask yourself if you are using it to set null characters ('\0') or the value 0 to use the one that is better semantically.

Owen Davis
Owen Davis

I've got my self made webm for retards and I've made ~550 webms of Taeyeon

Jaxon Hernandez
Jaxon Hernandez

Any Swift programmers here?

Why are Swift developers so afraid of Singletons and instead depend on dependency injection?

Robert Powell
Robert Powell

I'm gunna have to switch all my development to a linux terminal over SSH, what's the most comfy arrangement?
I asked this awhile ago and got some recommendation for a terminal splitting application so I could have multiple terminal windows in one?

Also, I got eclim-emacs set up but I can't seem to get it to actually do any error checking or compiling?

Alexander Brown
Alexander Brown

terminal splitting application
I use tmux, there's also GNU screen.

Caleb Young
Caleb Young

Do you know if either of those rely on X to work?

Lincoln Cook
Lincoln Cook

What is functional programming?
programming at a higher level
How does it manifest in Haskell vs. the functional features added into languages like Python and C#?
completely different. there are languages that are more of a middle ground (by not being purely functional) like Scheme. C# and Python especially can do very little of actual 'functional programming'. (although C# is quickly moving in that direction if you follow all the releases). Recursion isn't emphasized at all (in fact, it's avoided because they don't offer TCO), for example. In general, most FP solutions to problems are avoided in both C# and Python.

Carson Cooper
Carson Cooper

Tell me how it goes, instagram is heavily javacripted and I gave up trying to find a way to collect all the image links

Justin Anderson
Justin Anderson

neither do, obviously. I'm not sure about screen but tmux can optionally take advantage of mouse input (e.g. click in a split terminal 'window' to make it active, scrolling, copy/paste)

Jaxon Collins
Jaxon Collins

Dependency injection is objectively better because it's easier to test.

William King
William King

What's dependency injection?

Gavin Morales
Gavin Morales

Passing all the objects to another object instead of requiring it to make it itself, either through the constructor or setters

David Morgan
David Morgan

A fancy term for passing any dependencies in to a function as arguments, as opposed to relying on them being available in a broader scope.

Isaac Gonzalez
Isaac Gonzalez

oh right.

Swift can't do singletons? wat?

Singletons suck, but sometimes you need them. Dependency injection is a huge fucking pain if it's something you need access to nearly globally.

Carter Martinez
Carter Martinez

you never need access to anything globally. stop writing code with global mutable state

Easton Baker
Easton Baker

do you pass a logger to every function that needs one?
what about environment info?

Isaiah Martinez
Isaiah Martinez

you never need access to anything globally.
you never *need* to write terse maintainable code, but it's nice.

Jordan Russell
Jordan Russell

You shouldn't be writing everything to a single log unless it's a tiny program.

Logan Lewis
Logan Lewis

is that a yes?

Joseph Ortiz
Joseph Ortiz

you never need access to anything globally. stop writing code with global mutable state
config file

Oliver King
Oliver King

Persistent data stores are a different subject entirely. But even then, your config file only needs to be accessed by one class, whichever one stores all your settings.

Anthony Edwards
Anthony Edwards

If your program is small, yes you could potentially use a singleton class for a logging function.
But if your program is large and might be trying to log multiple things at once, you don't want to run into IO lockups because you have 9 different methods all trying to call the same code to open a writer onto a file before the others are done with it.

Connor Scott
Connor Scott

But if your program is large and might be trying to log multiple things at once, you don't want to run into IO lockups because you have 9 different methods all trying to call the same code to open a writer onto a file before the others are done with it.
If you don't know how to avoid IO lockups in this situation you should straight up kill yourself.

Alexander Wright
Alexander Wright

Why would you say such a hurtful thing user
I thought we were friends

Jason Robinson
Jason Robinson

But even then, your config file only needs to be accessed by one class, whichever one stores all your settings.
which is global mutable state

Parker Lopez
Parker Lopez

No you could inject your settings class into anything that needs it.

Ryder Barnes
Ryder Barnes

codingame.com/ide/582466342ac6944cd030506c22f5f68cf2376a4
Step 1 : the fight
At each game round, in unison, each player reveals the top card of their deck – this is a "battle" – and the player with the higher card takes both the cards played and moves them to the bottom of their stack. The cards are ordered by value as follows, from weakest to strongest:
2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A.

Step 2 : war
If the two cards played are of equal value, then there is a "war". First, both players place the three next cards of their pile face down. Then they go back to step 1 to decide who is going to win the war (several "wars" can be chained). As soon as a player wins a "war", the winner adds all the cards from the "war" to their deck.

For example, if the card distribution is the following:
Player 1 : 10D 9S 8D KH 7D 5H 6S
Player 2 : 10H 7H 5C QC 2C 4H 6D
Then after one game turn, it will be:
Player 1 : 5H 6S 10D 9S 8D KH 7D 10H 7H 5C QC 2C
Player 2 : 4H 6D

after one game turn
isn't this example wrong?

Wyatt Allen
Wyatt Allen

nevermind, I had misunderstood how "wars" worked... I thought they took cards from the group of three cards they had separated

Jaxon Cruz
Jaxon Cruz

python/java pleb here, trying to get into c++ so I'm solving some problems from a site to warm up, but I can't figure out what to do, there's a double with 4.0 assigned already and I'm supposed to declare a new double, input a value and then print their sum, so I initially tried this

double d = 4.0;
double newDouble;
cin >> newDouble;
cout << d + newDouble << endl;

only that printed out an integer, after that I've tried various things but all of them failed, google is bringing up nothing useful

Hunter Perry
Hunter Perry

Started using C and I found out I love it, but which is faster, C or C++?

Evan Jones
Evan Jones

assembly

Isaac Gutierrez
Isaac Gutierrez

benchmarksgame.alioth.debian.org/u64q/c.html

Hudson Sullivan
Hudson Sullivan

You've never played war nigga? That was the first card game I learned.

Samuel Jenkins
Samuel Jenkins

credforums.com/thread/56904235/technology
credforums.com/thread/56904235/technology
credforums.com/thread/56904235/technology
credforums.com/thread/56904235/technology
credforums.com/thread/56904235/technology

Oliver Price
Oliver Price

Real new thread:
credforums.com/thread/56904236/technology
credforums.com/thread/56904236/technology
credforums.com/thread/56904236/technology
credforums.com/thread/56904236/technology

William Brooks
William Brooks

c++

Kayden Carter
Kayden Carter

Yours was created well after his, and yet you still had to post it here
Fuck off retard

Oliver Bennett
Oliver Bennett

nope, I'm not from the US or europe, and had never heard about it

Disable AdBlock to view this page

Disable AdBlock to view this page

Confirm your age

This website may contain content of an adult nature. If you are under the age of 18, if such content offends you or if it is illegal to view such content in your community, please EXIT.

Enter Exit

About Privacy

We use cookies to personalize content and ads, to provide social media features and to analyze our traffic. We also share information about your use of our site with our advertising and analytics partners.

Accept Exit