/dpt/ - Daily Programming Thread

christian programs only

old:
What are you working on god bless?

Other urls found in this thread:

github.com/nick-gits/calcupy
archive.rebeccablacktech.com/g/thread/S56842194#p56842335
scala-lang.org/
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
twitter.com/SFWRedditGifs

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?

second for python

one character string:

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

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

Woops, missed a paren there.

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

std::not1(::isalnum)

becase 0 < 1-1 evaluates to false

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

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

Actually doing anything productive is against my religion

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

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?

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

seffy~

That shit is fucking too hard for me.

idk what that means.

neither do i ;)

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.

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

>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?

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

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

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

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

Solving problems involving arrays, matrices, graphs, tries.

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

it then goes on to lie

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.

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

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.

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

>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.

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

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

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;
}

Have you checked the shift values are right?

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

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

Yes... Here's some sample output:
cout

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...

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

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

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

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

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

This is probably your issue

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.

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...

>he thinks college textbooks only go to up $100

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

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.

...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

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

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.

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(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(shiftGreen));
double newBlue= (pBlue * static_cast(shiftBlue));
cout

Me from earlier 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!

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

Is that shyrene

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...

ofc
our game dev girl

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.

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.

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.

programming

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

int main()
{
int age;

If ( age

>If

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?

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

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);
}
}

Writing a cue sheet parser.

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

What programming language is most japan
Ruby?

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)

installed in 2 seconds

>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++) {
...
}

/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.

Girls can't drive boats

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

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

Js is shit though ofc

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

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

Is
gcc -o prog prog.c
really that hard?

>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

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

gcc -O3 *.c

>what are makefiles

Do you still not know what RAII is?

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.

Write a Makefile.

I believe so yes, what else would you do?

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?

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

Actually writing directly to an array?

I'm not even a programmer.

A buffer is an array right?

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

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

Because I don't develop for applel.

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 ?

Look up boolean logic.

>c2lang.org/
>integrated build system
shame

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.

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.

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?

Are you using windows?

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?

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.

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

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

*tips fedora*

It does matter, but it shouldn't matter.

checked

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

(checked)

>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

>*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.

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

hella digits

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.

Wasted trips. Fuck you, reddit.

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

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.

Java dev or web dev.

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

>boring
>uncreative
>syntaxic cancer
>neuronal waste
>lifewasting
>meme

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

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

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

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?

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

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

>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.

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

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

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.

>cmake

>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

Nice argument.

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.

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.

Who's using C# outside of windows?

Is this a rhetorical question?

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.

Is the answer nobody?

Fuck, forgot the picture.

I unironically suggest you start using linux.

>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.

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

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.

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.

>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?

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?

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

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

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.

My Korean waifu worships satan though

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.

>responding to a benchmarkpost

>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?

Have you tried running blocks as admin?

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

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

I have better things to do with my time user

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

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

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

>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.

Those are common interview questions for java

>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.

>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.

right.

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

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

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

Disabling the antivirus does not work either.

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)

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

JUST

What do you mean?

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?

oh

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

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()

Operator overloading was a correct decision

C# is similar in this case, though.

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

not with strings

Not with primitives in general (they override .Equals() ), but the issue could still arise with other types.

Yeah, but the example was with strings.

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.

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

>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.

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

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

its C#

Ohh, well I don't know either language

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

But lmao and lmaoo are anonymous types, not strings.

that's javascript...

>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.

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

Horrible language

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

It doesn't coincide with value equality.

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.

C# has ReferenceEquals()

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.

>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?

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

exactly what i said

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

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

Is it this method of calculating variance right?


public static double variance(ArrayList 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

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.

Oh that's actually pretty cool.

>bush did 9\11.exe
>\

gee i wonder

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 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);
}

:(

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.

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

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

Trello, but I'm not a programmer.

It's a simple, flexible and nice tool.

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

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

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

no

how does spolsky do it

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.

Swift is a horrible troll language.

Do what?

Learned about chrome extensions this weekend. Ended up writing this

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

You should just make Shitpost Script.

Why would i do this?

Already did.

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

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

What types of problems is functional programming suited for?

What types of problems is functional programming unsuitable for?

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.

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

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

it's not a meme

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

But it is.

What is functional programming?

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

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

Or are there better recommended starting points?

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.

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

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

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#.

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

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

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

since when did jetbrains switch to subscription pricing
fucking dropped

>winapi

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.

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

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

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,
})
};

lel. looks way over engineered.

Thinking about writing a C compiler.

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

I think someone did that already

Do it.

github.com/rui314/8cc

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

Python is the most aesthetic language

My dick is the most aesthetic language.

quite the opposite

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

I'd give it to Haskell

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)

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)

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

>harmful.cat-v
> :^3

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

>cat-v
k tard

:-^)

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

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

Which of these is better to use for zeroing out?

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

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

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

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

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

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

plus you can make webms of your waifu

>3d waifus
You people disgust me.

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.

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

Any Swift programmers here?

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

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?

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

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

>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.

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

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)

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

What's dependency injection?

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

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.

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.

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

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

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

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

is that a yes?

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

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.

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.

>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.

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

>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

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

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?

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

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

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

assembly

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

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

...

Real new thread:

c++

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

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