/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

softwareengineering.stackexchange.com/questions/118703/where-did-the-notion-of-one-return-only-come-from/118793
en.wikipedia.org/wiki/List_(abstract_data_type)
en.wikipedia.org/wiki/Linked_list
discord.gg/Qh2MjT
twitter.com/AnonBabble

Java > C#

I wish I had friends

What's the future supreme efficient algorithms built up together as if what you build was the most efficient algorithm you could, you get the idea..

Or discovering something that's beyond an algorithm but it's capable of figuring out algorithms itself, but how would that even be possible because even if we want AI we have to built it similarly to what I proposed first.

dude weed lmao

class You {
friend class me;
};

just figured out how to get rounded images working for my Sup Forums browser. it only took me a couple of years.

>tfw dumb as hell

.img {
border-radius: 10%;
}


wow

Should I use exceptions or checks with stuff like this?
int Engine::initialize(std::string window_title)
{
int rv = glfwInit();
}

>should I use (unchecked) exceptions
No.

So I am supposed to check and then throw?
What do I throw? Got an example pls?

actually, it's more like:
GdipCreateTexture2(pImage, %WrapModeClamp, srcX, srcY, srcW, srcH, pTextureBrush)
GdipCreateMatrix(pMatrix)
GdipTranslateMatrix(pMatrix, x, y, %MatrixOrderPrepend)
GdipSetTextureTransform(pTextureBrush, pMatrix)
GdipDeleteMatrix(pMatrix)
GdipScaleTextureTransform(pTextureBrush, w / srcW, h / srcH, %MatrixOrderPrepend)
arcRectW = 25 / 100 * MIN&(w, h)
GdipCreatePath(%FillModeAlternate, pPath)
GdipAddPathArc(pPath, x, y, arcRectW, arcRectW, 180, 90)
GdipAddPathArc(pPath, x + w - arcRectW, y, arcRectW, arcRectW, 270, 90)
GdipAddPathArc(pPath, x + w - arcRectW, y + h - arcRectW, arcRectW, arcRectW, 0, 90)
GdipAddPathArc(pPath, x, y + h - arcRectW, arcRectW, arcRectW, 90, 90)
GdipClosePathFigure(pPath)
GdipFillPath(pGraphics, pTextureBrush, pPath)
GdipDeletePath(pPath)
GdipDeleteBrush(pTextureBrush)

holy kek

don't even show me your "hello world".

why do you torture yourself like this?

use std::vec::Vec;

struct Test
}

fn make_test {
let mut t = Test::

go is fast language yes

checked exceptions are a java feature not in C++ (without being broken anyway)

Never use exceptions. Either return error codes, possibly as enums and possibly in a variant, or set a flag in your object upon an error and test it with operator bool or something similar.

Either return error codes, possibly as enums and possibly in a variant, or set a flag in your object upon an error and test it with operator bool or something similar.
Eeeeek WRONG!
std::optional

>Never use exceptions.
>t. cargo cult programmer
Whenever someone says "never do X" in the context of programming, you immediately know you're dealing with a moron and that you can safely ignore everything he's going to say.

std::optional is a less general case of std::variant
same thing same purpose

I like writing my own code instead using what someone else wrote. no frameworks/runtimes for me. I just stick with the standard Windows libraries like gdiplus.dll.

I should've known this is a waste of time just from the two replies in this thread.

dude 420 XD

Every time somebody says never use something it makes me think it's just because they can't understand it themselves.
Every time I posted here for help with TDD I would just get ">TDD."

>TDD

How do I implement zooming of a 2D texture? Say that I've got a terrain texture, 10000x10000 pixels and I want to render just the top corner so that it fits on the screen, say a rectangle of size 1920x1080. But then, I also want to be able to show a "zoomed out" rectangle of size 9600x5400 (zoom factor of 5) on the same screen. How would that work? I don't want to load the whole texture in memory and I would prefer to only load the portion that will be shown at the time.

F* > F# > C# > C

C++ > C >>>>>>>>> powergap >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>everything else

F* > U > C# > K

What is U?

I don't know if this is where I should ask but where do you guys find jobs? I have no idea where to begin looking. I'm just looking at indeed and google but I don't know if there are better places.

>where do you guys find jobs
I usually go to the job store

Have you tried dice.com?

It's all nepotism.
You can try applying as an outsider, but if you don't have a degree and 5 years of experience (non-school), you won't even get a reply back.
Your best bet is to know someone or use some recruiters and have a solid portfolio of web-related things you can impress idiots with.

I wish.

I will check it out.

Really? My parents are going to be mad if I am still living with them a year from now.

How old are you?

22 graduating from college this semester.

>I wish.
In some euro countries, you can go to the job store (usually there's at least one in every city) and if they have any jobs then you can 'buy' them, which is really a small deposit that you get back when the job is finished as well as being paid for the work. They usually have all kinds of jobs available.

>&'a String
What are you doing?
> Making a self referencing alias in two places.
Why? What's the point?
> Compiler tells you this could result in a dangling pointer.
What a surprise

Look if you really don't like borrowk just use unsafe, then you can write whatever steaming pile of garbage you fucking want.

If, on the other hand - you want rust to give you the safety guarantees it offers you're gonna have stop whining and just write better code. Granted, borrowk isn't perfect (NLL is on the way), but you know what? It does it's job reasonably well, and as a bonus doesn't mince words to hint, that maybe, just maybe, your code is shit.

What did your major in?
If you're looking for a junior developer job, you really should have started looking at internships in your second year at the latest, you should have been hired straight out of college.

Huh, that's interesting.

Computer Science. You are probably right I tried applying to a couple of internships but it didn't go well. I was usually too distracted by schoolwork to apply for internships.

/edg/ is dead so imma ask here
no experience raspberry pi or electronics in general, just desktop dev
hoping someone might now what do I need to buy besides a raspberry(and which model) to make the simplest beeps?

>Huh, that's interesting.
I was just kidding user although I guess paying to get a job is less far-fetched than it used to be.

Well, you're pretty fucked user.
You'd better start applying right the fuck now, because once your unemployment gap grows longer than 6 months, you won't be considered, even with your degree.

Are you american by any chance?
Only american white people seem to kick their offspring out onto the streets despite the white collar entry level job market being absolutely saturated with applicants.

Could you get into a masters program next year and do an internship in between?

What is the proper way to use exceptions in C++?

They won't kick me out right away, hell they might never do it but they will certainly make me feel like shit for living with them. I don't really want to deal with that stress. If I can't find a job within 6 months I will have to work somewhere shit because I have to pay off my loans.

I don't want to get more into debt honestly.

Aren't you thinking of arduino?

There is no proper way to use exceptions in C++.

Congrats, you've become just another statistic.
You're a college educated millennial who washes dishes to pay off his student loans!

You use std::optional instead

No, from what I gather, rpi has a proper OS and arduino is more for mechanical actuation

>dept
Good point. Are any scholarships available?

>living with parents
If you're able to find work near your parents, it will probably make financial sense to live with them, unless they decide to charge you above market rent. Of course, it might not make sense for other reasons.

>>dept
fuck

Yeah but I lived with my parents through college so I don't have that much loans honestly. Also I had no real choice, I really do like programming and Computer Science and I suck at anything else it's why I really want to find a job as a programmer because I'm actually pretty okay at it but not much else.

I would probably try to pay off my debts while living with them as long as I can but once I'm done with that I would fuck off because they will definitely treat me like shit and I don't want to deal with that stress.

softwareengineering.stackexchange.com/questions/118703/where-did-the-notion-of-one-return-only-come-from/118793
>"Single Exit" meant that a function should only return to one place: the statement immediately following the call. It did not mean that a function should only return from one place.
"return ret" fags btfo and suicide watch

If you want to work as a programmer than it might make sense to practice for interviews. Yes, you'll be asked stuff that will almost never come up in the job itself, but you have to play the game.

How do I do that? You mean practice answering questions about programming?

Brush up on stuff like searching and sorting algorithms and inverting binary trees.

kill the weebs

if i add an object to an arraylist in java, and then modify the object, is it modified in the arraylist?

So what are you doing this Saturday evening?

hm i don't know user how about you try it?

Yes, the ArrayList holds references not values.

does creating a new object with the same name use the same reference, though?

Hey son what's this Racket over here? You're playing with your meme programming languages again?

where can i find a begginer friend to make opengl shit together with?

CHICKEN > Racket

no, you change the value of the variable to a reference to the new object

No, the variable gets reassigned with the reference to the other instance you just created.

Trying to sim tungsten psuedo-alloys, though it's starting to prove that simulating isn't nearly as effective as lab work.

I'm learning opengl too, though I haven't gotten to drawing cubes yet.

how can i get in contact with you?

I'm always here on /dpt/ is there something you want to talk privately about?

would be nice to be able to message in real time, do you have a discord, steam or skype etc?

>I'm always here
Kinda creepy, would not pair program with

It's you.

Sounds like someone reliable, the perfect partner

stpeam#9609

thanks, i'm koritsu

Using Windows and SEH.
That and not reading shitty 4koma.

if anyone reads this and wants some basic help or a friend with similar interests, add me on discord: Koritsu#7084

Anyone have a decent tutorial on flex?

Trying to get ahead on my course but I'm not finding anything promising with a quick search

who thought it was a good idea that anonymous classes should implicitly hold a reference to the containing object

who thought it was a good idea in general when it's impossible to specify a constructor. who thought it was a good idea to make the constructor the same name as the class rather than this like in D

>anonymous classes
Since when was this a thing exactly?

How do lists work generally?
I don't get how they're different to ArrayLists/Vectors, or what bidirectional, doubly-linked or linear mean.

are you talking about linked lists?

java, it's what you had to use before "lambdas" were added

I think?
I don't know what that means.
One of the questions I've come across is:
>Create a list, xList , of N empty sequences
I don't get it. Do lists store single values? Or sequences of values?

What context is the question in?

depends what language but a list can store 0 to many items, and those items can be lists themselves

I don't think the full context would help much, I don't know what lists are or how they differ from other data structures.
What makes a list a list? Why would you use it over a vector/ArrayList?
That sounds exactly like a 2D vector/ArrayList.

A list is an abstract mathematical concept.
std::list/java.util.LinkedList and std::vector/java.util.ArrayList are two different implementations of that. In Java they both implement the List interface.

>it's impossible to specify a constructor
?

It depends how abstract an answer you want.
You can be talking about the abstract data type, where you just have a thing which you basically can
- Have an empty list
- Append something to the list
- Prepend something to the list
- Get the head (the first element)
- Get the tail (everything but the first element)
It doesn't matter how it's actually implemented, but these are roughly the operations it needs to support.
en.wikipedia.org/wiki/List_(abstract_data_type)

Then you can talk about the concrete data type, a linked list. Which refers to "nodes" that have a reference/pointer to the next node, forming a list (as above).
en.wikipedia.org/wiki/Linked_list

Okay, thanks.
So by linked list, does this mean basically that one node only knows about the link to the ones either side of it? Is that where bidirectional comes from?
Are those doubly-linked lists and lists that can only go node-to-node forwardly are singly-linked lists?

(you).friends.Add(this);

Here's a node of a singly linked list in Java.
class Node
{
T data;
Node next;
}
And here's a doubly linked list node.
class Node
{
T data;
Node next;
Node prev;
}

Singly-linked lists can only be traversed forwards, because an element only holds a reference to the one following it.
Doubly-linked lists can be traversed in both directions, because elements hold two references, one per each neighbor.

>Are those doubly-linked lists and lists that can only go node-to-node forwardly are singly-linked lists?
Yes.
Singly linked lists can only go forward.
Doubly linked lists can go either way.

Made a discord discord.gg/Qh2MjT for opengl friends

Fuck off, you proprietary Sup Forums cuck.