/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?


Previous thread:

Attached: 1491031741878 (1).gif (400x267, 152K)

Other urls found in this thread:

emptywheel.net/2017/09/14/software-is-a-long-con/
quartushelp.altera.com/15.0/mergedProjects/hdl/vhdl/vhdl_file_dir_ram_init.htm
a.co/fLTGtCf
twitter.com/NSFWRedditImage

Fixing errors.

Thank you for posting a tasteful image

WE WUZ

Attached: software-enginners.png (1515x663, 116K)

>software "engineering" is srs business
emptywheel.net/2017/09/14/software-is-a-long-con/

Wow, you clearly don't understand trade-offs, you cookie-cutter shit. Get out of here. I'm a real engineer.

Getting rid of my turbo autism.
>working out
>be more talkative
>job interview at a multinational tomorrow
>lunch with a woman in two days
The only thing lacking is getting rid of my virginity.

You're welcome

Attached: 1498866208019.png (1000x793, 717K)

>"lunch" with a woman
>not dinner
>still hasn't lost his virginity
It's all over for you. It's just too late.

r8 my autism

Attached: 1518153712850.png (525x307, 21K)

the way moves work is that the move-constructed/assigned object steals pointers to heap-allocated resources from the moved-from object (and then nulls those pointers in the moved-from object), allowing you to skip both the copying/initialization of such resources in the moved-to object (since they're already there), and the destruction/deallocation of such in the moved-from object (since they belong to the moved-to object now). but keep in mind the heap resources themselves don't actually move in memory. the reason std::vector::reserve() results in copies is that it has to allocate a new array of the target size somewhere else in memory that doesn't overlap with the existing array. for the new array to "move" from the original would be to steal the original's data pointer (in other words, it would allocate a new larger array somewhere, but then just keep pointing to the old one). and if you used the newly allocated array/pointer, but move constructed its elements from the elements of the original array, the pointers to resources in the new array elements would point to the memory range of the original array, meaning you wouldn't be able to deallocate that memory without destroying the resources pointed to by elements in the new/resized array

hire a hooker

Oh fuck, switched something around

Attached: 1491497437608.png (514x308, 21K)

>if string is all alphabetic then it's neither a word nor a number
what, didn't you get neither/word branches backwards?

I'm gonna go from Python to C, low level programming seems fun, how best should I go about learning it?

Ugly fizzbuzz, like everything in Rust.

She asked me to come over and have dinner with her. I refused like a retard and opted for lunch instead.
That's the easy way out. Especially since prostitution is legal in my country. I could do it, but I don't want to bang some uninterested chick. It has to be dynamic, you know.
I might bang some chick when I'm on holiday in China though.

nand2tetris.org

you think I'm joking, but once you've built a chipset you will never be confused by pointers or data structures ever again.

i am testbenching my mips processor in quartus using 2 different tools (ModelSim and uwf) but they both give different results. any ideas bros?

>She asked me to come over and have dinner with her. I refused like a retard and opted for lunch instead.
Sounds like something that happened for sure.

>any ideas bros?
I guess your design isn't particularly reliable if it's easily affected by the details of the simulation.

i-im just following the textbook...

Attached: sakura accepting her death.png (500x411, 247K)

I know it sounds fishy as fuck, but it's real. Obviously I'm not going to post my chat conversation.
The question is: how do I become alpha and bang her?

begin programming in node.js
also not Sup Forums

thanks user I'll check it out

I have 3 ways to initialize my ram, which is the best way?

-- Populate RAM with the desired value
-- Need to manually input the values the tho xd
FUNCTION init_rom RETURN ram_type IS
VARIABLE r : ram_type;
BEGIN
FOR i IN r'RANGE LOOP
r(i) := (OTHERS => '0');
END LOOP;
RETURN r;
END FUNCTION;

SIGNAL muh_ram : ram_type := (
0 => "10001100000000100000000000000000",
4 => "10001100000000110000000000000001",
8 => "00000000010000110000100000100000",
12 => "10101100000000010000000000000011",
16 => "00010000001000101111111111111111",
20 => "00010000001000011111111111111010",
OTHERS => (OTHERS => '0')
);

-- Method obtained from this link:quartushelp.altera.com/15.0/mergedProjects/hdl/vhdl/vhdl_file_dir_ram_init.htm
-- SIGNAL muh_ram : ram_type;
-- ATTRIBUTE ram_init_file : string;
-- ATTRIBUTE ram_init_file OF muh_ram : SIGNAL IS "rom_memory.mif";

What got you guys interested in programming? Where did you start?

The author of this article clearly doesn't understand free software.
If software engineering isn't my job, and I do it anyway, and my code is shit, then, yeah, no one really has any place complaining about the results. Just like if I make a sandwich and forget it somewhere, and it rots before someone else picks it up, I'm not responsible for that person's food poisoning.

What would a practical version of this look like?

How old are you?

C++ Primer or The C++ Programming Language

25

>What would a practical version of this look like?
There is no practical version of it. Obviously no one needs a standalone program to check if the input is a word or a number. No one needs a function that does this, either, because "word or number" is an ill-posed question in general. It might make sense in a more specific context, but then the "practical version" depends on the context.

Earn her respect by being a decent human being, and then maybe sex will be something worth considering.
If you just want to get laid then dress well and go to a bar, refuse to acknowledge any awkwardness, and be open to conversation with anyone. Even if chad strikes up a conversation with you you'll be one step closer towards being socially engageable .
Literally all you have to do to be a social butterfly is not make yourself feel like an idiot for not being a social butterfly.

After writing perl scripts to help me farm in FF xiv, I started to realize how fun programming could be. I then decided to take a degree in that field and it just got me even more interested.
nothing special

>how do I become alpha and bang her?
You don't. You just become a cuck, watch her getting banged by a pack of niggers every night, then help her raise her mulatto babies.

>If software purchasers (Often you) refused to buy software that was poorly built and not guaranteed, you might have some safe software that would last. You aren’t interested in paying 1000x the price, are you? So enjoy these planks and give me my $30.
This. Either you give us time, money, and (that's the most important point) understand what is it exactly that you want from a software that you order, then we can get somewhere. But we're still in the infancy of actual requirement formalization. Look at seL4. It took 10 years and shitloads of people to specify, write and prove correctness of a very bare-featured kernel. Unless you are actually ready to wait that long and pay that much for every piece of software, then you can complain.

What's the difference between
auto test(auto x, auto y)
{
return x + y;
}

and
template
T test(T x, T y)
{
return x + y;
}

tryparse

>Earn her respect by being a decent human being, and then maybe sex will be something worth considering.
You're on the wrong board.

Attached: feelina.png (422x509, 334K)

Hope is not lost. Just don't overemphasize the importance of sex, relationships are about much more than that. If you don't want a relationship then find an ethical opportunity for sex and try to make it happen.
There's a lot of lonely people out there dude.

dumb wojakposter
go back to red1t

They are trying to explain (them) how it works. Stallman the coder. Done.

It seems like a lot of people played vidya and that got them interested in computing and programming.
What's it like to go to school for comp sciences?

I started writing websites in elementary school. In high school I played with Linux. That really motivated me into writing scripts. Now I'm an 'engineer' writing glue code for a living.

Wrapping my head around the Reader monad.

learning rxjava :(

need to fix an old java app to serve some shit over http
what is the least painful way of adding http to existing code?
looked into spring mvc but it i aint touching that mess

Ohhhh I SEE

Should we stop?

You're so delusional it's not even funny... if chicks chose their ficki partners based on "human decency", assholes would go extinct. Now go back to or whatever wonderhole you came from, soyfriend.

Attached: rust-dev.jpg (400x400, 19K)

You're on good path m8, would be great if you try no fap

I guess you guys are right. Emphasizing on sex may destroy our relationship. That's the last thing I want to happen. Even if the relationship is just mutual friendship.
I can always go to a bar and pick up a drunk alcoholic degenerate to bang.

#include
// 1 num, 2 word, 0 neither
int numOrWord(char const *s) {
int c = *s, dp, n = 0;
if (isalpha(c)) {
while (c = *++s)
if (!isalpha(c)) return 0;
return 2;
} else if ((dp = (c == '.')) || c == '-'
|| (n = isdigit(c))) {
while (c = *++s) {
if (c == '.') {
if (!dp) dp = 1;
else return 0;
} else if (!isdigit(c)) return 0;
else if (!n) n = 1;
}
return n;
}
return 0;
}

good on ya m8
keep it going, and focus on the long term

psst, we do do that

enjoy being a virgin and earnestly believing that you aren't the reason why

also stop touching the women you work with for fuck's sake they don't like it

W-what??

Total fucking brainlet here. I want to (((make a video game))) in my spare time and I know nothing about programming, this is a project of love so I don't want to use a pre-made game engine. The game will be a hybrid visual novel/point and click thing (i know so original) and a friend of mine who's great at programming recommended I do it in C++ using SDL for graphics and sound. This seems like a simple enough approach but he said to "only use C++ if you plan on avoiding it's more autistic aspects which will only confuse you without benefiting you in any way." What the fuck could he possibly have meant by this? He just went from part time to full time university student so chances I have to talk with him are really fucking slim. What "autistic" features of C++ should I avoid and what specific literature/video series/whatever do you guys recommend I get my information from?

still not practical but at least this one actually works

>I know nothing about programming
>I don't want to use a pre-made game engine
Woopsie!

>psst, we do do that
I'm not talking about programming-sock-wearing /dpt/ girls(male).

A simple (very simple) Spring webapp with basic (very basic) persistence. Tomcat keeps giving me 404s, there are like 40324 places you can get an error somewhere in the process of developing, makes me feel like a fucking brainlet even though I'm not so terribly bad at Java.

Fuck web development and fuck Spring especially.

>it's more autistic aspects
no idea what he could have meant

Attached: Screen Shot 2018-03-02 at 7.25.17 PM.png (1306x1510, 417K)

Thanks for the "help"
Jesus christ that's fucking terrifying, no wonder he wanted me to avoid autism

>a friend of mine who's great at programming recommended I do it in C++ using SDL for graphics and sound
Your friend is a fucking retard. There is not a single rational reason for a beginner to write a "visual novel/point and click thing" in C++.

> What "autistic" features of C++ should I avoid
All of them.

>what specific literature/video series/whatever do you guys recommend I get my information from?
Pick a sane language and then we'll see.

your friend is a retard and you don't sound like you know what you're doing, so I'd really honestly recommend something like Monogame, if you're going to write an engine. It's funny, cos if you're using C++ I hope you like autistic aspects that will definitely confuse you and probably not benefit you at all.

However, use unity, just use fucking unity, fuck it, I hate that trash but it might be the best option for you. don't try to write your own goddamn engine dude it's not as simple as it probably seems in your mind. You'll definitely just end up spinning tires and getting nowhere, probably getting frustrated as shit in the process.

Has anyone here Read c++ primer plus? Everyone on the net say it's shit for some reason

>What "autistic" features of C++ should I avoid
Well, for example, smart pointers, variadic templates, heavy type logic, mixins, inheritance esp. multiple, and very big classes all tend to be more trouble than they're worth.

jesus please stop

No problem. You can get 'more' here: a.co/fLTGtCf

>However, use unity, just use fucking unity, fuck it
Why the fuck should he use Unity or any other bloated pile of shitware for a simple task like his? It takes more effort to learn to deal with unity than to write a visual novel thing from scratch.

This
//in c#, I don't know python
if(int.TryParse( userInput, out number) == false)
{
Console.WriteLine("User input could not be parsed to an integer");
}
else
{
Console.WriteLine("User input successfully parsed as an integer");
}

Fucking this.

This sounds less like advice and more like you wanting me to learn YOUR preferred language without a single bit of solid reasoning.
>use unity
opinion discarded because
>i already said i don't want to use a pre made engine
>you recommended the worst pre made engine of all that you could possibly have recommended
Actual advice! Thanks I'll keep all this in mind while I'm learning.
>No problem. You can get 'more' here: a.co/fLTGtCf
actually laughed

>It took 10 years and shitloads of people to specify, write and prove correctness of a very bare-featured kernel
And that is the story of the absolute state of software "engineering".

Why does C++ still not have something like this?
class MyClass {
string myVar;
public:
template
decltype(myVar)& var() {
// may be either string or const string
return myVar;
}
};

Options:
Godot
Monogame
Cocos
Unity

Early minecraft survival alpha.
Learned C++ over a couple years, then learned a tiny bit of C, then spent a couple more years unlearning C++, then learned Plan 9 C followed by ANSI C.
Now I generally write Plan 9 C, and occasionally ANSI C.

He wants to write his own engine.

>it took more time to specify a more complex project, probably with a smaller team and budget
>the absolute STATE of X!

HSpeaking of gayme engines. How good is urho?

I'm not denying we're in a shithole. I'm not a smart enough person to find a solution to a problem of that scale. We don't have 3000 years of experience bridge builders had, only ~60. But I at least hope we're slowly moving in the right direction, that it'll get better someday.

>This sounds less like advice and more like you wanting me to learn YOUR preferred language without a single bit of solid reasoning.
Is that why I'm not advising you to pick any of MY preferred languages, but rather just warning you that C++ is a very poor choice, you drooling idiot? Suit yourself. The only borderline-defensible excuse to use C++ for a hobby project these days is if performance is your primary concern. In your case, performance is the last of your concerns.

If I have the integer "91", and I have an unlimited amount of "pieces" {16,8,4,2,1}.
I want to fit the least amount of pieces into 91 as possible(expending the largest pieces first, then the smaller ones, going down the list).
In this case, It would be five 16 pieces(91 / 16), one 8 piece( (91 % 16) / 8 ), one 2 piece( (91 % 16 % 8) / 2 ), and a one piece piece( (91 % 16 % 8 % 2) / 1 ). for a total of 5 + 1 + 1 + 1 = 9 total chunks.
Whats the quickest way to calculate this that isnt just a for-loop with an appended modulo each time? Is there a standard math operator that can get the same result?

is a career in cloud tech like virtualisation better than coding ?

i think it is disgusting to be a codemonkey, i mean wtf ! staring at lines of code 8 hours a day for the rest of your life ? fuck off boss !

a cloud career is perfect, it's like a medical doctor, you study a lot but when you get the job you sit on your ass and use minimal energy and some experience to consult with clients.

i'm joining the dark side brothers, not sure about the money though, does it pay well ?

Attached: 7cwh3vu6l7bz.jpg (400x300, 20K)

>drooling idiot
ruh roh, this guy again

even if you were right, you are still the problem, try some introspection

I uh, actually got the retarded just-woke-up-brain going on and missed the sentence about it being a VN completely, and I take back everything I said about unity. Sorry.

monogame would suit you fine guy, C# is considerably easier than C++, especially if you don't have any knowledge of programming. C++ is, in my opinion, a pretty bad starting point these days.

monogame provides everything you need to develop an engine. spritebatches and shit are super easy to manage, and you'd have a cake of a time learning how to do basically any of the shit you would want in a VN. If you're set on C++ for some reason, SDL does have everything you need, but you'll probably run into a lot more issues and need to put a bit more effort into everything you do, basically, before you're at the point where you actually have stuff working somewhat well.

Also, side note for the possibly retarded among you: monogame is not an engine.

8* total
typo

I mean considering I'm making a video game I think it'd be nice if a lot of poorfags with god awful computers were able to run it if that's what you mean by 'performance'

>is ops better than dev?
Pros and cons to each.
Retards from both sides will tell you the other side is fag-pansy-wankers cuz X, Y, Z.

the second will only work when both arguments are of the same type or convertible to a deducible common type (or explicitly-specified type, in which case the arguments and return value must be convertible to it) according to conversion/deduction/etc rules, and the return type will also always be whatever that type is (as long as the the expression "x + y" is well-formed and evaluates to a type convertible to said type)

the first will accept arguments of different types independently and will only apply the standard conversions (array-to-pointer, reference collapsing, etc), and will return by value an object whose type is that which the expression "x + y" (if well-formed) evaluates to given the types of x and y, even if that is a different type than those of either of the arguments

You point out that you don't know programming and yet you explicitly state that you want to write your own engine. To what end? If you intention is to avoid royalties or fees, you could easily go with Godot or Cocos.

>Look at seL4. It took 10 years and shitloads of people to specify, write and prove correctness of a very bare-featured kernel.
To be fair, they went above and beyond just doing that. They had to verify that the compiler produced correct machine code. They decided to produce an analysis for hard real time use of the kernel. Verifying the C code with respect to the specification only took 3 years.

why not just not prove the correctness tho

think about it man, a dev career fucking sucks, they can always outsource your ass, a clound consultant is hot shit, each year of experience raises your value high in the job market, and it's not labor intensive, you dress well, you sit in fancy office and laugh at those weird nerdy programmers !

Rust's compiler is crazy good at global optimizations. I've tested it a bit and it's capable of compiling a big iterator pipeline into an O(1) formula, even when it's split up into a bunch of different functions in different modules.

hey /dpt/ newfag here

how do I thread two different functions from two different classes in c++?

class SomeClass1 {
public:
void someFunctionIWantToThread(int someshit);
SomeClass1(int someshit);
~SomeClass1();
}

class SomeClass2 {
public:
void someFunctionIWantToThread(int someshit);
SomeClass2(int someshit);
~SomeClass2();
}

int main() {
std::thread thread1 (SomeClass1.someFunctionIWantToThread, thatshit);
std::thread thread2 (SomeClass2.someFunctionIWantToThread, thatshit);
thread1.join();
thread2.join();


}


this shit does compile.

Can someone explain "game engine" to me?
Some is it just reusable code or general collision detection(if you need that) etc?

Not him but i am going to write a game engine in c with sdl because A) performance is nice and B) fuck sepples

Yes.